master
zhang chengzhi 2024-08-28 00:31:15 +08:00
parent 19fec6c66b
commit d4848acd71
13 changed files with 188 additions and 15 deletions

View File

@ -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>

View File

@ -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);

View File

@ -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){
}

View 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
* @Packagecom.muyu.rule.server.controller
* @Projectcloud-etl-rule
* @nameDataSourceDisposeController
* @Date2024/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();
}
}

View File

@ -9,15 +9,12 @@ import com.muyu.rule.server.exception.ActionDiscard;
* @nameDataModelEngine
* @Date2024/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;
}

View File

@ -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
* @Packagecom.muyu.rule.server.engine.custom.child
* @Projectcloud-etl-rule
* @nameEngine_Reginx
* @Date2024/8/27 15:13
*/
public class Engine_Reginx extends DataModelEngine {
@Override
public void execution() {
Object value = getValue();
String string = Desensitization.mobilePhoneDesensitization((String) value);
}
}

View File

@ -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();
}
}
}

View File

@ -8,4 +8,5 @@ package com.muyu.rule.server.exception;
* @Date2024/8/26 22:08
*/
public class ActionDiscard extends RuntimeException {
}

View File

@ -25,4 +25,6 @@ public interface RuleEngineVersionService extends IService<RuleEngineVersion> {
void activate(Long id);
void disable(Long id);
String dataGenerate(String dataSource);
}

View File

@ -0,0 +1,31 @@
package com.muyu.rule.server.service;
/**
* @Author
* @Packagecom.muyu.rule.server.service
* @Projectcloud-etl-rule
* @nameSourceDisposeService
* @Date2024/8/27 21:51
*/
public interface SourceDisposeService {
/**
*
* @param dataSource
* @return
*/
String dataGenerate(String dataSource);
/**
*
* @param dataSource
* @return
*/
Boolean notEmpty(Object dataSource);
}

View File

@ -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;
}
/**
*

View File

@ -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
* @Packagecom.muyu.rule.server.service.impl
* @Projectcloud-etl-rule
* @nameSourceDisposeServiceImpl
* @Date2024/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;
}
}