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 @@
<packaging>jar</packaging>
<parent>
<groupId>com.ibeetl</groupId>
<artifactId>admin-cloud</artifactId>
<version>1.1.3</version>
<relativePath>../admin-cloud/pom.xml</relativePath>
<artifactId>admin</artifactId>
<version>${plus.version}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>com.ibeetl</groupId>
<artifactId>admin-core</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>${plus.version}</version>
</dependency>
<!-- 重新覆盖mysql的版本,原因:虽然admin-core更新过mysql版本,但由于parent是admin-cloud,导致更新的版本失效 -->
......
......@@ -5,9 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@EnableEurekaClient
@SpringBootApplication
@EnableCaching
public class CosonleApplication extends SpringBootServletInitializer {
......
......@@ -8,13 +8,15 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.password=starter2
#spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
beetlsql.ds.dataSource.basePackage=com
beetlsql.mutiple.datasource=dataSource
# 1,1 是管理员密码,相当于启动后就登录,方便测试,系统需要取消这俩个配置
user.id=1
user.orgId=1
#打开审计功能,开发模式应该关闭
audit.enable=false
#单机情况下使用hashmap存放回话,集群下可以参考springboot 使用redis
spring.session.store-type=HASH_MAP
#spring.cache.type=
spring.cache.type=SIMPLE
......
......@@ -3,11 +3,16 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>admin-core</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>com.ibeetl</groupId>
<artifactId>admin</artifactId>
<version>${plus.version}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
......@@ -40,7 +45,7 @@
<dependency>
<groupId>com.ibeetl</groupId>
<artifactId>beetl-framework-starter</artifactId>
<version>1.1.47.RELEASE</version>
<version>1.1.54.RELEASE</version>
</dependency>
<dependency>
......@@ -93,12 +98,7 @@
</dependencies>
<parent>
<groupId>com.ibeetl</groupId>
<artifactId>admin</artifactId>
<version>1.1.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
......@@ -14,11 +14,13 @@ import com.ibeetl.admin.core.gen.model.Entity;
public class JavaCodeGen implements AutoGen{
String basePackage;
Entity entity;
String basicFunctionCode = null;
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.entity = entity;
this.basicFunctionCode =basicFunctionCode;
}
@Override
public void make(Target target, Entity entity) {
......@@ -159,6 +161,7 @@ class JavaControllerGen implements AutoGen{
template.binding("target", target);
template.binding("package", gen.basePackage+".web");
template.binding("basePackage", gen.basePackage);
template.binding("basicfunctionCode",gen.basicFunctionCode);
String content = template.render();
target.flush(this, content);
}
......
......@@ -117,7 +117,9 @@ public class CorePlatformService {
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 {
public Long getCurrentOrgId() {
checkSession();
CoreOrg org = (CoreOrg) httpRequestLocal.getSessionValue(ACCESS_CURRENT_ORG);
return org.getId();
}
public CoreOrg getCurrentOrg() {
checkSession();
CoreOrg org = (CoreOrg) httpRequestLocal.getSessionValue(ACCESS_CURRENT_ORG);
return org;
......@@ -148,6 +152,13 @@ public class CorePlatformService {
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) {
httpRequestLocal.setSessionValue(CorePlatformService.ACCESS_CURRENT_USER, user);
......
......@@ -76,7 +76,7 @@ public class DataAccessFunction implements Function {
List<CoreRoleFunction> roleFuns = platFormService.getRoleFunction(user.getId(),currentOrgId,functionCode);
if(roleFuns.isEmpty()){
//如果没有配置数据权限,是1=1,因此为角色指定功能的时候,需要设定数据权限,否则查询到所有数据
return "1=1 /*empty data access */ ";
return "1=1 /* empty data access */ ";
}
......@@ -105,7 +105,7 @@ public class DataAccessFunction implements Function {
}
case AllOrg:{
//sql 不包含组织机构过滤信息
continue ;
sb.append(" 1=1 /* AllOrg */ ");
}
case OnlyUser:{
List<Long> ids = ret.getUserIds();
......
......@@ -202,8 +202,9 @@ public class CoreCodeGenController {
HtmlGen htmlGen = new HtmlGen();
htmlGen.make(target, entity);
JavaCodeGen javaGen = new JavaCodeGen(basePackage, entity);
String preffix = urlBase.replace('/', '.');
String basicFunctionCode = preffix+"."+entity.getCode();
JavaCodeGen javaGen = new JavaCodeGen(basePackage, entity,basicFunctionCode);
javaGen.make(target, entity);
MdGen mdGen = new MdGen();
......@@ -280,7 +281,10 @@ public class CoreCodeGenController {
String basePackage = data.getBasePackage();
WebTarget webTarget = new WebTarget(entity, basePackage);
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);
Map<String, String> content = new HashMap<String, String>();
for (Entry<Object, String> entry : webTarget.map.entrySet()) {
......@@ -352,13 +356,14 @@ public class CoreCodeGenController {
@GetMapping(MODEL + "/{table}/test.json")
@ResponseBody
public void test(@PathVariable String table) {
String urlBase = "cms";
Entity entity = new Entity();
entity.setCode("blog");
entity.setName("CmsBlog");
entity.setDisplayName("博客");
entity.setTableName("CMS_BLOG");
entity.setSystem("console");
Attribute idAttr = new Attribute();
idAttr.setColName("id");
......@@ -423,8 +428,9 @@ public class CoreCodeGenController {
HtmlGen htmlGen = new HtmlGen();
htmlGen.make(target, entity);
JavaCodeGen javaGen = new JavaCodeGen(basePackage, entity);
String preffix = urlBase.replace('/', '.');
String basicFunctionCode = preffix+"."+entity.getCode();
JavaCodeGen javaGen = new JavaCodeGen(basePackage, entity,basicFunctionCode);
javaGen.make(target, entity);
MdGen mdGen = new MdGen();
......
......@@ -65,7 +65,7 @@ public class ${entity.name}Controller{
/* 页面 */
\@GetMapping(MODEL + "/index.do")
\@Function("${entity.code}.query")
\@Function("${basicfunctionCode}.query")
\@ResponseBody
public ModelAndView index() {
ModelAndView view = new ModelAndView("/${target.urlBase}/${entity.code}/index.html") ;
......@@ -74,7 +74,7 @@ public class ${entity.name}Controller{
}
\@GetMapping(MODEL + "/edit.do")
\@Function("${entity.code}.edit")
\@Function("${basicfunctionCode}.edit")
\@ResponseBody
public ModelAndView edit(${entity.idAttribute.javaType} ${entity.idAttribute.name}) {
ModelAndView view = new ModelAndView("/${target.urlBase}/${entity.code}/edit.html");
......@@ -84,7 +84,7 @@ public class ${entity.name}Controller{
}
\@GetMapping(MODEL + "/add.do")
\@Function("${entity.code}.add")
\@Function("${basicfunctionCode}.add")
\@ResponseBody
public ModelAndView add() {
ModelAndView view = new ModelAndView("/${target.urlBase}/${entity.code}/add.html");
......@@ -94,7 +94,7 @@ public class ${entity.name}Controller{
/* ajax json */
\@PostMapping(MODEL + "/list.json")
\@Function("${entity.code}.query")
\@Function("${basicfunctionCode}.query")
\@ResponseBody
public JsonResult<PageQuery> list(${entity.name}Query condtion)
{
......@@ -104,7 +104,7 @@ public class ${entity.name}Controller{
}
\@PostMapping(MODEL + "/add.json")
\@Function("${entity.code}.add")
\@Function("${basicfunctionCode}.add")
\@ResponseBody
public JsonResult add(\@Validated(ValidateConfig.ADD.class)${entity.name} ${entity.code})
{
......@@ -113,7 +113,7 @@ public class ${entity.name}Controller{
}
\@PostMapping(MODEL + "/update.json")
\@Function("${entity.code}.update")
\@Function("${basicfunctionCode}.update")
\@ResponseBody
public JsonResult<String> update(\@Validated(ValidateConfig.UPDATE.class) ${entity.name} ${entity.code}) {
boolean success = ${service}.update(${entity.code});
......@@ -127,7 +127,7 @@ public class ${entity.name}Controller{
\@GetMapping(MODEL + "/view.json")
\@Function("${entity.code}.query")
\@Function("${basicfunctionCode}.query")
\@ResponseBody
public JsonResult<${entity.name}>queryInfo(${entity.idAttribute.javaType} ${entity.idAttribute.name}) {
${entity.name} ${entity.code} = ${service}.queryById( ${entity.idAttribute.name});
......@@ -135,7 +135,7 @@ public class ${entity.name}Controller{
}
\@PostMapping(MODEL + "/delete.json")
\@Function("${entity.code}.delete")
\@Function("${basicfunctionCode}.delete")
\@ResponseBody
public JsonResult delete(String ids) {
if (ids.endsWith(",")) {
......@@ -149,7 +149,7 @@ public class ${entity.name}Controller{
@if(entity.includeExcel){
\@PostMapping(MODEL + "/excel/export.json")
\@Function("${entity.code}.export")
\@Function("${basicfunctionCode}.export")
\@ResponseBody
public JsonResult<String> export(HttpServletResponse response,${entity.name}Query condtion) {
/**
......@@ -184,7 +184,7 @@ public class ${entity.name}Controller{
}
\@PostMapping(MODEL + "/excel/import.do")
\@Function("${entity.code}.import")
\@Function("${basicfunctionCode}.import")
\@ResponseBody
public JsonResult importExcel(\@RequestParam("file") MultipartFile file) throws Exception {
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