feat: 规则引擎版本 报存代码
parent
e0725466a0
commit
6cec4b330f
|
@ -16,8 +16,10 @@ public class ServiceNameConstants {
|
|||
*/
|
||||
public static final String SYSTEM_SERVICE = "muyu-system";
|
||||
|
||||
|
||||
/**
|
||||
* 文件服务的serviceid
|
||||
*/
|
||||
public static final String FILE_SERVICE = "muyu-file";
|
||||
public static final String MUYU_KVT = "muyu-kvt";
|
||||
}
|
||||
|
|
|
@ -38,4 +38,7 @@ public interface RemoteUserService {
|
|||
@PostMapping("/user/register")
|
||||
public Result<Boolean> registerUserInfo (@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
}
|
||||
@PostMapping("/selectUserId")
|
||||
public Result<SysUser> selectUserId(@RequestParam("userId") Long userId);
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,11 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
|||
public Result<Boolean> registerUserInfo (SysUser sysUser, String source) {
|
||||
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<SysUser> selectUserId(Long userId) {
|
||||
return Result.error("查询用户失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,5 +16,13 @@
|
|||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-kvt-remote</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.kvt.client.config;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
|
||||
/**
|
||||
* 数据接入客服端配置类 KvtClientConfig
|
||||
*
|
||||
* @author LeYang
|
||||
* on 2024/5/8
|
||||
*/
|
||||
@ComponentScan
|
||||
@Import(value = {KvtClientRunner.class})
|
||||
public class KvtClientConfig {
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.kvt.client.config;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.kvt.domain.Kvt;
|
||||
import com.muyu.kvt.domain.req.KvtQueryReq;
|
||||
import com.muyu.kvt.remote.RemoteDataManagerService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
|
||||
/**
|
||||
* 初始化加载 KvtCilentRunner
|
||||
*
|
||||
* @author LeYang
|
||||
* on 2024/5/8
|
||||
*/
|
||||
@Log4j2
|
||||
public class KvtClientRunner implements ApplicationRunner {
|
||||
|
||||
@Autowired
|
||||
private RemoteDataManagerService remoteDataManagerService;
|
||||
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
// Result<TableDataInfo<Kvt>> list = remoteDataManagerService.list(null);
|
||||
log.info("list");
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
com.muyu.kvt.client.config.KvtClientConfig
|
|
@ -22,6 +22,12 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-system</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-kvt-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.kvt.remote;
|
||||
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
import com.muyu.kvt.domain.Kvt;
|
||||
import com.muyu.kvt.domain.req.KvtQueryReq;
|
||||
|
||||
import com.muyu.kvt.remote.factory.DataManagerFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
/**
|
||||
* RemoteUser
|
||||
*
|
||||
* @author LeYang
|
||||
* on 2024/4/27
|
||||
*/
|
||||
@FeignClient(
|
||||
contextId = "RemoteDataManagerService",
|
||||
value = ServiceNameConstants.MUYU_KVT,
|
||||
fallbackFactory = DataManagerFactory.class,
|
||||
path = "/kvt"
|
||||
)
|
||||
public interface RemoteDataManagerService {
|
||||
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<Kvt>> list(KvtQueryReq kvtQueryReq) ;
|
||||
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package com.muyu.kvt.remote;
|
||||
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.kvt.remote.factory.RemoteUser;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* RemoteUser
|
||||
*
|
||||
* @author LeYang
|
||||
* on 2024/4/27
|
||||
*/
|
||||
@FeignClient(
|
||||
contextId = "RemoteUserSer",
|
||||
value = ServiceNameConstants.SYSTEM_SERVICE,
|
||||
fallbackFactory = RemoteUser.class,
|
||||
path = "/user"
|
||||
)
|
||||
public interface RemoteUserSer {
|
||||
/**
|
||||
* 根据用户id查询用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/selectUserId")
|
||||
public Result<SysUser> selectUserId(@RequestParam("userId") Long userId);
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.kvt.remote.factory;
|
||||
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.kvt.domain.Kvt;
|
||||
import com.muyu.kvt.domain.req.KvtQueryReq;
|
||||
import com.muyu.kvt.remote.RemoteDataManagerService;
|
||||
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 用户服务降级处理
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
@Component
|
||||
public class DataManagerFactory implements FallbackFactory<RemoteDataManagerService> {
|
||||
|
||||
@Override
|
||||
public RemoteDataManagerService create(Throwable cause) {
|
||||
return new RemoteDataManagerService() {
|
||||
@Override
|
||||
public Result<TableDataInfo<Kvt>> list(KvtQueryReq kvtQueryReq) {
|
||||
return Result.error("获取数据失败");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
package com.muyu.kvt.remote.factory;
|
||||
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.kvt.remote.RemoteUserSer;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 用户服务降级处理
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
@Component
|
||||
public class RemoteUser implements FallbackFactory<RemoteUserSer> {
|
||||
|
||||
@Override
|
||||
public RemoteUserSer create(Throwable cause) {
|
||||
|
||||
return new RemoteUserSer() {
|
||||
@Override
|
||||
public Result<SysUser> selectUserId(Long userId) {
|
||||
return Result.error(cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
com.muyu.kvt.remote.factory.RemoteUser
|
||||
com.muyu.kvt.remote.factory.DataManagerFactory
|
||||
|
|
|
@ -5,7 +5,8 @@ import com.muyu.common.security.annotation.EnableMyFeignClients;
|
|||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
|
|
|
@ -140,7 +140,6 @@ public class KvtController extends BaseController {
|
|||
public Result<List<DataType>> dataTypeList(){
|
||||
List<DataType> dataTypeList=kvtService.dataTypeList();
|
||||
return Result.success(dataTypeList);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
import com.muyu.kvt.dataStructure.OverallDataStructure;
|
||||
import com.muyu.kvt.datadisplay.DataDisplay;
|
||||
import com.muyu.kvt.dept.DeptUserKvt;
|
||||
|
@ -24,8 +25,8 @@ import com.muyu.kvt.dictionary.Dictionaryy;
|
|||
import com.muyu.kvt.domain.*;
|
||||
|
||||
import com.muyu.kvt.permissions.PermissionsUser;
|
||||
import com.muyu.kvt.remote.RemoteUserSer;
|
||||
|
||||
import com.muyu.kvt.remote.RemoteDataManagerService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -263,7 +264,7 @@ public class KvtServiceImpl extends ServiceImpl<KvtMapper, Kvt> implements KvtSe
|
|||
}
|
||||
|
||||
@Autowired
|
||||
private RemoteUserSer remoteUserSer;
|
||||
private RemoteUserService remoteUserSer;
|
||||
|
||||
public Result mysql(Kvt kvt) {
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-rule-engine</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-rule-engine-clinet</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.engine.custom;
|
||||
|
||||
|
||||
import com.muyu.engine.action.ActionDiscard;
|
||||
import com.muyu.engine.scope.DataModelEngine;
|
||||
|
||||
/**
|
||||
* @Author: yl
|
||||
* @date: 2024/5/6
|
||||
* @Description: ss-ss
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class engine_custom_email_ss extends DataModelEngine {
|
||||
@Override
|
||||
public void execution () {
|
||||
Object value = getValue();
|
||||
|
||||
if (value == null || "".equals(value) || "null".equals(value)) {
|
||||
throw new ActionDiscard();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,13 +14,16 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.tools.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -100,7 +103,7 @@ private RuleEngineService ruleEngineService;
|
|||
}
|
||||
|
||||
//全局变量
|
||||
public static String url="D:\\JavaTest\\";
|
||||
public static String url="D:\\work\\zglkh\\cloud-server\\muyu-modules\\muyu-rule-engine\\muyu-rule-engine-common\\src\\main\\java\\com\\muyu\\engine\\custom\\";
|
||||
@Override
|
||||
public void RuleEngineVersionAdd(RuleEngineVersion ruleEngineVersion) {
|
||||
this.save(ruleEngineVersion);
|
||||
|
@ -108,6 +111,7 @@ private RuleEngineService ruleEngineService;
|
|||
|
||||
@Override
|
||||
public void updataEngineVersionStatus(RuleEngineVersion ruleEngineVersion) {
|
||||
|
||||
RuleEngineVersion build = RuleEngineVersion.builder()
|
||||
.status("1")
|
||||
.codeIng(ruleEngineVersion.getCodeIng())
|
||||
|
@ -122,7 +126,7 @@ private RuleEngineService ruleEngineService;
|
|||
public void writeCodeAdd(RuleEngineVersion ruleEngineVersion) {
|
||||
try{
|
||||
//文件路径
|
||||
String fileName =ruleEngineVersion.getWriteCode()+".java";
|
||||
String fileName =ruleEngineVersion.getVersionCode()+".java";
|
||||
String filePath = url+fileName;
|
||||
|
||||
//编写java文件
|
||||
|
@ -166,9 +170,58 @@ private RuleEngineService ruleEngineService;
|
|||
System.out.println("运行失败");
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// private String url ="D:\\work\\zglkh\\cloud-server\\muyu-modules\\muyu-rule-engine\\muyu-rule-engine-common\\src\\main\\java\\com\\muyu\\engine\\java";
|
||||
//
|
||||
// //生产源文件
|
||||
// public void writeCodeAdd(RuleEngineVersion ruleEngineVersion) {
|
||||
// try {
|
||||
//
|
||||
// String className = ruleEngineVersion.getVersionCode();
|
||||
// String content = ruleEngineVersion.getCodeIng();
|
||||
// // 指定输出目录
|
||||
// JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
//
|
||||
// try (StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null)) {
|
||||
// // 创建一个内存中的源文件
|
||||
// JavaFileObject sourceFileObject = new JavaSourceFromString(className, content);
|
||||
//
|
||||
// // 编译选项
|
||||
// Iterable<String> options = Arrays.asList("-d", url);
|
||||
// // 编译源代码
|
||||
// JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, null, options, null, Arrays.asList(sourceFileObject));
|
||||
// boolean success = task.call();
|
||||
//
|
||||
// if (success) {
|
||||
// System.out.println("编译成功");
|
||||
// } else {
|
||||
// System.out.println("编译失败");
|
||||
// }
|
||||
//
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// static class JavaSourceFromString extends SimpleJavaFileObject {
|
||||
// final String code;
|
||||
//
|
||||
//
|
||||
// JavaSourceFromString(String name, String code) {
|
||||
// super(URI.create("string:///" + name.replace('.', '/') + Kind.SOURCE.extension), Kind.SOURCE);
|
||||
// this.code = code;
|
||||
// }
|
||||
// @Override
|
||||
// public CharSequence getCharContent(boolean ignoreEncodingErrors) {
|
||||
// return code;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<module>muyu-rule-engine-common</module>
|
||||
<module>muyu-rule-engine-remote</module>
|
||||
<module>muyu-rule-engine-server</module>
|
||||
<module>muyu-rule-engine-clinet</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-unit</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.2.18</version>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-kvt-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-kvt-remote</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,27 @@
|
|||
package com.muyu.kvt.unit;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
/**
|
||||
* 数据启动类 DataUnitApplication
|
||||
*
|
||||
* @author LeYang
|
||||
* on 2024/5/8
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@EnableAsync
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class})
|
||||
public class DataUnitApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DataUnitApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9666
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
redis:
|
||||
host: 115.159.211.196
|
||||
port: 6379
|
||||
password: yl030509
|
||||
main:
|
||||
allow-circular-references: true
|
||||
application:
|
||||
# 应用名称
|
||||
name: muyu-unit
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.muyu.kvt.mapper: DEBUG
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/muyu-unit"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -15,6 +15,7 @@
|
|||
<module>muyu-file</module>
|
||||
<module>muyu-kvt</module>
|
||||
<module>muyu-rule-engine</module>
|
||||
<module>muyu-unit</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
|
|
Loading…
Reference in New Issue