Commit 458c1322 by hewei

Merge branch 'double_realm_test' into 'master'

初始化提交

See merge request hewei/Jumeirah!1
parents 50f89ea2 21b4c3fa
...@@ -18,11 +18,56 @@ ...@@ -18,11 +18,56 @@
└── api-system 平台管理系统api模块 └── api-system 平台管理系统api模块
└── api-app app的api模块 └── api-app app的api模块
└── api-merchant 商家api服务模块 └── api-merchant 商家api服务模块
└── common 通用模块 └── common 通用模块(包含service dao mapper)
```
## 安装中间件
redis(必须本地开启)
mysql5.7 (你本地可以不开,在本地配置中已经连上了测试环境)
## 开发规范
### 关于模块
api-system api-app api-merchant
三个模块是各自针对不同后端模块的api接口,都包含common模块的依赖,
你只能在其中开发模块属于自己的controller和service,
并且可以实现当前模块的service业务逻辑层,但对数据库操作,请一定调用common模块的service,不要在api-XXX的模块下写数据库的操作.
如果业务流程没有很复杂, 在controller类中你可以直接调用common模块的service
### 例如:
#### 商户注册
在api-merchant模块中的controller包下新建一个Register控制器,
模块下每个控制器url路径必须要加上前缀```"/merchant/"```,这样为了方便权限控制
像这样:
```
@RequestMapping("/merchant/register/")
```
注册业务逻辑要调用common模块中的service去操作
#### app注册
在api-app模块中的controller包下新建一个Register控制器,
模块下每个控制器url路径必须要加上前缀```"/app/"```,这样为了方便权限控制
像这样:
```
@RequestMapping("/app/register/")
```
注册业务逻辑要调用common模块中的service去操作
## 安装软件
redis
mysql5.7
...@@ -17,7 +17,7 @@ import java.io.IOException; ...@@ -17,7 +17,7 @@ import java.io.IOException;
* *
**/ **/
@Slf4j @Slf4j
@Api(value = "Hello World2", tags = {"Hello World2"}) @Api(value = "Hello World2", tags = {"APP Hello World2"})
@RestController @RestController
@RequestMapping("/app") @RequestMapping("/app")
public class AppHelloWorldController { public class AppHelloWorldController {
......
...@@ -45,7 +45,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -45,7 +45,7 @@ import javax.servlet.http.HttpServletResponse;
@Slf4j @Slf4j
@RestController @RestController
@Module("system") @Module("system")
@Api(value = "用户注册API", tags = {"用户注册"}) @Api(value = "用户注册API", tags = {"APP用户注册"})
@RequestMapping("/app") @RequestMapping("/app")
public class RegisterController { public class RegisterController {
...@@ -57,7 +57,7 @@ public class RegisterController { ...@@ -57,7 +57,7 @@ public class RegisterController {
@OperationLogIgnore @OperationLogIgnore
@ApiOperation(value = "注册", notes = "web用户注册", response = LoginSysUserTokenVo.class) @ApiOperation(value = "注册", notes = "web用户注册", response = LoginSysUserTokenVo.class)
public ApiResult<LoginSysUserTokenVo> register(@Validated @RequestBody RegisterParam registerParam, HttpServletResponse response, @RequestHeader(required = false) String language) throws Exception { public ApiResult<LoginSysUserTokenVo> register(@Validated @RequestBody RegisterParam registerParam, HttpServletResponse response, @RequestHeader(required = false) String language) throws Exception {
return registerService.register(registerParam, response,language); return registerService.register(registerParam, response,language);
} }
} }
package com.jumeirah.api.app.service;
public interface RegisterService {
void regiest();
}
package com.jumeirah.api.app.service.impl;
import com.jumeirah.api.app.service.RegisterService;
import org.springframework.stereotype.Service;
@Service
public class RegisterServiceImpl implements RegisterService {
@Override
public void regiest() {
}
}
package com.jumeirah.api.merchant.controller;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
/**
* Hello World Controller
*
**/
@Slf4j
@Api(value = "Hello World2", tags = {"商户Hello World2"})
@RestController
@RequestMapping("/merchant/")
public class AppHelloWorldController {
/**
* Hello World
*
* @return
* @throws IOException
*/
@GetMapping(value = "/world")
@OperationLog(name = "helloWorld")
@ApiOperation(value = "Hello World", response = String.class)
public ApiResult<String> helloWorld() throws IOException {
log.debug("Hello World...app");
return ApiResult.ok("Hello World app merchant");
}
}
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jumeirah.api.merchant.controller;
import com.jumeirah.common.param.RegisterParam;
import com.jumeirah.common.service.RegisterService;
import com.jumeirah.common.vo.LoginSysUserTokenVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.log.annotation.Module;
import io.geekidea.springbootplus.framework.log.annotation.OperationLogIgnore;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
/**
* 注册控制器
*
* @author geekidea
* @date 2019-09-28
* @since 1.3.0.RELEASE
**/
@Slf4j
@RestController
@Module("system")
@Api(value = "商户注册API", tags = {"商户注册"})
@RequestMapping("/merchant/")
public class RegisterController {
@Autowired
private RegisterService registerService;
@PostMapping("/register")
@OperationLogIgnore
@ApiOperation(value = "注册", notes = "商户注册", response = LoginSysUserTokenVo.class)
public ApiResult<LoginSysUserTokenVo> register(@Validated @RequestBody RegisterParam registerParam, HttpServletResponse response, @RequestHeader(required = false) String language) throws Exception {
return registerService.register(registerParam, response,language);
}
}
...@@ -43,7 +43,7 @@ import java.util.List; ...@@ -43,7 +43,7 @@ import java.util.List;
*/ */
@Slf4j @Slf4j
@Controller @Controller
@RequestMapping("/download") @RequestMapping("/sys/download")
@Module("system") @Module("system")
@Api(value = "文件下载", tags = {"文件下载"}) @Api(value = "文件下载", tags = {"文件下载"})
public class DownloadController { public class DownloadController {
......
...@@ -36,7 +36,7 @@ import java.io.IOException; ...@@ -36,7 +36,7 @@ import java.io.IOException;
@Slf4j @Slf4j
@Api(value = "Hello World", tags = {"Hello World"}) @Api(value = "Hello World", tags = {"Hello World"})
@RestController @RestController
@RequestMapping("/system/hello") @RequestMapping("/sys/hello")
public class HelloWorldController { public class HelloWorldController {
/** /**
......
...@@ -17,14 +17,14 @@ ...@@ -17,14 +17,14 @@
package com.jumeirah.api.system.controller; package com.jumeirah.api.system.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.log.annotation.Module;
import io.geekidea.springbootplus.framework.log.annotation.OperationLogIgnore;
import com.jumeirah.common.param.LoginParam; import com.jumeirah.common.param.LoginParam;
import com.jumeirah.common.service.LoginService; import com.jumeirah.common.service.LoginService;
import com.jumeirah.common.service.SysUserService; import com.jumeirah.common.service.SysUserService;
import com.jumeirah.common.vo.LoginSysUserTokenVo; import com.jumeirah.common.vo.LoginSysUserTokenVo;
import com.jumeirah.common.vo.SysUserQueryVo; import com.jumeirah.common.vo.SysUserQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.log.annotation.Module;
import io.geekidea.springbootplus.framework.log.annotation.OperationLogIgnore;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -51,6 +52,8 @@ import javax.servlet.http.HttpServletResponse; ...@@ -51,6 +52,8 @@ import javax.servlet.http.HttpServletResponse;
@RestController @RestController
@Module("system") @Module("system")
@Api(value = "系统登录API", tags = {"系统登录"}) @Api(value = "系统登录API", tags = {"系统登录"})
@RequestMapping("/sys/")
public class LoginController { public class LoginController {
@Autowired @Autowired
......
...@@ -52,7 +52,7 @@ import java.util.List; ...@@ -52,7 +52,7 @@ import java.util.List;
*/ */
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/sysDepartment") @RequestMapping("/sys/sysDepartment")
@Module("system") @Module("system")
@Api(value = "系统部门API", tags = {"系统部门"}) @Api(value = "系统部门API", tags = {"系统部门"})
public class SysDepartmentController extends BaseController { public class SysDepartmentController extends BaseController {
......
...@@ -53,7 +53,7 @@ import java.util.List; ...@@ -53,7 +53,7 @@ import java.util.List;
*/ */
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/sysPermission") @RequestMapping("/sys/sysPermission")
@Module("system") @Module("system")
@Api(value = "系统权限 API", tags = {"系统权限"}) @Api(value = "系统权限 API", tags = {"系统权限"})
public class SysPermissionController extends BaseController { public class SysPermissionController extends BaseController {
......
...@@ -53,7 +53,7 @@ import java.util.List; ...@@ -53,7 +53,7 @@ import java.util.List;
*/ */
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/sysRole") @RequestMapping("/sys/sysRole")
@Module("system") @Module("system")
@Api(value = "系统角色API", tags = {"系统角色"}) @Api(value = "系统角色API", tags = {"系统角色"})
public class SysRoleController extends BaseController { public class SysRoleController extends BaseController {
......
...@@ -55,7 +55,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -55,7 +55,7 @@ import org.springframework.web.bind.annotation.RestController;
*/ */
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/sysUser") @RequestMapping("/sys/sysUser")
@Module("system") @Module("system")
@Api(value = "系统用户API", tags = {"系统用户"}) @Api(value = "系统用户API", tags = {"系统用户"})
public class SysUserController extends BaseController { public class SysUserController extends BaseController {
......
...@@ -48,7 +48,7 @@ import java.time.format.DateTimeFormatter; ...@@ -48,7 +48,7 @@ import java.time.format.DateTimeFormatter;
*/ */
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/upload") @RequestMapping("/sys/upload")
@Module("system") @Module("system")
@Api(value = "文件上传", tags = {"文件上传"}) @Api(value = "文件上传", tags = {"文件上传"})
public class UploadController { public class UploadController {
......
...@@ -56,7 +56,7 @@ import java.util.concurrent.TimeUnit; ...@@ -56,7 +56,7 @@ import java.util.concurrent.TimeUnit;
@Controller @Controller
@Api(value = "验证码API", tags = {"验证码"}) @Api(value = "验证码API", tags = {"验证码"})
@Module("system") @Module("system")
@RequestMapping("/verificationCode") @RequestMapping("/sys/verificationCode")
@ConditionalOnProperty(value = {"spring-boot-plus.enable-verify-code"}, matchIfMissing = true) @ConditionalOnProperty(value = {"spring-boot-plus.enable-verify-code"}, matchIfMissing = true)
public class VerificationCodeController { public class VerificationCodeController {
......
...@@ -14,10 +14,9 @@ spring-boot-plus: ...@@ -14,10 +14,9 @@ spring-boot-plus:
spring: spring:
datasource: datasource:
# url: jdbc:mysql://localhost:3306/spring_boot_plus?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true url: jdbc:mysql://47.99.47.225:3306/Jumeirah?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
url: jdbc:mysql://localhost:3306/Jumeirah?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
username: root username: root
password: 123 password: temple123456
# Redis配置 # Redis配置
redis: redis:
......
...@@ -6,8 +6,8 @@ server: ...@@ -6,8 +6,8 @@ server:
servlet: servlet:
context-path: /api context-path: /api
tomcat: tomcat:
max-threads: 1000 max-threads: 200
min-spare-threads: 30 min-spare-threads: 10
uri-encoding: UTF-8 uri-encoding: UTF-8
############################# 访问路径、端口tomcat end ############################### ############################# 访问路径、端口tomcat end ###############################
...@@ -192,8 +192,6 @@ spring-boot-plus: ...@@ -192,8 +192,6 @@ spring-boot-plus:
# - /actuator/** # - /actuator/**
- # 排除首页 - # 排除首页
- /,/index.html - /,/index.html
- /app/world/*
- /system/hello/*
# 多行字符串权限配置 # 多行字符串权限配置
filter-chain-definitions: | filter-chain-definitions: |
...@@ -201,7 +199,8 @@ spring-boot-plus: ...@@ -201,7 +199,8 @@ spring-boot-plus:
/upload/**=anon /upload/**=anon
/verificationCode/**=anon /verificationCode/**=anon
/enum=anon /enum=anon
# /getSysUserInfo=anon # 配置/app/**路径下登陆的用户就能访问
/app/**=authc
######################## Spring Shiro end ########################## ######################## Spring Shiro end ##########################
......
Markdown is supported
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