fase()引擎规则调整
parent
f0ef7133ea
commit
8ea31f9805
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-goods-test</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -4,6 +4,7 @@ import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
|
|
|
@ -16,6 +16,7 @@ public class ConfigCodeConstants {
|
||||||
* 配置文件名数组
|
* 配置文件名数组
|
||||||
*/
|
*/
|
||||||
public final static String[] CONFIG_FILE_NAME_ARRAY=new String[]{"TestClass.txt","TaskContextHolder.java","DataSetContextHolder.java","RecordContextHolder.java","DataModelContextHolder.java"};
|
public final static String[] CONFIG_FILE_NAME_ARRAY=new String[]{"TestClass.txt","TaskContextHolder.java","DataSetContextHolder.java","RecordContextHolder.java","DataModelContextHolder.java"};
|
||||||
|
public final static String[] CONFIG_FILE_NAME_CODE=new String[]{"ToCode.txt","TaskContextHolder.java","DataSetContextHolder.java","RecordContextHolder.java","DataModelContextHolder.java"};
|
||||||
/**
|
/**
|
||||||
* 配置文件类型数组
|
* 配置文件类型数组
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class ConfigController extends BaseController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 引擎测试
|
* 引擎测试
|
||||||
* @param id
|
* @param textData
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/testData")
|
@PostMapping("/testData")
|
||||||
|
@ -135,4 +135,9 @@ public class ConfigController extends BaseController
|
||||||
public Result<EngineConfigResp> getScopeInfo(@PathVariable Integer id) {
|
public Result<EngineConfigResp> getScopeInfo(@PathVariable Integer id) {
|
||||||
return success(configService.getScopeInfo(id));
|
return success(configService.getScopeInfo(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("queryConfigInfo/{ruleId}")
|
||||||
|
public Result<List<Config>> queryConfigInfo(@PathVariable Long ruleId){
|
||||||
|
return success(configService.queryConfigInfo(ruleId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,12 @@ package com.muyu.goods.controller;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.goods.domain.Cope;
|
import com.muyu.goods.domain.Cope;
|
||||||
import com.muyu.goods.service.CopeService;
|
import com.muyu.goods.service.CopeService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -22,4 +21,19 @@ public class CopeController extends BaseController {
|
||||||
public Result<List<Cope>> list() {
|
public Result<List<Cope>> list() {
|
||||||
return success(service.list());
|
return success(service.list());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/list2")
|
||||||
|
public Result<List<Cope>> list2() {
|
||||||
|
return success(service.list2());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("selType/{name}")
|
||||||
|
public Result<List<Cope>> selType(@PathVariable String name){
|
||||||
|
return success(service.selType(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("selObject")
|
||||||
|
public Result<List<Cope>> selObject(@RequestBody Cope cope){
|
||||||
|
return success(service.selObject(cope));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
package com.muyu.goods.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.goods.domain.Edition;
|
||||||
|
import com.muyu.goods.service.IEditionService;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则引擎版本Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-06
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/edition")
|
||||||
|
public class EditionController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IEditionService editionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询规则引擎版本列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("goods:edition:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<Edition>> list()
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<Edition> list = editionService.selectEditionList();
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取相应的规则引擎版本
|
||||||
|
* @param ruleId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/selectListRuleId/{ruleId}")
|
||||||
|
public Result<List<Edition>> selectListRuleId(@PathVariable Long ruleId){
|
||||||
|
return success(editionService.selectListRuleId(ruleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出规则引擎版本列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("goods:edition:export")
|
||||||
|
@Log(title = "规则引擎版本", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, Edition edition)
|
||||||
|
{
|
||||||
|
List<Edition> list = editionService.selectEditionList();
|
||||||
|
ExcelUtil<Edition> util = new ExcelUtil<Edition>(Edition.class);
|
||||||
|
util.exportExcel(response, list, "规则引擎版本数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取规则引擎版本详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("goods:edition:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(editionService.selectEditionById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增规则引擎版本
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("goods:edition:add")
|
||||||
|
@Log(title = "规则引擎版本", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public Result add(@RequestBody Edition edition)
|
||||||
|
{
|
||||||
|
return toAjax(editionService.insertEdition(edition));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改规则引擎版本
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("goods:edition:edit")
|
||||||
|
@Log(title = "规则引擎版本", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public Result edit(@RequestBody Edition edition)
|
||||||
|
{
|
||||||
|
return toAjax(editionService.updateEdition(edition));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除规则引擎版本
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("goods:edition:remove")
|
||||||
|
@Log(title = "规则引擎版本", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(editionService.deleteEditionByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -3,14 +3,7 @@ package com.muyu.goods.controller;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.muyu.common.log.annotation.Log;
|
import com.muyu.common.log.annotation.Log;
|
||||||
import com.muyu.common.log.enums.BusinessType;
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
@ -69,6 +62,11 @@ public class RuleEngineController extends BaseController
|
||||||
return success(ruleEngineService.selectRuleEngineByRuleId(ruleId));
|
return success(ruleEngineService.selectRuleEngineByRuleId(ruleId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("selectRuleEngineOne/{ruleId}")
|
||||||
|
public Result selectRuleEngineOne(@PathVariable Long ruleId){
|
||||||
|
return success(ruleEngineService.selectRuleEngineOne(ruleId));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增规则引擎
|
* 新增规则引擎
|
||||||
*/
|
*/
|
||||||
|
@ -111,4 +109,21 @@ public class RuleEngineController extends BaseController
|
||||||
public Result<String> description(@PathVariable Integer ruleId){
|
public Result<String> description(@PathVariable Integer ruleId){
|
||||||
return success(ruleEngineService.description(ruleId));
|
return success(ruleEngineService.description(ruleId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping("/updateRuleIsActivate")
|
||||||
|
public Result updateRuleIsActivate(@RequestBody RuleEngine ruleEngine){
|
||||||
|
ruleEngineService.updateRuleIsActivate(ruleEngine);
|
||||||
|
return success("改变激活状态");
|
||||||
|
}
|
||||||
|
@PutMapping("/updateRuleStatus")
|
||||||
|
public Result updateRuleStatus(@RequestBody RuleEngine ruleEngine){
|
||||||
|
ruleEngineService.updateRuleStatus(ruleEngine);
|
||||||
|
return success("改变规则状态");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/spliceNameToCode")
|
||||||
|
public Result spliceNameToCode(@RequestParam String name, @RequestParam String code,@RequestParam String level){
|
||||||
|
return ruleEngineService.spliceNameToCode(name,code,level);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.muyu.goods.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 com.muyu.goods.domain.resp.AnduserIndexResp;
|
||||||
|
import com.muyu.goods.domain.resp.AnduserQueryResp;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("engine_config")
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel(value = "Anduser", description = "测试项目")
|
||||||
|
public class Anduser extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
/**
|
||||||
|
*主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(name = "主键", value = "主键")
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
@TableId(value = "name")
|
||||||
|
@ApiModelProperty(name = "名称", value = "名称")
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 性别
|
||||||
|
*/
|
||||||
|
@TableId(value = "sex")
|
||||||
|
@ApiModelProperty(name = "性别", value = "性别")
|
||||||
|
private String sex;
|
||||||
|
/**
|
||||||
|
* 年龄
|
||||||
|
*/
|
||||||
|
@TableId(value = "age")
|
||||||
|
@ApiModelProperty(name = "年龄", value = "年龄")
|
||||||
|
private Integer age;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*/
|
||||||
|
public static Anduser query(AnduserQueryResp anduserQueryResp){
|
||||||
|
return Anduser.builder()
|
||||||
|
.name(anduserQueryResp.getName())
|
||||||
|
.sex(anduserQueryResp.getSex())
|
||||||
|
.age(anduserQueryResp.getAge())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
public static Anduser index(AnduserIndexResp anduserIndexResp){
|
||||||
|
return Anduser.builder()
|
||||||
|
.name(anduserIndexResp.getName())
|
||||||
|
.sex(anduserIndexResp.getSex())
|
||||||
|
.age(anduserIndexResp.getAge())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
}
|
|
@ -0,0 +1,150 @@
|
||||||
|
package com.muyu.goods.domain;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则引擎版本对象 edition
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-06
|
||||||
|
*/
|
||||||
|
public class Edition extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 规则序号 */
|
||||||
|
@Excel(name = "规则序号")
|
||||||
|
private Long ruleId;
|
||||||
|
|
||||||
|
/** 版本类 */
|
||||||
|
@Excel(name = "版本类")
|
||||||
|
private String versionClass;
|
||||||
|
|
||||||
|
/** 版本名称 */
|
||||||
|
@Excel(name = "版本名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 版本编码 */
|
||||||
|
@Excel(name = "版本编码")
|
||||||
|
private String versionCode;
|
||||||
|
|
||||||
|
/** 版本状态 */
|
||||||
|
@Excel(name = "是否发布")
|
||||||
|
private Integer editionStatus;
|
||||||
|
|
||||||
|
/** 引擎状态 */
|
||||||
|
@Excel(name = "是否激活")
|
||||||
|
private String ruleStatus;
|
||||||
|
|
||||||
|
@Excel(name = "是否测试")
|
||||||
|
private Integer ruleIsTest;
|
||||||
|
|
||||||
|
/** 内容 */
|
||||||
|
@Excel(name = "内容描述")
|
||||||
|
private String editionContent;
|
||||||
|
|
||||||
|
@Excel(name = "规则内容")
|
||||||
|
private String ruleContent;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getRuleId() {
|
||||||
|
return ruleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRuleId(Long ruleId) {
|
||||||
|
this.ruleId = ruleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersionClass() {
|
||||||
|
return versionClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersionClass(String versionClass) {
|
||||||
|
this.versionClass = versionClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersionCode() {
|
||||||
|
return versionCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersionCode(String versionCode) {
|
||||||
|
this.versionCode = versionCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getEditionStatus() {
|
||||||
|
return editionStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEditionStatus(Integer editionStatus) {
|
||||||
|
this.editionStatus = editionStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRuleStatus() {
|
||||||
|
return ruleStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRuleStatus(String ruleStatus) {
|
||||||
|
this.ruleStatus = ruleStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getRuleIsTest() {
|
||||||
|
return ruleIsTest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRuleIsTest(Integer ruleIsTest) {
|
||||||
|
this.ruleIsTest = ruleIsTest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEditionContent() {
|
||||||
|
return editionContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEditionContent(String editionContent) {
|
||||||
|
this.editionContent = editionContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRuleContent() {
|
||||||
|
return ruleContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRuleContent(String ruleContent) {
|
||||||
|
this.ruleContent = ruleContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("ruleId", getRuleId())
|
||||||
|
.append("versionClass", getVersionClass())
|
||||||
|
.append("name", getName())
|
||||||
|
.append("versionCode", getVersionCode())
|
||||||
|
.append("editionStatus", getEditionStatus())
|
||||||
|
.append("ruleStatus", getRuleStatus())
|
||||||
|
.append("ruleIsTest",getRuleIsTest())
|
||||||
|
.append("ruleContent",getRuleContent())
|
||||||
|
.append("editionContent", getEditionContent())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.muyu.goods.domain.req;
|
||||||
|
|
||||||
|
public class SpliceRep {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.muyu.goods.domain.resp;
|
||||||
|
|
||||||
|
import com.muyu.goods.domain.Anduser;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "AnduserIndexResp", description = "测试添加")
|
||||||
|
public class AnduserIndexResp {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "名称", value = "名称")
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 性别
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "性别", value = "性别")
|
||||||
|
private String sex;
|
||||||
|
/**
|
||||||
|
* 年龄
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "年龄", value = "年龄")
|
||||||
|
private Integer age;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.muyu.goods.domain.resp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "AnduserQueryResp", description = "测试查询")
|
||||||
|
public class AnduserQueryResp extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "名称", value = "名称")
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 性别
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "性别", value = "性别")
|
||||||
|
private String sex;
|
||||||
|
/**
|
||||||
|
* 年龄
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "年龄", value = "年龄")
|
||||||
|
private Integer age;
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.muyu.goods.domain.resp;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "AnduserQueryResp", description = "测试查询")
|
||||||
|
public class AnduserUpdateResp {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "主键", value = "主键")
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "名称", value = "名称")
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 性别
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "性别", value = "性别")
|
||||||
|
private String sex;
|
||||||
|
/**
|
||||||
|
* 年龄
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "年龄", value = "年龄")
|
||||||
|
private Integer age;
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.muyu.goods.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.goods.domain.Edition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则引擎版本Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-06
|
||||||
|
*/
|
||||||
|
public interface EditionMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询规则引擎版本
|
||||||
|
*
|
||||||
|
* @param id 规则引擎版本主键
|
||||||
|
* @return 规则引擎版本
|
||||||
|
*/
|
||||||
|
public Edition selectEditionById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询规则引擎版本列表
|
||||||
|
*
|
||||||
|
* @return 规则引擎版本集合
|
||||||
|
*/
|
||||||
|
public List<Edition> selectEditionList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增规则引擎版本
|
||||||
|
*
|
||||||
|
* @param edition 规则引擎版本
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertEdition(Edition edition);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改规则引擎版本
|
||||||
|
*
|
||||||
|
* @param edition 规则引擎版本
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateEdition(Edition edition);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除规则引擎版本
|
||||||
|
*
|
||||||
|
* @param id 规则引擎版本主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEditionById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除规则引擎版本
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEditionByIds(Long[] ids);
|
||||||
|
}
|
|
@ -61,4 +61,8 @@ public interface RuleEngineMapper
|
||||||
public int deleteRuleEngineByRuleIds(Long[] ruleIds);
|
public int deleteRuleEngineByRuleIds(Long[] ruleIds);
|
||||||
|
|
||||||
String description(@Param("ruleId") Integer ruleId);
|
String description(@Param("ruleId") Integer ruleId);
|
||||||
|
|
||||||
|
void updateRuleIsActivate(@Param("ruleId") Long ruleId, @Param("ruleIsActivate") String ruleIsActivate);
|
||||||
|
|
||||||
|
void updateRuleStatus(@Param("ruleId") Long ruleId, @Param("ruleStatus") String ruleStatus);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
let packageName = "com.muyu.rule.goods";
|
||||||
|
let customName = "custom";
|
||||||
|
let templateName = "template";
|
||||||
|
let ruleContent = `package ${packageName}.${customName};
|
||||||
|
|
||||||
|
import com.muyu.engine.action.ActionDiscard;
|
||||||
|
import com.muyu.engine.scope.parentClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: DongZeLiang
|
||||||
|
* @date: 2024/5/6
|
||||||
|
* @Description: this.form.name-this.form.versionCode
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class this.form.versionCode extends parentClass {
|
||||||
|
@Override
|
||||||
|
public void execution () {
|
||||||
|
Object value = getValue();
|
||||||
|
|
||||||
|
if (value == null || "".equals(value) || "null".equals(value)) {
|
||||||
|
throw new ActionDiscard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}`;
|
|
@ -6,4 +6,10 @@ import java.util.List;
|
||||||
|
|
||||||
public interface CopeService {
|
public interface CopeService {
|
||||||
List<Cope> list();
|
List<Cope> list();
|
||||||
|
|
||||||
|
List<Cope> list2();
|
||||||
|
|
||||||
|
List<Cope> selType(String name);
|
||||||
|
|
||||||
|
List<Cope> selObject(Cope cope);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,4 +76,6 @@ public interface IConfigService
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
EngineConfigResp getScopeInfo(Integer id);
|
EngineConfigResp getScopeInfo(Integer id);
|
||||||
|
|
||||||
|
List<Config> queryConfigInfo(Long ruleId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.muyu.goods.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.goods.domain.Edition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则引擎版本Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-06
|
||||||
|
*/
|
||||||
|
public interface IEditionService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询规则引擎版本
|
||||||
|
*
|
||||||
|
* @param id 规则引擎版本主键
|
||||||
|
* @return 规则引擎版本
|
||||||
|
*/
|
||||||
|
public Edition selectEditionById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取相应的规则引擎版本
|
||||||
|
*
|
||||||
|
* @param ruleId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Edition> selectListRuleId(Long ruleId);
|
||||||
|
/**
|
||||||
|
* 查询规则引擎版本列表
|
||||||
|
*
|
||||||
|
* @return 规则引擎版本集合
|
||||||
|
*/
|
||||||
|
public List<Edition> selectEditionList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增规则引擎版本
|
||||||
|
*
|
||||||
|
* @param edition 规则引擎版本
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertEdition(Edition edition);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改规则引擎版本
|
||||||
|
*
|
||||||
|
* @param edition 规则引擎版本
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateEdition(Edition edition);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除规则引擎版本
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的规则引擎版本主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEditionByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除规则引擎版本信息
|
||||||
|
*
|
||||||
|
* @param id 规则引擎版本主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEditionById(Long id);
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
package com.muyu.goods.service;
|
package com.muyu.goods.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.goods.domain.RuleEngine;
|
import com.muyu.goods.domain.RuleEngine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,6 +21,12 @@ public interface IRuleEngineService
|
||||||
*/
|
*/
|
||||||
public RuleEngine selectRuleEngineByRuleId(Long ruleId);
|
public RuleEngine selectRuleEngineByRuleId(Long ruleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则详情
|
||||||
|
* @param ruleId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
RuleEngine selectRuleEngineOne(Long ruleId);
|
||||||
/**
|
/**
|
||||||
* 查询规则引擎列表
|
* 查询规则引擎列表
|
||||||
*
|
*
|
||||||
|
@ -60,4 +68,10 @@ public interface IRuleEngineService
|
||||||
public int deleteRuleEngineByRuleId(Long ruleId);
|
public int deleteRuleEngineByRuleId(Long ruleId);
|
||||||
|
|
||||||
String description(Integer ruleId);
|
String description(Integer ruleId);
|
||||||
|
|
||||||
|
void updateRuleIsActivate(RuleEngine ruleEngine);
|
||||||
|
|
||||||
|
void updateRuleStatus(RuleEngine ruleEngine);
|
||||||
|
|
||||||
|
Result spliceNameToCode(String name, String code, String level);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.muyu.common.core.exception.ServiceException;
|
import com.muyu.common.core.exception.ServiceException;
|
||||||
import com.muyu.goods.constant.ConfigCodeConstants;
|
import com.muyu.goods.constant.ConfigCodeConstants;
|
||||||
|
@ -164,12 +165,9 @@ public class ConfigServiceImpl implements IConfigService
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String ruleTest(List list) {
|
@Override
|
||||||
for (Object o : list) {
|
public List<Config> queryConfigInfo(Long ruleId) {
|
||||||
if (o.toString().contains("@163")){
|
return selectConfigList(null).stream().filter(c -> c.getRuleId().equals(ruleId)).collect(Collectors.toList())
|
||||||
list.remove(o);
|
;
|
||||||
}
|
|
||||||
}
|
|
||||||
return list.toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,15 @@ package com.muyu.goods.service.impl;
|
||||||
import com.muyu.goods.domain.Cope;
|
import com.muyu.goods.domain.Cope;
|
||||||
import com.muyu.goods.mapper.CopeMapper;
|
import com.muyu.goods.mapper.CopeMapper;
|
||||||
import com.muyu.goods.service.CopeService;
|
import com.muyu.goods.service.CopeService;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class CopeServiceImpl implements CopeService {
|
public class CopeServiceImpl implements CopeService {
|
||||||
|
@ -17,4 +22,42 @@ public class CopeServiceImpl implements CopeService {
|
||||||
public List<Cope> list() {
|
public List<Cope> list() {
|
||||||
return mapper.list();
|
return mapper.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Cope> list2() {
|
||||||
|
return list().stream().collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Cope> selType(String name) {
|
||||||
|
Stream<Cope> copeStream = list().stream().filter(c -> c.getType().equals(name));
|
||||||
|
return copeStream.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Cope> selObject(Cope cope) {
|
||||||
|
System.out.println(cope);
|
||||||
|
List<Cope> collect = new ArrayList<>();
|
||||||
|
List<Cope> collect1 = new ArrayList<>();
|
||||||
|
if (cope.getType()!=null && cope.getType()!=""){
|
||||||
|
collect = list().stream().filter(c -> c.getType().equals(cope.getType())).collect(Collectors.toList());
|
||||||
|
}else {
|
||||||
|
collect = list();
|
||||||
|
}
|
||||||
|
if (cope.getVal()!=null && cope.getVal()!=""){
|
||||||
|
collect1 = list().stream().filter(c -> c.getVal().contains(cope.getVal())).collect(Collectors.toList());
|
||||||
|
}else {
|
||||||
|
collect1 = list();
|
||||||
|
}
|
||||||
|
List<Cope> copes = new ArrayList<>();
|
||||||
|
for (Cope cope1 : collect) {
|
||||||
|
for (Cope cope2 : collect1) {
|
||||||
|
if (cope1.equals(cope2)){
|
||||||
|
copes.add(cope1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println(copes);
|
||||||
|
return copes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
package com.muyu.goods.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.goods.mapper.EditionMapper;
|
||||||
|
import com.muyu.goods.domain.Edition;
|
||||||
|
import com.muyu.goods.service.IEditionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则引擎版本Service业务层处理
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class EditionServiceImpl implements IEditionService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private EditionMapper editionMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询规则引擎版本
|
||||||
|
*
|
||||||
|
* @param id 规则引擎版本主键
|
||||||
|
* @return 规则引擎版本
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Edition selectEditionById(Long id)
|
||||||
|
{
|
||||||
|
return editionMapper.selectEditionById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取相应的规则引擎版本
|
||||||
|
*
|
||||||
|
* @param ruleId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Edition> selectListRuleId(Long ruleId) {
|
||||||
|
return selectEditionList().stream().filter(c -> c.getRuleId().equals(ruleId)).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询规则引擎版本列表
|
||||||
|
*
|
||||||
|
* @return 规则引擎版本
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Edition> selectEditionList()
|
||||||
|
{
|
||||||
|
return editionMapper.selectEditionList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增规则引擎版本
|
||||||
|
*
|
||||||
|
* @param edition 规则引擎版本
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertEdition(Edition edition)
|
||||||
|
{
|
||||||
|
return editionMapper.insertEdition(edition);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改规则引擎版本
|
||||||
|
*
|
||||||
|
* @param edition 规则引擎版本
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateEdition(Edition edition)
|
||||||
|
{
|
||||||
|
return editionMapper.updateEdition(edition);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除规则引擎版本
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的规则引擎版本主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEditionByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return editionMapper.deleteEditionByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除规则引擎版本信息
|
||||||
|
*
|
||||||
|
* @param id 规则引擎版本主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEditionById(Long id)
|
||||||
|
{
|
||||||
|
return editionMapper.deleteEditionById(id);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,15 @@
|
||||||
package com.muyu.goods.service.impl;
|
package com.muyu.goods.service.impl;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.goods.constant.ConfigCodeConstants;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.muyu.goods.mapper.RuleEngineMapper;
|
import com.muyu.goods.mapper.RuleEngineMapper;
|
||||||
|
@ -31,6 +40,18 @@ public class RuleEngineServiceImpl implements IRuleEngineService
|
||||||
return ruleEngineMapper.selectRuleEngineByRuleId(ruleId);
|
return ruleEngineMapper.selectRuleEngineByRuleId(ruleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则引擎详情
|
||||||
|
* @param ruleId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public RuleEngine selectRuleEngineOne(Long ruleId) {
|
||||||
|
List<RuleEngine> ruleEngines = selectRuleEngineList(null);
|
||||||
|
List<RuleEngine> collect = ruleEngines.stream().filter(c -> c.getRuleId().equals(ruleId)).collect(Collectors.toList());
|
||||||
|
return collect.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询规则引擎列表
|
* 查询规则引擎列表
|
||||||
*
|
*
|
||||||
|
@ -95,4 +116,43 @@ public class RuleEngineServiceImpl implements IRuleEngineService
|
||||||
public String description(Integer ruleId) {
|
public String description(Integer ruleId) {
|
||||||
return ruleEngineMapper.description(ruleId);
|
return ruleEngineMapper.description(ruleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateRuleIsActivate(RuleEngine ruleEngine) {
|
||||||
|
if (ruleEngine.getRuleIsActivate().equals("Y")){
|
||||||
|
ruleEngine.setRuleIsActivate("N");
|
||||||
|
}else{
|
||||||
|
ruleEngine.setRuleIsActivate("Y");
|
||||||
|
}
|
||||||
|
ruleEngineMapper.updateRuleIsActivate(ruleEngine.getRuleId(),ruleEngine.getRuleIsActivate());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateRuleStatus(RuleEngine ruleEngine) {
|
||||||
|
if (ruleEngine.getRuleStatus().equals("Y")){
|
||||||
|
ruleEngine.setRuleStatus("N");
|
||||||
|
}else{
|
||||||
|
ruleEngine.setRuleStatus("Y");
|
||||||
|
}
|
||||||
|
ruleEngineMapper.updateRuleStatus(ruleEngine.getRuleId(),ruleEngine.getRuleStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result spliceNameToCode(String name, String code, String level) {
|
||||||
|
String val = name + "_" + code;
|
||||||
|
String scope = ConfigCodeConstants.CONFIG_FILE_NAME_CODE[0];
|
||||||
|
String path = ConfigCodeConstants.BASE_FILE_PATH+scope;
|
||||||
|
String cod = null;
|
||||||
|
try {
|
||||||
|
cod = Files.readString(Paths.get(path));
|
||||||
|
String s1 = Pattern.compile("this.form.name").matcher(cod).replaceAll(name);
|
||||||
|
String s2 = Pattern.compile("this.form.versionCode").matcher(s1).replaceAll(code);
|
||||||
|
String s3 = Pattern.compile("parentClass").matcher(s2).replaceAll(level);
|
||||||
|
|
||||||
|
System.out.println(cod);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return Result.success(val,cod);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class strasd {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
java.lang.String sss = "sabacdeaces";
|
||||||
|
Pattern es = Pattern.compile("es");
|
||||||
|
Matcher matcher = es.matcher(sss);
|
||||||
|
String s = matcher.replaceAll("a1");
|
||||||
|
System.out.println(s);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,11 @@
|
||||||
|
import com.muyu.goods.domain.Cope;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
@ -25,12 +28,73 @@ public class stream {
|
||||||
stringList.add("2596325@163.com");
|
stringList.add("2596325@163.com");
|
||||||
stringList.add("157492533@qq.com");
|
stringList.add("157492533@qq.com");
|
||||||
stringList.add("1547859633@qq.com");
|
stringList.add("1547859633@qq.com");
|
||||||
|
stringList.add("1547859633@qq.com");
|
||||||
//filter 筛选操作
|
//filter 筛选操作
|
||||||
// stringList.stream().filter(c -> c.contains("@163")).forEach(System.out::println);
|
stringList.stream().filter(c -> c.contains("@163")).forEach(System.out::println);
|
||||||
//map 映射 map(表::展示字段)
|
//map 映射 map(表::展示字段)
|
||||||
|
System.out.println("筛选操作");
|
||||||
stringList.stream().map(String::new).forEach(System.out::println);
|
stringList.stream().map(String::new).forEach(System.out::println);
|
||||||
//flatMap 将每个元素映射为一个Stream对象,并将所有的Stream对象的元素合并为一个steam对象
|
//flatMap 将每个元素映射为一个Stream对象,并将所有的Stream对象的元素合并为一个steam对象
|
||||||
|
System.out.println("将所有的Stream对象的元素合并为一个steam对象");
|
||||||
stringList.stream().flatMap(c -> Arrays.asList(c).stream()).forEach(System.out::println);
|
stringList.stream().flatMap(c -> Arrays.asList(c).stream()).forEach(System.out::println);
|
||||||
|
// distinct 去除重复元素
|
||||||
|
System.out.println("去除重复元素");
|
||||||
|
stringList.stream().distinct().forEach(System.out::println);
|
||||||
|
// sorted 对元素进行排序
|
||||||
|
System.out.println("排序");
|
||||||
|
stringList.stream().sorted((a,b) -> a.length() - b.length()).forEach(System.out::println);
|
||||||
|
// peek 对每个元素进行特定操作
|
||||||
|
System.out.println("对每个元素进行特定操作");
|
||||||
|
stringList.stream().peek(c -> System.out.println(c.length())).map(p -> p.length() % 2 == 0).forEach(System.out::println);
|
||||||
|
// limit 限制stream中的元素数量
|
||||||
|
System.out.println("限制stream中的元素数量");
|
||||||
|
stringList.stream().limit(1).forEach(System.out::println);
|
||||||
|
//结束
|
||||||
|
// forEach 对每个元素进行指定操作,无返回值
|
||||||
|
//toArray 将流中的元素转为数组
|
||||||
|
System.out.println("将流中的元素转为数组");
|
||||||
|
String[] array1 = stringList.stream().toArray(String[]::new);
|
||||||
|
for (String s : array1) {
|
||||||
|
System.out.println(s);
|
||||||
|
}
|
||||||
|
//reduce 将流中的元素按照指定的操作进行归约,返回一个值
|
||||||
|
// identity是初始值,accumulator是一个二次元操作符,通常用于与流中的元素进行聚合操作
|
||||||
|
System.out.println("归约");
|
||||||
|
Optional<Integer> reduce = list.stream().map(Integer::bitCount).reduce(Integer::compare);
|
||||||
|
System.out.println(reduce.get());
|
||||||
|
// collect 将流中的元素收集到一个集合中
|
||||||
|
System.out.println("将流中的元素收集到一个集合中");
|
||||||
|
Set<Integer> collect2 = list.stream().collect(Collectors.toSet());
|
||||||
|
for (Integer i : collect2) {
|
||||||
|
System.out.println(i);
|
||||||
|
}
|
||||||
|
//min 返回最小值 max返回最大值
|
||||||
|
//count 返回流中的个数
|
||||||
|
//allMatch 判断流中的所有元素是否满足给定的条件
|
||||||
|
//noneMatch 判断流中所有的元素是否不满足给定条件
|
||||||
|
//findFirst 返回流的第一个元素
|
||||||
|
System.out.println("返回流的第一个元素");
|
||||||
|
Optional<String> first = stringList.stream().findFirst();
|
||||||
|
System.out.println(first.stream().collect(Collectors.toSet()));
|
||||||
|
//findAny 返回流的任意一个元素
|
||||||
|
|
||||||
|
// peek 修改元素
|
||||||
|
List<Cope> copes = new ArrayList<>();
|
||||||
|
for (int i = 1; i <= 3; i++) {
|
||||||
|
Cope cope = new Cope();
|
||||||
|
cope.setCode("code"+i);
|
||||||
|
cope.setType("type"+i);
|
||||||
|
cope.setVal("val"+i);
|
||||||
|
copes.add(cope);
|
||||||
|
}
|
||||||
|
System.out.println(copes);
|
||||||
|
Stream<Cope> peek = copes.stream().peek(c -> {
|
||||||
|
if (c.getVal().contains("1")){
|
||||||
|
c.setVal("123");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
List<Cope> collect3 = peek.collect(Collectors.toList());
|
||||||
|
System.out.println(collect3);
|
||||||
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.muyu.goods.mapper.EditionMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.muyu.goods.domain.Edition" id="EditionResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="ruleId" column="rule_id" />
|
||||||
|
<result property="versionClass" column="version_class" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="versionCode" column="version_code" />
|
||||||
|
<result property="editionStatus" column="edition_status" />
|
||||||
|
<result property="ruleStatus" column="rule_status" />
|
||||||
|
<result property="ruleIsTest" column="rule_is_test" />
|
||||||
|
<result property="editionContent" column="edition_content" />
|
||||||
|
<result property="ruleContent" column="rule_content" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectEditionVo">
|
||||||
|
select id, rule_id, version_class, name, version_code, edition_status, rule_status, rule_is_test, edition_content, rule_content from edition
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectEditionList" parameterType="com.muyu.goods.domain.Edition" resultMap="EditionResult">
|
||||||
|
<include refid="selectEditionVo"/>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEditionById" parameterType="Long" resultMap="EditionResult">
|
||||||
|
<include refid="selectEditionVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertEdition" parameterType="com.muyu.goods.domain.Edition" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into edition
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="ruleId != null">rule_id,</if>
|
||||||
|
<if test="versionClass != null">version_class,</if>
|
||||||
|
<if test="name != null">name,</if>
|
||||||
|
<if test="versionCode != null">version_code,</if>
|
||||||
|
<if test="editionContent != null">edition_content,</if>
|
||||||
|
<if test="ruleContent != null">rule_content,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="ruleId != null">#{ruleId},</if>
|
||||||
|
<if test="versionClass != null">#{versionClass},</if>
|
||||||
|
<if test="name != null">#{name},</if>
|
||||||
|
<if test="versionCode != null">#{versionCode},</if>
|
||||||
|
<if test="editionContent != null">#{editionContent},</if>
|
||||||
|
<if test="ruleContent != null">#{ruleContent},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateEdition" parameterType="com.muyu.goods.domain.Edition">
|
||||||
|
update edition
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="ruleContent != null">rule_content = #{ruleContent},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteEditionById" parameterType="Long">
|
||||||
|
delete from edition where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteEditionByIds" parameterType="String">
|
||||||
|
delete from edition where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -78,6 +78,16 @@
|
||||||
</trim>
|
</trim>
|
||||||
where rule_id = #{ruleId}
|
where rule_id = #{ruleId}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateRuleIsActivate">
|
||||||
|
update rule_engine
|
||||||
|
set rule_is_activate = #{ruleIsActivate}
|
||||||
|
where rule_id = #{ruleId};
|
||||||
|
</update>
|
||||||
|
<update id="updateRuleStatus">
|
||||||
|
update rule_engine
|
||||||
|
set rule_status = #{ruleStatus}
|
||||||
|
where rule_id = #{ruleId};
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteRuleEngineByRuleId" parameterType="Long">
|
<delete id="deleteRuleEngineByRuleId" parameterType="Long">
|
||||||
delete from rule_engine where rule_id = #{ruleId}
|
delete from rule_engine where rule_id = #{ruleId}
|
||||||
|
|
1
pom.xml
1
pom.xml
|
@ -215,6 +215,7 @@
|
||||||
<module>muyu-visual</module>
|
<module>muyu-visual</module>
|
||||||
<module>muyu-modules</module>
|
<module>muyu-modules</module>
|
||||||
<module>muyu-common</module>
|
<module>muyu-common</module>
|
||||||
|
<module>muyu-modules/muyu-goods-test</module>
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue