Commit adc12f7b authored by xiandafu's avatar xiandafu
Browse files

删除微服务和工作流,集中精力做核心功能

parent 1d83f41b
<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.ibeetl</groupId>
<artifactId>admin-cloud</artifactId>
<version>1.1.1</version>
</parent>
<artifactId>admin-cloud-eureka-server</artifactId>
<name>admin-cloud-eureka-server</name>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
server.port=8761
spring.application.name=eureka-service
#eureka-server
eureka.instance.hostname=localhost
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:${server.port}/eureka/
<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.ibeetl</groupId>
<artifactId>admin-cloud</artifactId>
<version>1.1.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>admin-cloud-eureka-server</artifactId>
<name>admin-cloud-eureka-server</name>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.ibeetl.cloud.eurekaserver;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
/**
* 服务注册中心
* @author yangkebiao
*
*/
@EnableEurekaServer
@SpringBootApplication
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
}
}
server.port=8761
spring.application.name=eureka-service
#eureka-server
eureka.instance.hostname=localhost
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:${server.port}/eureka/
<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.ibeetl</groupId>
<artifactId>admin</artifactId>
<version>1.1.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>admin-cloud</artifactId>
<packaging>pom</packaging>
<name>admin-cloud</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<maven.test.skip>true</maven.test.skip>
<skipTests>true</skipTests>
</properties>
<modules>
<module>admin-cloud-eureka-server</module>
</modules>
<!-- <build> -->
<!-- <plugins> -->
<!-- <plugin> -->
<!-- <groupId>org.springframework.boot</groupId> -->
<!-- <artifactId>spring-boot-maven-plugin</artifactId> -->
<!-- </plugin> -->
<!-- </plugins> -->
<!-- </build> -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Finchley.M9</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>
\ No newline at end of file
...@@ -5,20 +5,15 @@ ...@@ -5,20 +5,15 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<parent> <parent>
<groupId>com.ibeetl</groupId> <groupId>com.ibeetl</groupId>
<artifactId>admin-cloud</artifactId> <artifactId>admin</artifactId>
<version>1.1.3</version> <version>${plus.version}</version>
<relativePath>../admin-cloud/pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.ibeetl</groupId> <groupId>com.ibeetl</groupId>
<artifactId>admin-core</artifactId> <artifactId>admin-core</artifactId>
<version>1.1.3</version> <version>${plus.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency> </dependency>
<!-- 重新覆盖mysql的版本,原因:虽然admin-core更新过mysql版本,但由于parent是admin-cloud,导致更新的版本失效 --> <!-- 重新覆盖mysql的版本,原因:虽然admin-core更新过mysql版本,但由于parent是admin-cloud,导致更新的版本失效 -->
......
...@@ -5,9 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; ...@@ -5,9 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@EnableEurekaClient
@SpringBootApplication @SpringBootApplication
@EnableCaching @EnableCaching
public class CosonleApplication extends SpringBootServletInitializer { public class CosonleApplication extends SpringBootServletInitializer {
......
...@@ -8,13 +8,15 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver ...@@ -8,13 +8,15 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.password=starter2 #spring.datasource.password=starter2
#spring.datasource.driver-class-name=oracle.jdbc.OracleDriver #spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
beetlsql.ds.dataSource.basePackage=com
beetlsql.mutiple.datasource=dataSource
# 1,1 是管理员密码,相当于启动后就登录,方便测试,系统需要取消这俩个配置 # 1,1 是管理员密码,相当于启动后就登录,方便测试,系统需要取消这俩个配置
user.id=1 user.id=1
user.orgId=1 user.orgId=1
#打开审计功能,开发模式应该关闭 #打开审计功能,开发模式应该关闭
audit.enable=false audit.enable=false
#单机情况下使用hashmap存放回话,集群下可以参考springboot 使用redis
spring.session.store-type=HASH_MAP spring.session.store-type=HASH_MAP
#spring.cache.type= #spring.cache.type=
spring.cache.type=SIMPLE spring.cache.type=SIMPLE
......
...@@ -3,11 +3,16 @@ ...@@ -3,11 +3,16 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>admin-core</artifactId> <artifactId>admin-core</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<parent>
<groupId>com.ibeetl</groupId>
<artifactId>admin</artifactId>
<version>${plus.version}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<properties> <properties>
<maven.test.skip>true</maven.test.skip> <maven.test.skip>true</maven.test.skip>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
...@@ -40,7 +45,7 @@ ...@@ -40,7 +45,7 @@
<dependency> <dependency>
<groupId>com.ibeetl</groupId> <groupId>com.ibeetl</groupId>
<artifactId>beetl-framework-starter</artifactId> <artifactId>beetl-framework-starter</artifactId>
<version>1.1.47.RELEASE</version> <version>1.1.54.RELEASE</version>
</dependency> </dependency>
<dependency> <dependency>
...@@ -93,12 +98,7 @@ ...@@ -93,12 +98,7 @@
</dependencies> </dependencies>
<parent>
<groupId>com.ibeetl</groupId>
<artifactId>admin</artifactId>
<version>1.1.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project> </project>
...@@ -14,11 +14,13 @@ import com.ibeetl.admin.core.gen.model.Entity; ...@@ -14,11 +14,13 @@ import com.ibeetl.admin.core.gen.model.Entity;
public class JavaCodeGen implements AutoGen{ public class JavaCodeGen implements AutoGen{
String basePackage; String basePackage;
Entity entity; Entity entity;
String basicFunctionCode = null;
static String CR = System.getProperty("line.separator"); static String CR = System.getProperty("line.separator");
public JavaCodeGen(String basePackage,Entity entity) { public JavaCodeGen(String basePackage,Entity entity,String basicFunctionCode) {
this.basePackage =basePackage; this.basePackage =basePackage;
this.entity = entity; this.entity = entity;
this.basicFunctionCode =basicFunctionCode;
} }
@Override @Override
public void make(Target target, Entity entity) { public void make(Target target, Entity entity) {
...@@ -159,6 +161,7 @@ class JavaControllerGen implements AutoGen{ ...@@ -159,6 +161,7 @@ class JavaControllerGen implements AutoGen{
template.binding("target", target); template.binding("target", target);
template.binding("package", gen.basePackage+".web"); template.binding("package", gen.basePackage+".web");
template.binding("basePackage", gen.basePackage); template.binding("basePackage", gen.basePackage);
template.binding("basicfunctionCode",gen.basicFunctionCode);
String content = template.render(); String content = template.render();
target.flush(this, content); target.flush(this, content);
} }
......
...@@ -117,7 +117,9 @@ public class CorePlatformService { ...@@ -117,7 +117,9 @@ public class CorePlatformService {
public CoreUser getCurrentUser() { public CoreUser getCurrentUser() {
return (CoreUser) httpRequestLocal.getSessionValue(ACCESS_CURRENT_USER); checkSession();
CoreUser user = (CoreUser) httpRequestLocal.getSessionValue(ACCESS_CURRENT_USER);
return user;
} }
...@@ -132,12 +134,14 @@ public class CorePlatformService { ...@@ -132,12 +134,14 @@ public class CorePlatformService {
public Long getCurrentOrgId() { public Long getCurrentOrgId() {
checkSession();
CoreOrg org = (CoreOrg) httpRequestLocal.getSessionValue(ACCESS_CURRENT_ORG); CoreOrg org = (CoreOrg) httpRequestLocal.getSessionValue(ACCESS_CURRENT_ORG);
return org.getId(); return org.getId();
} }
public CoreOrg getCurrentOrg() { public CoreOrg getCurrentOrg() {
checkSession();
CoreOrg org = (CoreOrg) httpRequestLocal.getSessionValue(ACCESS_CURRENT_ORG); CoreOrg org = (CoreOrg) httpRequestLocal.getSessionValue(ACCESS_CURRENT_ORG);
return org; return org;
...@@ -148,6 +152,13 @@ public class CorePlatformService { ...@@ -148,6 +152,13 @@ public class CorePlatformService {
return orgs; return orgs;
} }
protected void checkSession() {
CoreOrg org = (CoreOrg) httpRequestLocal.getSessionValue(ACCESS_CURRENT_ORG);
if(org==null) {
throw new PlatformException("会话过期,重新登录");
}
}
public void setLoginUser(CoreUser user, CoreOrg currentOrg, List<CoreOrg> orgs) { public void setLoginUser(CoreUser user, CoreOrg currentOrg, List<CoreOrg> orgs) {
httpRequestLocal.setSessionValue(CorePlatformService.ACCESS_CURRENT_USER, user); httpRequestLocal.setSessionValue(CorePlatformService.ACCESS_CURRENT_USER, user);
......
...@@ -76,7 +76,7 @@ public class DataAccessFunction implements Function { ...@@ -76,7 +76,7 @@ public class DataAccessFunction implements Function {
List<CoreRoleFunction> roleFuns = platFormService.getRoleFunction(user.getId(),currentOrgId,functionCode); List<CoreRoleFunction> roleFuns = platFormService.getRoleFunction(user.getId(),currentOrgId,functionCode);
if(roleFuns.isEmpty()){ if(roleFuns.isEmpty()){
//如果没有配置数据权限,是1=1,因此为角色指定功能的时候,需要设定数据权限,否则查询到所有数据 //如果没有配置数据权限,是1=1,因此为角色指定功能的时候,需要设定数据权限,否则查询到所有数据
return "1=1 /*empty data access */ "; return "1=1 /* empty data access */ ";
} }
...@@ -105,7 +105,7 @@ public class DataAccessFunction implements Function { ...@@ -105,7 +105,7 @@ public class DataAccessFunction implements Function {
} }
case AllOrg:{ case AllOrg:{
//sql 不包含组织机构过滤信息 //sql 不包含组织机构过滤信息
continue ; sb.append(" 1=1 /* AllOrg */ ");
} }
case OnlyUser:{ case OnlyUser:{
List<Long> ids = ret.getUserIds(); List<Long> ids = ret.getUserIds();
......
...@@ -202,8 +202,9 @@ public class CoreCodeGenController { ...@@ -202,8 +202,9 @@ public class CoreCodeGenController {
HtmlGen htmlGen = new HtmlGen(); HtmlGen htmlGen = new HtmlGen();
htmlGen.make(target, entity); htmlGen.make(target, entity);
String preffix = urlBase.replace('/', '.');
JavaCodeGen javaGen = new JavaCodeGen(basePackage, entity); String basicFunctionCode = preffix+"."+entity.getCode();
JavaCodeGen javaGen = new JavaCodeGen(basePackage, entity,basicFunctionCode);
javaGen.make(target, entity); javaGen.make(target, entity);
MdGen mdGen = new MdGen(); MdGen mdGen = new MdGen();
...@@ -280,7 +281,10 @@ public class CoreCodeGenController { ...@@ -280,7 +281,10 @@ public class CoreCodeGenController {
String basePackage = data.getBasePackage(); String basePackage = data.getBasePackage();
WebTarget webTarget = new WebTarget(entity, basePackage); WebTarget webTarget = new WebTarget(entity, basePackage);
webTarget.setUrlBase(urlBase); webTarget.setUrlBase(urlBase);
JavaCodeGen javaGen = new JavaCodeGen(basePackage,entity);
String preffix = urlBase.replace('/', '.');
String basicFunctionCode = preffix+"."+entity.getCode();
JavaCodeGen javaGen = new JavaCodeGen(basePackage,entity,basicFunctionCode);
javaGen.make(webTarget, entity); javaGen.make(webTarget, entity);
Map<String, String> content = new HashMap<String, String>(); Map<String, String> content = new HashMap<String, String>();
for (Entry<Object, String> entry : webTarget.map.entrySet()) { for (Entry<Object, String> entry : webTarget.map.entrySet()) {
...@@ -352,13 +356,14 @@ public class CoreCodeGenController { ...@@ -352,13 +356,14 @@ public class CoreCodeGenController {
@GetMapping(MODEL + "/{table}/test.json") @GetMapping(MODEL + "/{table}/test.json")
@ResponseBody @ResponseBody
public void test(@PathVariable String table) { public void test(@PathVariable String table) {
String urlBase = "cms";
Entity entity = new Entity(); Entity entity = new Entity();
entity.setCode("blog"); entity.setCode("blog");
entity.setName("CmsBlog"); entity.setName("CmsBlog");
entity.setDisplayName("博客"); entity.setDisplayName("博客");
entity.setTableName("CMS_BLOG"); entity.setTableName("CMS_BLOG");
entity.setSystem("console"); entity.setSystem("console");
Attribute idAttr = new Attribute(); Attribute idAttr = new Attribute();
idAttr.setColName("id"); idAttr.setColName("id");
...@@ -423,8 +428,9 @@ public class CoreCodeGenController { ...@@ -423,8 +428,9 @@ public class CoreCodeGenController {
HtmlGen htmlGen = new HtmlGen(); HtmlGen htmlGen = new HtmlGen();
htmlGen.make(target, entity); htmlGen.make(target, entity);
String preffix = urlBase.replace('/', '.');
JavaCodeGen javaGen = new JavaCodeGen(basePackage, entity); String basicFunctionCode = preffix+"."+entity.getCode();
JavaCodeGen javaGen = new JavaCodeGen(basePackage, entity,basicFunctionCode);
javaGen.make(target, entity); javaGen.make(target, entity);
MdGen mdGen = new MdGen(); MdGen mdGen = new MdGen();
......
...@@ -65,7 +65,7 @@ public class ${entity.name}Controller{ ...@@ -65,7 +65,7 @@ public class ${entity.name}Controller{
/* 页面 */ /* 页面 */
\@GetMapping(MODEL + "/index.do") \@GetMapping(MODEL + "/index.do")
\@Function("${entity.code}.query") \@Function("${basicfunctionCode}.query")
\@ResponseBody \@ResponseBody
public ModelAndView index() { public ModelAndView index() {
ModelAndView view = new ModelAndView("/${target.urlBase}/${entity.code}/index.html") ; ModelAndView view = new ModelAndView("/${target.urlBase}/${entity.code}/index.html") ;
...@@ -74,7 +74,7 @@ public class ${entity.name}Controller{ ...@@ -74,7 +74,7 @@ public class ${entity.name}Controller{
} }
\@GetMapping(MODEL + "/edit.do") \@GetMapping(MODEL + "/edit.do")
\@Function("${entity.code}.edit") \@Function("${basicfunctionCode}.edit")
\@ResponseBody \@ResponseBody
public ModelAndView edit(${entity.idAttribute.javaType} ${entity.idAttribute.name}) { public ModelAndView edit(${entity.idAttribute.javaType} ${entity.idAttribute.name}) {
ModelAndView view = new ModelAndView("/${target.urlBase}/${entity.code}/edit.html"); ModelAndView view = new ModelAndView("/${target.urlBase}/${entity.code}/edit.html");
...@@ -84,7 +84,7 @@ public class ${entity.name}Controller{ ...@@ -84,7 +84,7 @@ public class ${entity.name}Controller{
} }
\@GetMapping(MODEL + "/add.do") \@GetMapping(MODEL + "/add.do")
\@Function("${entity.code}.add") \@Function("${basicfunctionCode}.add")
\@ResponseBody \@ResponseBody
public ModelAndView add() { public ModelAndView add() {
ModelAndView view = new ModelAndView("/${target.urlBase}/${entity.code}/add.html"); ModelAndView view = new ModelAndView("/${target.urlBase}/${entity.code}/add.html");
...@@ -94,7 +94,7 @@ public class ${entity.name}Controller{ ...@@ -94,7 +94,7 @@ public class ${entity.name}Controller{
/* ajax json */ /* ajax json */
\@PostMapping(MODEL + "/list.json") \@PostMapping(MODEL + "/list.json")
\@Function("${entity.code}.query") \@Function("${basicfunctionCode}.query")
\@ResponseBody \@ResponseBody
public JsonResult<PageQuery> list(${entity.name}Query condtion) public JsonResult<PageQuery> list(${entity.name}Query condtion)
{ {
...@@ -104,7 +104,7 @@ public class ${entity.name}Controller{ ...@@ -104,7 +104,7 @@ public class ${entity.name}Controller{
} }
\@PostMapping(MODEL + "/add.json") \@PostMapping(MODEL + "/add.json")
\@Function("${entity.code}.add") \@Function("${basicfunctionCode}.add")
\@ResponseBody \@ResponseBody
public JsonResult add(\@Validated(ValidateConfig.ADD.class)${entity.name} ${entity.code}) public JsonResult add(\@Validated(ValidateConfig.ADD.class)${entity.name} ${entity.code})
{ {
...@@ -113,7 +113,7 @@ public class ${entity.name}Controller{ ...@@ -113,7 +113,7 @@ public class ${entity.name}Controller{
} }
\@PostMapping(MODEL + "/update.json") \@PostMapping(MODEL + "/update.json")
\@Function("${entity.code}.update") \@Function("${basicfunctionCode}.update")
\@ResponseBody \@ResponseBody
public JsonResult<String> update(\@Validated(ValidateConfig.UPDATE.class) ${entity.name} ${entity.code}) { public JsonResult<String> update(\@Validated(ValidateConfig.UPDATE.class) ${entity.name} ${entity.code}) {
boolean success = ${service}.update(${entity.code}); boolean success = ${service}.update(${entity.code});
...@@ -127,7 +127,7 @@ public class ${entity.name}Controller{ ...@@ -127,7 +127,7 @@ public class ${entity.name}Controller{
\@GetMapping(MODEL + "/view.json") \@GetMapping(MODEL + "/view.json")
\@Function("${entity.code}.query") \@Function("${basicfunctionCode}.query")
\@ResponseBody \@ResponseBody
public JsonResult<${entity.name}>queryInfo(${entity.idAttribute.javaType} ${entity.idAttribute.name}) { public JsonResult<${entity.name}>queryInfo(${entity.idAttribute.javaType} ${entity.idAttribute.name}) {
${entity.name} ${entity.code} = ${service}.queryById( ${entity.idAttribute.name}); ${entity.name} ${entity.code} = ${service}.queryById( ${entity.idAttribute.name});
...@@ -135,7 +135,7 @@ public class ${entity.name}Controller{ ...@@ -135,7 +135,7 @@ public class ${entity.name}Controller{
} }
\@PostMapping(MODEL + "/delete.json") \@PostMapping(MODEL + "/delete.json")
\@Function("${entity.code}.delete") \@Function("${basicfunctionCode}.delete")
\@ResponseBody \@ResponseBody
public JsonResult delete(String ids) { public JsonResult delete(String ids) {
if (ids.endsWith(",")) { if (ids.endsWith(",")) {
...@@ -149,7 +149,7 @@ public class ${entity.name}Controller{ ...@@ -149,7 +149,7 @@ public class ${entity.name}Controller{
@if(entity.includeExcel){ @if(entity.includeExcel){
\@PostMapping(MODEL + "/excel/export.json") \@PostMapping(MODEL + "/excel/export.json")
\@Function("${entity.code}.export") \@Function("${basicfunctionCode}.export")
\@ResponseBody \@ResponseBody
public JsonResult<String> export(HttpServletResponse response,${entity.name}Query condtion) { public JsonResult<String> export(HttpServletResponse response,${entity.name}Query condtion) {
/** /**
...@@ -184,7 +184,7 @@ public class ${entity.name}Controller{ ...@@ -184,7 +184,7 @@ public class ${entity.name}Controller{
} }
\@PostMapping(MODEL + "/excel/import.do") \@PostMapping(MODEL + "/excel/import.do")
\@Function("${entity.code}.import") \@Function("${basicfunctionCode}.import")
\@ResponseBody \@ResponseBody
public JsonResult importExcel(\@RequestParam("file") MultipartFile file) throws Exception { public JsonResult importExcel(\@RequestParam("file") MultipartFile file) throws Exception {
if (file.isEmpty()) { if (file.isEmpty()) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment