11111
parent
19fec6c66b
commit
d4848acd71
|
@ -91,7 +91,12 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-nacos-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 热部署 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -35,6 +35,7 @@ public class EngineTest {
|
|||
params.put("idcard","142021200212215977");
|
||||
Object engineObject = EngineExecution.engineExe("Engine_2024_8_23_2347", params);
|
||||
|
||||
|
||||
System.out.println("====>"+engineObject);
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.rule.server.complie;
|
||||
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import com.muyu.rule.server.scan.JavaCodeScan;
|
||||
|
||||
import javax.tools.JavaCompiler;
|
||||
|
@ -74,6 +75,4 @@ public static void javaCampiler(File... file){
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package com.muyu.rule.server.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.rule.server.service.SourceDisposeService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.rule.server.controller
|
||||
* @Project:cloud-etl-rule
|
||||
* @name:DataSourceDisposeController
|
||||
* @Date:2024/8/27 20:54
|
||||
*/
|
||||
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/dispose")
|
||||
public class DataSourceDisposeController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private SourceDisposeService sourceDisposeService;
|
||||
|
||||
/**
|
||||
* 数据脱敏
|
||||
*/
|
||||
|
||||
@PostMapping("/dataGenerate/{dataSource}")
|
||||
public Result dataGenerate(@PathVariable("dataSource") String dataSource){
|
||||
|
||||
String string = sourceDisposeService.dataGenerate(dataSource);
|
||||
|
||||
return Result.success(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据非空
|
||||
*/
|
||||
|
||||
@PostMapping("/notEmpty/{dataSource}")
|
||||
public Result notEmpty(@PathVariable("dataSource") Object dataSource){
|
||||
|
||||
Boolean aBoolean = sourceDisposeService.notEmpty(dataSource);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Binary file not shown.
|
@ -9,15 +9,12 @@ import com.muyu.rule.server.exception.ActionDiscard;
|
|||
* @name:DataModelEngine
|
||||
* @Date:2024/8/26 22:00
|
||||
*/
|
||||
public class DataModelEngine {
|
||||
public abstract class DataModelEngine {
|
||||
|
||||
public abstract void execution();
|
||||
|
||||
|
||||
public void execution () {
|
||||
Object value = getValue();
|
||||
|
||||
if (value == null || "".equals(value) || "null".equals(value)) {
|
||||
throw new ActionDiscard();
|
||||
}
|
||||
}
|
||||
|
||||
public Object getValue(){
|
||||
|
||||
|
@ -25,9 +22,6 @@ public class DataModelEngine {
|
|||
Class<?> field;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package com.muyu.rule.server.engine.custom.child;
|
||||
|
||||
import com.muyu.rule.common.utils.Desensitization;
|
||||
import com.muyu.rule.server.engine.custom.DataModelEngine;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.rule.server.engine.custom.child
|
||||
* @Project:cloud-etl-rule
|
||||
* @name:Engine_Reginx
|
||||
* @Date:2024/8/27 15:13
|
||||
*/
|
||||
public class Engine_Reginx extends DataModelEngine {
|
||||
|
||||
|
||||
@Override
|
||||
public void execution() {
|
||||
Object value = getValue();
|
||||
|
||||
String string = Desensitization.mobilePhoneDesensitization((String) value);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.muyu.rule.server.engine.custom.child;
|
||||
|
||||
import com.muyu.rule.server.engine.custom.DataModelEngine;
|
||||
import com.muyu.rule.server.exception.ActionDiscard;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
|
@ -11,6 +11,12 @@ import com.muyu.rule.server.engine.custom.DataModelEngine;
|
|||
*/
|
||||
public class Engine_not_null extends DataModelEngine {
|
||||
|
||||
@Override
|
||||
public void execution() {
|
||||
Object value = getValue();
|
||||
|
||||
|
||||
if (value == null || "".equals(value) || "null".equals(value)) {
|
||||
throw new ActionDiscard();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,4 +8,5 @@ package com.muyu.rule.server.exception;
|
|||
* @Date:2024/8/26 22:08
|
||||
*/
|
||||
public class ActionDiscard extends RuntimeException {
|
||||
|
||||
}
|
||||
|
|
|
@ -25,4 +25,6 @@ public interface RuleEngineVersionService extends IService<RuleEngineVersion> {
|
|||
void activate(Long id);
|
||||
|
||||
void disable(Long id);
|
||||
|
||||
String dataGenerate(String dataSource);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.rule.server.service;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.rule.server.service
|
||||
* @Project:cloud-etl-rule
|
||||
* @name:SourceDisposeService
|
||||
* @Date:2024/8/27 21:51
|
||||
*/
|
||||
public interface SourceDisposeService {
|
||||
|
||||
|
||||
/**
|
||||
* 手机号脱敏
|
||||
* @param dataSource 手机号数据源
|
||||
* @return 脱敏后的手机号数据
|
||||
*/
|
||||
|
||||
|
||||
String dataGenerate(String dataSource);
|
||||
|
||||
|
||||
/**
|
||||
* 对数据进行非空判断
|
||||
* @param dataSource
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
Boolean notEmpty(Object dataSource);
|
||||
}
|
|
@ -49,6 +49,15 @@ public class RuleEngineServiceImpl extends ServiceImpl<RuleEngineVersionMapper,R
|
|||
this.updateOpen(id, SystemYesNo.NO.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String dataGenerate(String dataSource) {
|
||||
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改激活
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package com.muyu.rule.server.service.impl;
|
||||
|
||||
import com.muyu.rule.common.utils.Desensitization;
|
||||
import com.muyu.rule.server.exception.ActionDiscard;
|
||||
import com.muyu.rule.server.service.SourceDisposeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.rule.server.service.impl
|
||||
* @Project:cloud-etl-rule
|
||||
* @name:SourceDisposeServiceImpl
|
||||
* @Date:2024/8/27 21:52
|
||||
*/
|
||||
@Service
|
||||
public class SourceDisposeServiceImpl implements SourceDisposeService {
|
||||
|
||||
|
||||
@Override
|
||||
public String dataGenerate(String dataSource) {
|
||||
|
||||
String string = Desensitization.mobilePhoneDesensitization(dataSource);
|
||||
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean notEmpty(Object dataSource) {
|
||||
|
||||
|
||||
if (dataSource == null || "".equals(dataSource) || "null".equals(dataSource)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue