fix bugs
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package org.springblade.test;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springblade.core.test.BladeBootTest;
|
||||
import org.springblade.core.test.BladeSpringExtension;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
import org.springblade.flow.engine.entity.FlowModel;
|
||||
import org.springblade.flow.engine.service.FlowEngineService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Blade单元测试
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@ExtendWith(BladeSpringExtension.class)
|
||||
@BladeBootTest(appName = "blade-runner", enableLoader = true)
|
||||
public class BladeTest {
|
||||
|
||||
@Autowired
|
||||
private FlowEngineService service;
|
||||
|
||||
//@Test
|
||||
public void contextLoads() {
|
||||
System.out.println("=====数据迁移启动=====");
|
||||
|
||||
// 获取 ACT_DE_MODEL 表需要转换的数据
|
||||
List<FlowModel> list = service.list();
|
||||
// 循环转换
|
||||
list.forEach(flowModel -> {
|
||||
if (StringUtil.isBlank(flowModel.getModelEditorXml())) {
|
||||
service.update(Wrappers.<FlowModel>lambdaUpdate()
|
||||
.set(FlowModel::getModelEditorXml, new String(service.getModelEditorXML(flowModel)))
|
||||
.ge(FlowModel::getId, flowModel.getId())
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
System.out.println("=====数据迁移完毕=====");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
|
||||
package org.springblade.test;
|
||||
|
||||
|
||||
import org.springblade.develop.constant.DevelopConstant;
|
||||
import org.springblade.develop.support.BladeCodeGenerator;
|
||||
|
||||
/**
|
||||
* 代码生成器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public class CodeGenerator {
|
||||
|
||||
/**
|
||||
* 代码生成的模块名
|
||||
*/
|
||||
public static String CODE_NAME = "自定义模块";
|
||||
/**
|
||||
* 代码所在服务名
|
||||
*/
|
||||
public static String SERVICE_NAME = "blade-desk";
|
||||
/**
|
||||
* 代码生成的包名
|
||||
*/
|
||||
public static String PACKAGE_NAME = "org.springblade.desk";
|
||||
/**
|
||||
* 前端代码生成风格
|
||||
*/
|
||||
public static String CODE_STYLE = DevelopConstant.SABER_NAME;
|
||||
/**
|
||||
* 前端代码生成地址
|
||||
*/
|
||||
public static String PACKAGE_WEB_DIR = "/Users/chill/Workspaces/product/Sword";
|
||||
/**
|
||||
* 需要去掉的表前缀
|
||||
*/
|
||||
public static String[] TABLE_PREFIX = {"blade_"};
|
||||
/**
|
||||
* 需要生成的表名(两者只能取其一)
|
||||
*/
|
||||
public static String[] INCLUDE_TABLES = {"blade_notice"};
|
||||
/**
|
||||
* 需要排除的表名(两者只能取其一)
|
||||
*/
|
||||
public static String[] EXCLUDE_TABLES = {};
|
||||
/**
|
||||
* 是否包含基础业务字段
|
||||
*/
|
||||
public static Boolean HAS_SUPER_ENTITY = Boolean.TRUE;
|
||||
/**
|
||||
* 基础业务字段
|
||||
*/
|
||||
public static String[] SUPER_ENTITY_COLUMNS = {"id", "create_time", "create_user", "create_dept", "update_time", "update_user", "status", "is_deleted"};
|
||||
|
||||
/**
|
||||
* RUN THIS
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
BladeCodeGenerator generator = new BladeCodeGenerator();
|
||||
generator.setCodeName(CODE_NAME);
|
||||
generator.setServiceName(SERVICE_NAME);
|
||||
generator.setCodeStyle(CODE_STYLE);
|
||||
generator.setPackageName(PACKAGE_NAME);
|
||||
generator.setPackageWebDir(PACKAGE_WEB_DIR);
|
||||
generator.setTablePrefix(TABLE_PREFIX);
|
||||
generator.setIncludeTables(INCLUDE_TABLES);
|
||||
generator.setExcludeTables(EXCLUDE_TABLES);
|
||||
generator.setHasSuperEntity(HAS_SUPER_ENTITY);
|
||||
generator.setSuperEntityColumns(SUPER_ENTITY_COLUMNS);
|
||||
generator.run();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.springblade.test;
|
||||
|
||||
import org.springblade.core.tool.utils.AesUtil;
|
||||
import org.springblade.core.tool.utils.DesUtil;
|
||||
import org.springblade.core.tool.utils.StringPool;
|
||||
|
||||
/**
|
||||
* Key生成器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public class CryptoKeyGenerator {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("=======================================================");
|
||||
System.out.println("====== blade.token.crypto-key 的值从中挑选一个便可 =======");
|
||||
System.out.println("=======================================================");
|
||||
for (int i = 0; i < 10; i++) {
|
||||
String cryptoKey = AesUtil.genAesKey();
|
||||
System.out.println("BladeX CryptoKey:[" + cryptoKey + "] ");
|
||||
}
|
||||
System.out.println("=======================================================");
|
||||
System.out.println(StringPool.EMPTY);
|
||||
System.out.println("=======================================================");
|
||||
System.out.println("===== blade.api.crypto.aes-key 的值从中挑选一个便可 ======");
|
||||
System.out.println("=======================================================");
|
||||
for (int i = 0; i < 10; i++) {
|
||||
String AesKey = AesUtil.genAesKey();
|
||||
System.out.println("BladeX AesKey:[" + AesKey + "] ");
|
||||
}
|
||||
System.out.println("=======================================================");
|
||||
System.out.println(StringPool.EMPTY);
|
||||
System.out.println("=======================================================");
|
||||
System.out.println("===== blade.api.crypto.des-key 的值从中挑选一个便可 ======");
|
||||
System.out.println("=======================================================");
|
||||
for (int i = 0; i < 10; i++) {
|
||||
String DesKey = DesUtil.genDesKey();
|
||||
System.out.println("BladeX DesKey:[" + DesKey + "] ");
|
||||
}
|
||||
System.out.println("=======================================================");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.springblade.test;
|
||||
|
||||
import org.springblade.core.tool.utils.RandomType;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
|
||||
/**
|
||||
* signKey生成器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public class SignKeyGenerator {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("=======================================================");
|
||||
System.out.println("====== blade.token.sign-key 的值从中挑选一个便可 =========");
|
||||
System.out.println("=======================================================");
|
||||
for (int i = 0; i < 10; i++) {
|
||||
String signKey = StringUtil.random(32, RandomType.ALL);
|
||||
System.out.println("BladeX SignKey:[" + signKey + "] ");
|
||||
}
|
||||
System.out.println("=======================================================");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.springblade.test.http;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springblade.core.http.CssQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class OsChina {
|
||||
|
||||
@CssQuery(value = "head > title", attr = "text")
|
||||
private String title;
|
||||
|
||||
@CssQuery(value = "#v_news .page .news", inner = true)
|
||||
private List<VNews> vNews;
|
||||
|
||||
@CssQuery(value = ".blog-container .blog-list div", inner = true)
|
||||
private List<VBlog> vBlogList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.springblade.test.http;
|
||||
|
||||
import org.springblade.core.http.HttpRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OsChinaTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 同步,异常返回 null
|
||||
OsChina oschina = HttpRequest.get("https://www.oschina.net")
|
||||
.execute()
|
||||
.onSuccess(responseSpec -> responseSpec.asDomValue(OsChina.class));
|
||||
if (oschina == null) {
|
||||
return;
|
||||
}
|
||||
System.out.println(oschina.getTitle());
|
||||
|
||||
System.out.println("热门新闻");
|
||||
|
||||
List<VNews> vNews = oschina.getVNews();
|
||||
for (VNews vNew : vNews) {
|
||||
System.out.println("title:\t" + vNew.getTitle());
|
||||
System.out.println("href:\t" + vNew.getHref());
|
||||
System.out.println("时间:\t" + vNew.getDate());
|
||||
}
|
||||
|
||||
System.out.println("热门博客");
|
||||
List<VBlog> vBlogList = oschina.getVBlogList();
|
||||
for (VBlog vBlog : vBlogList) {
|
||||
System.out.println("title:\t" + vBlog.getTitle());
|
||||
System.out.println("href:\t" + vBlog.getHref());
|
||||
System.out.println("阅读数:\t" + vBlog.getRead());
|
||||
System.out.println("评价数:\t" + vBlog.getPing());
|
||||
System.out.println("点赞数:\t" + vBlog.getZhan());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.springblade.test.http;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springblade.core.http.CssQuery;
|
||||
|
||||
/**
|
||||
* 热门博客
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class VBlog {
|
||||
|
||||
@CssQuery(value = "a", attr = "title")
|
||||
private String title;
|
||||
|
||||
@CssQuery(value = "a", attr = "href")
|
||||
private String href;
|
||||
|
||||
//1341阅/9评/4赞
|
||||
@CssQuery(value = "span", attr = "text", regex = "^\\d+")
|
||||
private Integer read;
|
||||
|
||||
@CssQuery(value = "span", attr = "text", regex = "(\\d*).*/(\\d*).*/(\\d*).*", regexGroup = 2)
|
||||
private Integer ping;
|
||||
|
||||
@CssQuery(value = "span", attr = "text", regex = "(\\d*).*/(\\d*).*/(\\d*).*", regexGroup = 3)
|
||||
private Integer zhan;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.springblade.test.http;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springblade.core.http.CssQuery;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
public class VNews {
|
||||
|
||||
@CssQuery(value = "a", attr = "title")
|
||||
private String title;
|
||||
|
||||
@CssQuery(value = "a", attr = "href")
|
||||
private String href;
|
||||
|
||||
@CssQuery(value = ".news-date", attr = "text")
|
||||
@DateTimeFormat(pattern = "MM/dd")
|
||||
private Date date;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
package org.springblade.test.launch;
|
||||
|
||||
import org.springblade.core.auto.service.AutoService;
|
||||
import org.springblade.core.launch.service.LauncherService;
|
||||
import org.springblade.core.launch.utils.PropsUtil;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* 启动参数拓展
|
||||
*
|
||||
* @author smallchil
|
||||
*/
|
||||
@AutoService(LauncherService.class)
|
||||
public class LauncherTestServiceImpl implements LauncherService {
|
||||
|
||||
@Override
|
||||
public void launcher(SpringApplicationBuilder builder, String appName, String profile, boolean isLocalDev) {
|
||||
Properties props = System.getProperties();
|
||||
PropsUtil.setProperty(props, "spring.datasource.dynamic.enabled", "false");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user