Compare commits
5 Commits
fefc7b04f2
...
e7ce39d31b
Author | SHA1 | Date |
---|---|---|
|
e7ce39d31b | |
|
e94800c28a | |
|
06edeac343 | |
|
42d717f06e | |
|
7ad4101e39 |
|
@ -9,6 +9,9 @@ target/
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
|
|
||||||
|
### Logs ###
|
||||||
|
logs
|
||||||
|
|
||||||
### Eclipse ###
|
### Eclipse ###
|
||||||
.apt_generated
|
.apt_generated
|
||||||
.classpath
|
.classpath
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-core</artifactId>
|
<artifactId>cloud-common-core</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -28,8 +28,8 @@ public class RuleData extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 规则ID
|
* 规则ID
|
||||||
*/
|
*/
|
||||||
@TableId(value = "id",type = IdType.AUTO)
|
@TableId(value = "rule_id",type = IdType.AUTO)
|
||||||
private Long id;
|
private Long ruleId;
|
||||||
/**
|
/**
|
||||||
* 规则分类
|
* 规则分类
|
||||||
*/
|
*/
|
||||||
|
@ -39,17 +39,13 @@ public class RuleData extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private String ruleName;
|
private String ruleName;
|
||||||
/**
|
/**
|
||||||
* 规则代码
|
* 规则类型
|
||||||
*/
|
*/
|
||||||
private String ruleCode;
|
private String ruleType;
|
||||||
/**
|
/**
|
||||||
* 规则说明
|
* 规则作用域
|
||||||
*/
|
*/
|
||||||
private String ruleExplain;
|
private String ruleRegion;
|
||||||
/**
|
|
||||||
* 响应示例
|
|
||||||
*/
|
|
||||||
private String ruleRespond;
|
|
||||||
/**
|
/**
|
||||||
* 规则状态
|
* 规则状态
|
||||||
*/
|
*/
|
||||||
|
@ -57,12 +53,11 @@ public class RuleData extends BaseEntity {
|
||||||
|
|
||||||
public static RuleData updBuild(RuleDataUpdReq ruleDataUpdReq, Supplier<Long> idSupplier) {
|
public static RuleData updBuild(RuleDataUpdReq ruleDataUpdReq, Supplier<Long> idSupplier) {
|
||||||
return RuleData.builder()
|
return RuleData.builder()
|
||||||
.id(idSupplier.get())
|
.ruleId(idSupplier.get())
|
||||||
.ruleClassify(ruleDataUpdReq.getRuleClassify())
|
.ruleClassify(ruleDataUpdReq.getRuleClassify())
|
||||||
.ruleName(ruleDataUpdReq.getRuleName())
|
.ruleName(ruleDataUpdReq.getRuleName())
|
||||||
.ruleCode(ruleDataUpdReq.getRuleCode())
|
.ruleType(ruleDataUpdReq.getRuleType())
|
||||||
.ruleExplain(ruleDataUpdReq.getRuleExplain())
|
.ruleRegion(ruleDataUpdReq.getRuleRegion())
|
||||||
.ruleRespond(ruleDataUpdReq.getRuleRespond())
|
|
||||||
.ruleStatus(ruleDataUpdReq.getRuleStatus())
|
.ruleStatus(ruleDataUpdReq.getRuleStatus())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,15 +25,15 @@ public class RuleDataClassify extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 类型ID
|
* 类型ID
|
||||||
*/
|
*/
|
||||||
@TableId(value = "id",type = IdType.AUTO)
|
@TableId(value = "rule_data_classify_id",type = IdType.AUTO)
|
||||||
private Long ruleId;
|
private Long ruleDataClassifyId;
|
||||||
/**
|
/**
|
||||||
* 规则类型名称
|
* 规则类型名称
|
||||||
*/
|
*/
|
||||||
private String ruleRemark;
|
private String ruleTypeName;
|
||||||
/**
|
/**
|
||||||
* 规则类型状态(是否启用)
|
* 规则类型描述
|
||||||
*/
|
*/
|
||||||
private String ruleClassify;
|
private String ruleTypeDescription;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.muyu.common.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:蓬叁
|
||||||
|
* @Package:com.muyu.common.domain
|
||||||
|
* @Project:cloud-rule
|
||||||
|
* @name:RuleVersion
|
||||||
|
* @Date:2024/8/23 上午11:43
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName(value = "rule_version")
|
||||||
|
public class RuleVersion extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则版本ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "rule_version_id",type = IdType.AUTO)
|
||||||
|
private Long ruleVersionId ;
|
||||||
|
/**
|
||||||
|
* 版本类
|
||||||
|
*/
|
||||||
|
private String ruleVersionType ;
|
||||||
|
/**
|
||||||
|
* 版本名称
|
||||||
|
*/
|
||||||
|
private String ruleVersionName ;
|
||||||
|
/**
|
||||||
|
* 版本编号
|
||||||
|
*/
|
||||||
|
private String ruleVersionCode ;
|
||||||
|
/**
|
||||||
|
* 是否激活
|
||||||
|
*/
|
||||||
|
private String ruleVersionActivate ;
|
||||||
|
/**
|
||||||
|
* 版本状态
|
||||||
|
*/
|
||||||
|
private String ruleVersionStatus ;
|
||||||
|
/**
|
||||||
|
* 是否测试
|
||||||
|
*/
|
||||||
|
private String ruleVersionTest ;
|
||||||
|
/**
|
||||||
|
* 代码
|
||||||
|
*/
|
||||||
|
private String ruleVersionText ;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String ruleVersionRemark ;
|
||||||
|
|
||||||
|
}
|
|
@ -2,6 +2,8 @@ package com.muyu.common.domain.req;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.muyu.common.core.validation.custom.IsSysRuleRegion;
|
||||||
|
import com.muyu.common.core.validation.custom.IsSysRuleZM;
|
||||||
import com.muyu.common.core.validation.custom.IsSystemYesNo;
|
import com.muyu.common.core.validation.custom.IsSystemYesNo;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
@ -36,20 +38,19 @@ public class RuleDataUpdReq {
|
||||||
,description = "规则名称一般为类型名称,方便使用者进行区分" ,requiredProperties = {"ruleName"})
|
,description = "规则名称一般为类型名称,方便使用者进行区分" ,requiredProperties = {"ruleName"})
|
||||||
private String ruleName;
|
private String ruleName;
|
||||||
/**
|
/**
|
||||||
* 规则代码
|
* 规则类型
|
||||||
*/
|
*/
|
||||||
@Schema(title = "规则代码",type = "String")
|
@NotEmpty(message = "规则类型不可为空")
|
||||||
private String ruleCode;
|
@IsSysRuleZM //判断 Z 自定义规则 M 模板规则
|
||||||
|
@Schema(description = "规则类型",defaultValue = "Z",type = "String")
|
||||||
|
private String ruleType;
|
||||||
/**
|
/**
|
||||||
* 规则说明
|
* 规则作用域
|
||||||
*/
|
*/
|
||||||
@Schema(title = "规则说明",type = "String")
|
@NotEmpty(message = "规则作用域不可为空")
|
||||||
private String ruleExplain;
|
@IsSysRuleRegion
|
||||||
/**
|
@Schema(description = "规则作用域",defaultValue = "数据字段",type = "String")
|
||||||
* 响应示例
|
private String ruleRegion;
|
||||||
*/
|
|
||||||
@Schema(title = "响应示例",type = "String")
|
|
||||||
private String ruleRespond;
|
|
||||||
/**
|
/**
|
||||||
* 规则状态
|
* 规则状态
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -40,20 +40,15 @@ public class RuleDataResp {
|
||||||
@Schema(description = "规则名称",defaultValue = "邮箱规则接口",type = "String")
|
@Schema(description = "规则名称",defaultValue = "邮箱规则接口",type = "String")
|
||||||
private String ruleName;
|
private String ruleName;
|
||||||
/**
|
/**
|
||||||
* 规则代码
|
* 规则类型
|
||||||
*/
|
*/
|
||||||
@Schema(description = "规则代码",defaultValue = "sql",type = "String")
|
@Schema(description = "规则类型",defaultValue = "邮箱校验",type = "String")
|
||||||
private String ruleCode;
|
private String ruleType;
|
||||||
/**
|
/**
|
||||||
* 规则说明
|
* 规则作用域
|
||||||
*/
|
*/
|
||||||
@Schema(description = "规则说明",defaultValue = "说明123",type = "String")
|
@Schema(description = "规则作用域",defaultValue = "数据字段",type = "String")
|
||||||
private String ruleExplain;
|
private String ruleRegion;
|
||||||
/**
|
|
||||||
* 响应示例
|
|
||||||
*/
|
|
||||||
@Schema(description = "响应示例",defaultValue = "json{...}",type = "String")
|
|
||||||
private String ruleRespond;
|
|
||||||
/**
|
/**
|
||||||
* 规则状态
|
* 规则状态
|
||||||
*/
|
*/
|
||||||
|
@ -73,11 +68,10 @@ public class RuleDataResp {
|
||||||
|
|
||||||
public static RuleDataResp ruleDataBuild(RuleData ruleData, Supplier<List<RuleDataResp>> function) {
|
public static RuleDataResp ruleDataBuild(RuleData ruleData, Supplier<List<RuleDataResp>> function) {
|
||||||
return RuleDataResp.builder()
|
return RuleDataResp.builder()
|
||||||
.id(ruleData.getId())
|
.id(ruleData.getRuleId())
|
||||||
.ruleName(ruleData.getRuleName())
|
.ruleName(ruleData.getRuleName())
|
||||||
.ruleCode(ruleData.getRuleCode())
|
.ruleType(ruleData.getRuleType())
|
||||||
.ruleExplain(ruleData.getRuleExplain())
|
.ruleRegion(ruleData.getRuleRegion())
|
||||||
.ruleRespond(ruleData.getRuleRespond())
|
|
||||||
.ruleStatus(ruleData.getRuleStatus())
|
.ruleStatus(ruleData.getRuleStatus())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu;
|
package com.muyu;
|
||||||
|
|
||||||
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
* @Date:2024/8/22 下午7:49
|
* @Date:2024/8/22 下午7:49
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@EnableMyFeignClients
|
||||||
public class MuYuRuleDataApplication {
|
public class MuYuRuleDataApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(MuYuRuleDataApplication.class, args);
|
SpringApplication.run(MuYuRuleDataApplication.class, args);
|
||||||
|
|
|
@ -44,66 +44,69 @@ public class RuleDataController {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @PostMapping("/add")
|
||||||
|
// @Operation(summary = "添加",description = "根据用户")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改接口规则
|
* 修改接口规则
|
||||||
* @param id
|
* @param ruleId
|
||||||
* @param ruleDataUpdReq
|
* @param ruleDataUpdReq
|
||||||
* @return 修改结果
|
* @return 修改结果
|
||||||
*/
|
*/
|
||||||
@PutMapping("/upd/{id}")
|
@PutMapping("/upd/{ruleId}")
|
||||||
@Operation(summary = "接口规则修改",description = "通过ID修改接口规则信息")
|
@Operation(summary = "接口规则修改",description = "通过ID修改接口规则信息")
|
||||||
public Result<String> update(
|
public Result<String> update(
|
||||||
@Schema(title = "客户ID",type = "Long",defaultValue = "1",description = "修改接口规则信息需要唯一条件")
|
@Schema(title = "客户ID",type = "Long",defaultValue = "1",description = "修改接口规则信息需要唯一条件")
|
||||||
@PathVariable("id") Long id,
|
@PathVariable("ruleId") Long ruleId,
|
||||||
@Validated @RequestBody RuleDataUpdReq ruleDataUpdReq){
|
@Validated @RequestBody RuleDataUpdReq ruleDataUpdReq){
|
||||||
ruleDataService.updateById(RuleData.updBuild(ruleDataUpdReq,() -> id));
|
ruleDataService.updateById(RuleData.updBuild(ruleDataUpdReq,() -> ruleId));
|
||||||
return Result.success(null,"操作成功");
|
return Result.success(null,"操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除接口规则
|
* 删除接口规则
|
||||||
* @param id 请求ID
|
* @param ruleId 请求ID
|
||||||
* @return 删除结果
|
* @return 删除结果
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("/del/{id}")
|
@DeleteMapping("/del/{ruleId}")
|
||||||
@Operation(summary = "接口规则删除",description = "通过ID删除接口规则")
|
@Operation(summary = "接口规则删除",description = "通过ID删除接口规则")
|
||||||
public Result<String> delete(@PathVariable("id") Long id){
|
public Result<String> delete(@PathVariable("ruleId") Long ruleId){
|
||||||
ruleDataService.getOptById(id);
|
ruleDataService.getOptById(ruleId);
|
||||||
return Result.success(null,"操作成功");
|
return Result.success(null,"操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID获取接口规则信息
|
* 根据ID获取接口规则信息
|
||||||
* @param id 请求ID
|
* @param ruleId 请求ID
|
||||||
* @return 规则信息
|
* @return 规则信息
|
||||||
*/
|
*/
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{ruleId}")
|
||||||
@Operation(summary = "根据ID获取客户信息",description = "通过ID获取接口规则信息")
|
@Operation(summary = "根据ID获取客户信息",description = "通过ID获取接口规则信息")
|
||||||
public Result<RuleData> findById(@PathVariable("id") Long id){
|
public Result<RuleData> findById(@PathVariable("ruleId") Long ruleId){
|
||||||
return Result.success(ruleDataService.getById(id),"操作成功");
|
return Result.success(ruleDataService.getById(ruleId),"操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*通过ID禁用规则
|
*通过ID禁用规则
|
||||||
* @param id 请求ID
|
* @param ruleId 请求ID
|
||||||
* @return 禁用结果
|
* @return 禁用结果
|
||||||
*/
|
*/
|
||||||
@GetMapping("/disable/{id}")
|
@GetMapping("/disable/{ruleId}")
|
||||||
@Operation(summary = "通过ID禁用规则",description = "通过ID禁用规则之后,禁止用户在使用此规则")
|
@Operation(summary = "通过ID禁用规则",description = "通过ID禁用规则之后,禁止用户在使用此规则")
|
||||||
public Result<String> disable(@PathVariable("id") Long id){
|
public Result<String> disable(@PathVariable("ruleId") Long ruleId){
|
||||||
this.ruleDataService.disable(id);
|
this.ruleDataService.disable(ruleId);
|
||||||
return Result.success(null,"操作成功");
|
return Result.success(null,"操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*通过ID启动规则
|
*通过ID启动规则
|
||||||
* @param id 请求ID
|
* @param ruleId 请求ID
|
||||||
* @return 启动结果
|
* @return 启动结果
|
||||||
*/
|
*/
|
||||||
@GetMapping("/enable/{id}")
|
@GetMapping("/enable/{ruleId}")
|
||||||
@Operation(summary = "通过ID启动规则",description = "通过ID禁用规则之后,禁止用户在使用此规则")
|
@Operation(summary = "通过ID启动规则",description = "通过ID禁用规则之后,禁止用户在使用此规则")
|
||||||
public Result<String> enable(@PathVariable("id") Long id){
|
public Result<String> enable(@PathVariable("ruleId") Long ruleId){
|
||||||
this.ruleDataService.enable(id);
|
this.ruleDataService.enable(ruleId);
|
||||||
return Result.success(null,"操作成功");
|
return Result.success(null,"操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,14 @@ import java.util.List;
|
||||||
public interface RuleDataService extends IService<RuleData> {
|
public interface RuleDataService extends IService<RuleData> {
|
||||||
List<RuleDataResp> selectList(RuleDataListReq ruleDataListReq);
|
List<RuleDataResp> selectList(RuleDataListReq ruleDataListReq);
|
||||||
|
|
||||||
void disable(Long id);
|
void disable(Long ruleId);
|
||||||
|
|
||||||
void enable(Long id);
|
void enable(Long ruleId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过规则ID设置规则状态
|
* 通过规则ID设置规则状态
|
||||||
* @param id ID
|
* @param ruleId ID
|
||||||
* @param status 状态 SysIsYesNo
|
* @param status 状态 SysIsYesNo
|
||||||
*/
|
*/
|
||||||
public void settingStatus(Long id, String status);
|
public void settingStatus(Long ruleId, String status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,6 @@ public class RuleDataServiceImpl
|
||||||
extends ServiceImpl<RuleDataMapper, RuleData>
|
extends ServiceImpl<RuleDataMapper, RuleData>
|
||||||
implements RuleDataService {
|
implements RuleDataService {
|
||||||
|
|
||||||
@Autowired private RuleDataMapper ruleDataMapper;
|
|
||||||
@Autowired private RuleDataService ruleDataService;
|
|
||||||
@Autowired private RuleDataInfoService ruleDataInfoService;
|
@Autowired private RuleDataInfoService ruleDataInfoService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -51,7 +49,7 @@ public class RuleDataServiceImpl
|
||||||
List<RuleData> ruleDataList = this.list(queryWrapper);
|
List<RuleData> ruleDataList = this.list(queryWrapper);
|
||||||
return ruleDataList.stream()
|
return ruleDataList.stream()
|
||||||
.map(ruleData -> RuleDataResp.ruleDataBuild(ruleData,() ->
|
.map(ruleData -> RuleDataResp.ruleDataBuild(ruleData,() ->
|
||||||
ruleDataInfoService.selectRuleDataAndLimit(ruleData.getId(),5)
|
ruleDataInfoService.selectRuleDataAndLimit(ruleData.getRuleId(),5)
|
||||||
.stream()
|
.stream()
|
||||||
.toList()
|
.toList()
|
||||||
))
|
))
|
||||||
|
@ -59,19 +57,19 @@ public class RuleDataServiceImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable(Long id) {
|
public void disable(Long ruleId) {
|
||||||
this.settingStatus(id, SystemYesNo.NO.getCode());
|
this.settingStatus(ruleId, SystemYesNo.NO.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enable(Long id) {
|
public void enable(Long ruleId) {
|
||||||
this.settingStatus(id, SystemYesNo.YES.getCode());
|
this.settingStatus(ruleId, SystemYesNo.YES.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void settingStatus(Long id, String status) {
|
public void settingStatus(Long ruleId, String status) {
|
||||||
LambdaQueryWrapper<RuleData> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RuleData> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(RuleData::getId,id);
|
queryWrapper.eq(RuleData::getRuleId,ruleId);
|
||||||
boolean isExists = this.exists(queryWrapper);
|
boolean isExists = this.exists(queryWrapper);
|
||||||
if (!isExists) {
|
if (!isExists) {
|
||||||
throw new ServiceException("操作规则不存在");
|
throw new ServiceException("操作规则不存在");
|
||||||
|
@ -80,7 +78,7 @@ public class RuleDataServiceImpl
|
||||||
throw new ServiceException("设置状态值违法");
|
throw new ServiceException("设置状态值违法");
|
||||||
}
|
}
|
||||||
LambdaUpdateWrapper<RuleData> updateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<RuleData> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
updateWrapper.eq(RuleData::getId,id);
|
updateWrapper.eq(RuleData::getRuleId,ruleId);
|
||||||
updateWrapper.set(RuleData::getRuleStatus,status);
|
updateWrapper.set(RuleData::getRuleStatus,status);
|
||||||
this.update(updateWrapper);
|
this.update(updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Spring Boot Version: ${spring-boot.version}
|
||||||
|
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,56 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9709
|
||||||
|
|
||||||
|
# nacos线上地址
|
||||||
|
nacos:
|
||||||
|
addr: 21.12.0.8:8848
|
||||||
|
user-name: nacos
|
||||||
|
password: nacos
|
||||||
|
namespace: ec66ecf1-f28e-43bc-aa86-625f1bc53bf8
|
||||||
|
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: cloud-rule
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: ${nacos.addr}
|
||||||
|
# nacos用户名
|
||||||
|
username: ${nacos.user-name}
|
||||||
|
# nacos密码
|
||||||
|
password: ${nacos.password}
|
||||||
|
# 命名空间
|
||||||
|
namespace: ${nacos.namespace}
|
||||||
|
config:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: ${nacos.addr}
|
||||||
|
# nacos用户名
|
||||||
|
username: ${nacos.user-name}
|
||||||
|
# nacos密码
|
||||||
|
password: ${nacos.password}
|
||||||
|
# 命名空间
|
||||||
|
namespace: ${nacos.namespace}
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
# 系统共享配置
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
# 系统环境Config共享配置
|
||||||
|
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
# xxl-job 配置文件
|
||||||
|
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
# rabbitMQ 配置文件
|
||||||
|
- application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
com.muyu.system.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/cloud-integration"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<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>
|
|
@ -0,0 +1,81 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/cloud-integration"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.sky.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>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||||
|
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||||
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||||
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||||
|
<Pattern>${log.sky.pattern}</Pattern>
|
||||||
|
</layout>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.muyu" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="GRPC_LOG"/>
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,81 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/cloud-integration"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.sky.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>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||||
|
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||||
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||||
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||||
|
<Pattern>${log.sky.pattern}</Pattern>
|
||||||
|
</layout>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.muyu" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="GRPC_LOG"/>
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
Loading…
Reference in New Issue