master
parent
835fcd1e72
commit
39f23b9a96
|
@ -22,6 +22,18 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-rule-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-rule-remote</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-rule-remote</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.muyu.client.basic;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.etl.domain.DataValue;
|
||||
import com.muyu.rule.common.domain.RuleEngineVersion;
|
||||
|
||||
public interface RuleConfig {
|
||||
public Result<RuleEngineVersion> findVersionById( Long id);
|
||||
|
||||
public Result testEngine(String className,DataValue dataValue);
|
||||
public Result testEngine(String className,DataValue[] dataValue);
|
||||
public Result DataSetEngine(String className, DataValue[][] dataValues);
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.muyu.client.basic.impl;
|
||||
|
||||
import com.muyu.client.basic.RuleConfig;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.etl.domain.DataValue;
|
||||
import com.muyu.rule.common.domain.RuleEngineVersion;
|
||||
import com.muyu.rule.remote.RuleFeign;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class RuleConfigImpl implements RuleConfig {
|
||||
|
||||
@Autowired
|
||||
private RuleFeign ruleFeign;
|
||||
|
||||
@Override
|
||||
public Result<RuleEngineVersion> findVersionById(Long id) {
|
||||
return ruleFeign.findVersionById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result testEngine(String className, DataValue dataValue) {
|
||||
return ruleFeign.testEngine(className, dataValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result testEngine(String className, DataValue[] dataValue) {
|
||||
return ruleFeign.testEngine(className, dataValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result DataSetEngine(String className, DataValue[][] dataValues) {
|
||||
return ruleFeign.DataSetEngine(className, dataValues);
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
com.muyu.client.basic.impl.RuleConfigImpl
|
|
@ -22,6 +22,12 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-rule-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-etl</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.muyu.rule.remote.Factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.etl.domain.DataValue;
|
||||
|
||||
import com.muyu.rule.common.domain.RuleEngineVersion;
|
||||
import com.muyu.rule.remote.RuleFeign;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Log4j2
|
||||
@Component
|
||||
public class RuleFactory implements FallbackFactory<RuleFeign> {
|
||||
|
||||
@Override
|
||||
public RuleFeign create(Throwable cause) {
|
||||
return new RuleFeign() {
|
||||
@Override
|
||||
public Result<RuleEngineVersion> findVersionById(Long id) {
|
||||
log.info(cause);
|
||||
return Result.error("网络开小差......");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result testEngine(String className, DataValue dataValue) {
|
||||
log.info(cause);
|
||||
return Result.error("网络开小差......");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result testEngine(String className, DataValue[] dataValue) {
|
||||
log.info(cause);
|
||||
return Result.error("网络开小差......");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result DataSetEngine(String className, DataValue[][] dataValues) {
|
||||
log.info(cause);
|
||||
return Result.error("网络开小差......");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.muyu.rule.remote;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
|
||||
import com.muyu.etl.domain.DataValue;
|
||||
import com.muyu.rule.common.domain.RuleEngineVersion;
|
||||
import com.muyu.rule.remote.Factory.RuleFactory;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@EnableFeignClients
|
||||
@FeignClient(value = "cloud-etl-rule",fallbackFactory= RuleFactory.class)
|
||||
public interface RuleFeign {
|
||||
@PostMapping("/version/findVersionById/{id}")
|
||||
public Result<RuleEngineVersion> findVersionById(@PathVariable("id") Long id);
|
||||
@PostMapping("/version/testEngine/{className}")
|
||||
public Result testEngine(@PathVariable("className") String className,@RequestBody DataValue dataValue);
|
||||
@PostMapping("/version/rowEngine/{className}")
|
||||
public Result testEngine(@PathVariable("className") String className,@RequestBody DataValue[] dataValue);
|
||||
@PostMapping("/version/DataSetEngine/{className}")
|
||||
public Result DataSetEngine(@PathVariable("className") String className,@RequestBody DataValue[][] dataValues);
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
com.muyu.rule.remote.RuleFeign
|
||||
com.muyu.rule.remote.Factory.RuleFactory
|
Loading…
Reference in New Issue