客户端接口编写
parent
7ed04a138a
commit
e1a15f095a
|
@ -30,7 +30,7 @@ import java.util.Map;
|
||||||
@ComponentScan
|
@ComponentScan
|
||||||
@Component
|
@Component
|
||||||
@Import(value = {RuleEngineClientRunner.class})
|
@Import(value = {RuleEngineClientRunner.class})
|
||||||
public class RuleEngineClientConfig {
|
public class EngineConfig {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RemoteVersionService remoteVersionService;
|
private RemoteVersionService remoteVersionService;
|
||||||
|
@ -78,4 +78,12 @@ public class RuleEngineClientConfig {
|
||||||
}
|
}
|
||||||
return Result.success("测试正常,无异常数据返回");
|
return Result.success("测试正常,无异常数据返回");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object getLocation() {
|
||||||
|
return "没有信息";
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getPack() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -14,7 +14,6 @@ import lombok.val;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,11 +35,6 @@ public class EngIneController extends BaseController {
|
||||||
return engIneService.getMaintenanceList(engineMaintenanceQueryReq);
|
return engIneService.getMaintenanceList(engineMaintenanceQueryReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
System.out.println("你好");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/delete/{id}")
|
@PostMapping("/delete/{id}")
|
||||||
public Integer remove(@PathVariable Long id) {
|
public Integer remove(@PathVariable Long id) {
|
||||||
return engIneService.deletes(id);
|
return engIneService.deletes(id);
|
||||||
|
|
|
@ -22,5 +22,11 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-core</artifactId>
|
<artifactId>cloud-common-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-etl-client</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
//package com.bwie.muyu;
|
||||||
|
//
|
||||||
|
//import com.bwie.muyu.base.EngineException;
|
||||||
|
//import com.muyu.config.EngineConfig;
|
||||||
|
//import lombok.Data;
|
||||||
|
//import lombok.extern.log4j.Log4j2;
|
||||||
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
|
//import java.util.HashMap;
|
||||||
|
//import java.util.Map;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * @Author:qdm
|
||||||
|
// * @Package:com.bwie.muyu
|
||||||
|
// * @Project:cloud-etl-engine
|
||||||
|
// * @name:EngIneTest
|
||||||
|
// * @Date:2024/8/30 9:27
|
||||||
|
// */
|
||||||
|
//@Component
|
||||||
|
//@Log4j2
|
||||||
|
//@Data
|
||||||
|
//public class EngIneTest {
|
||||||
|
//
|
||||||
|
// private static Object SouRceCodeCompiler;
|
||||||
|
//
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// EngineConfig engineConfig = new EngineConfig();
|
||||||
|
// //扫描源码进行注释
|
||||||
|
// SouRceCodeCompiler.javaCompilerPath(engineConfig.getLocation());
|
||||||
|
// Map<String, Class<?>> stringClassMap = JavaBinaryClassLoader.loadClassByLocation(engineConfig.getPack(), engineConfig, getLocation);
|
||||||
|
// stringClassMap.forEach((key, value) -> {
|
||||||
|
// EngineContainer.loadEngineInstance(key, value);
|
||||||
|
// }); jn
|
||||||
|
// HashMap<String, Object> params = new HashMap<>();
|
||||||
|
// params.put("idCard", "142021200212215977");
|
||||||
|
// EngineException.engineExe("Engine_2020_11_3_2347", params);
|
||||||
|
// System.out.println("Engine_2020_11_3_2347");
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.bwie.muyu.base;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:qdm
|
||||||
|
* @Package:com.bwie.muyu.base
|
||||||
|
* @Project:cloud-etl-engine
|
||||||
|
* @name:EngineContainer
|
||||||
|
* @Date:2024/8/30 11:32
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class EngineContainer {
|
||||||
|
|
||||||
|
public static Integer getSumEngine() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.bwie.muyu.base;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:qdm
|
||||||
|
* @Package:com.bwie.muyu.base
|
||||||
|
* @Project:cloud-etl-engine
|
||||||
|
* @name:EngineExcepion
|
||||||
|
* @Date:2024/8/30 10:50
|
||||||
|
*/
|
||||||
|
public class EngineException {
|
||||||
|
// public engineException(String message){
|
||||||
|
// super.(message);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public static void engineExe(String engine20201132347, HashMap<String, Object> params) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.bwie.muyu.base;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:qdm
|
||||||
|
* @Package:com.bwie.muyu.base
|
||||||
|
* @Project:cloud-etl-engine
|
||||||
|
* @name:EngineParam
|
||||||
|
* @Date:2024/8/30 10:46
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.PARAMETER)
|
||||||
|
public @interface EngineParam {
|
||||||
|
/**
|
||||||
|
* 输入字段名称
|
||||||
|
*/
|
||||||
|
public String name();
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.bwie.muyu.base;
|
||||||
|
|
||||||
|
import com.muyu.common.core.utils.SpringUtils;
|
||||||
|
import org.springframework.boot.autoconfigure.security.SecurityProperties;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:qdm
|
||||||
|
* @Package:com.bwie.muyu.base
|
||||||
|
* @Project:cloud-etl-engine
|
||||||
|
* @name:Engine_2020_11_3_2347
|
||||||
|
* @Date:2024/8/30 10:32
|
||||||
|
*/
|
||||||
|
public class Engine_2020_11_3_2347 {
|
||||||
|
public String execute(@EngineParam(name="idCard")String idCard){
|
||||||
|
String msg = "";
|
||||||
|
Integer year = Integer.valueOf(idCard.substring(6, 10));
|
||||||
|
Date date = new Date();
|
||||||
|
int thisYear = date.getYear() + 1900;
|
||||||
|
msg = "这个身份证的年龄是:"+ (thisYear - year);
|
||||||
|
Integer two = Integer.valueOf(idCard.substring(16, 17));
|
||||||
|
if (two % 2 == 0){
|
||||||
|
msg += ",这个身份证是男生";
|
||||||
|
}else {
|
||||||
|
msg += ",这个身份证是女生";
|
||||||
|
}
|
||||||
|
Integer sumEngine = EngineContainer.getSumEngine();
|
||||||
|
System.out.println("项目中规则引擎数量为:"+sumEngine);
|
||||||
|
User bean = SpringUtils.getBean(User.class);
|
||||||
|
System.out.println(bean.getName()+"--"+bean.getAge);
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.bwie.muyu.base;
|
||||||
|
|
||||||
|
import com.muyu.config.EngineConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:qdm
|
||||||
|
* @Package:com.bwie.muyu.base
|
||||||
|
* @Project:cloud-etl-engine
|
||||||
|
* @name:Test
|
||||||
|
* @Date:2024/8/30 11:16
|
||||||
|
*/
|
||||||
|
public class Test {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
EngineConfig engineConfig = new EngineConfig();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.bwie.muyu.base;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:qdm
|
||||||
|
* @Package:com.bwie.muyu.base
|
||||||
|
* @Project:cloud-etl-engine
|
||||||
|
* @name:User
|
||||||
|
* @Date:2024/8/30 11:33
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class User {
|
||||||
|
public String getAge;
|
||||||
|
private String name;
|
||||||
|
}
|
Loading…
Reference in New Issue