Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
85f0800a
Commit
85f0800a
authored
Jun 03, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加配置
parent
bdf55076
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
429 additions
and
9 deletions
+429
-9
pom.xml
pom.xml
+1
-1
pom.xml
xx-app/pom.xml
+3
-3
pom.xml
xx-app/xx-app-api/pom.xml
+1
-1
Cofig.java
...api/src/main/java/com/xxfc/platform/app/entity/Cofig.java
+54
-0
ConfigFeign.java
...rc/main/java/com/xxfc/platform/app/feign/ConfigFeign.java
+19
-0
pom.xml
xx-app/xx-app-server/pom.xml
+2
-2
AppApplication.java
...r/src/main/java/com/xxfc/platform/app/AppApplication.java
+1
-2
CofigBiz.java
...ver/src/main/java/com/xxfc/platform/app/biz/CofigBiz.java
+26
-0
RedisConfiguration.java
...java/com/xxfc/platform/app/config/RedisConfiguration.java
+35
-0
RestConfiguration.java
.../java/com/xxfc/platform/app/config/RestConfiguration.java
+13
-0
SwaggerConfig.java
...main/java/com/xxfc/platform/app/config/SwaggerConfig.java
+56
-0
WebConfiguration.java
...n/java/com/xxfc/platform/app/config/WebConfiguration.java
+54
-0
CofigMapper.java
...c/main/java/com/xxfc/platform/app/mapper/CofigMapper.java
+19
-0
CofigController.java
...main/java/com/xxfc/platform/app/rest/CofigController.java
+40
-0
bootstrap.yml
xx-app/xx-app-server/src/main/resources/bootstrap.yml
+34
-0
generatorConfig.xml
...app-server/src/main/resources/builder/generatorConfig.xml
+43
-0
CofigMapper.xml
...p/xx-app-server/src/main/resources/mapper/CofigMapper.xml
+28
-0
No files found.
pom.xml
View file @
85f0800a
...
...
@@ -41,7 +41,7 @@
<module>
xx-third-party
</module>
<module>
xx-third-party-api
</module>
<module>
vehicle
</module>
<!-- <module>application</module>--
>
<module>
xx-app
</module
>
<module>
xx-common
</module>
<module>
xx-order
</module>
<module>
xx-vehicle
</module>
...
...
app/pom.xml
→
xx-
app/pom.xml
View file @
85f0800a
...
...
@@ -9,12 +9,12 @@
</parent>
<groupId>
com.xxfc.platform
</groupId>
<modules>
<module>
app-api
</module>
<module>
app-server
</module>
<module>
xx-
app-api
</module>
<module>
xx-
app-server
</module>
</modules>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
pom
</packaging>
<artifactId>
app
</artifactId>
<artifactId>
xx-
app
</artifactId>
</project>
\ No newline at end of file
app/
app-api/pom.xml
→
xx-app/xx-
app-api/pom.xml
View file @
85f0800a
...
...
@@ -9,6 +9,6 @@
</parent>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.xxfc.platform
</groupId>
<artifactId>
app-api
</artifactId>
<artifactId>
xx-
app-api
</artifactId>
</project>
\ No newline at end of file
xx-app/xx-app-api/src/main/java/com/xxfc/platform/app/entity/Cofig.java
0 → 100644
View file @
85f0800a
package
com
.
xxfc
.
platform
.
app
.
entity
;
import
java.io.Serializable
;
import
java.util.Date
;
import
javax.persistence.*
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* 系统配置表
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-03 15:57:13
*/
@Data
@Table
(
name
=
"cofig"
)
public
class
Cofig
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
//主键id
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
//1-租车须知;2-预定须知
@Column
(
name
=
"type"
)
@ApiModelProperty
(
value
=
"1-租车须知;2-预定须知"
)
private
Integer
type
;
//
@Column
(
name
=
"value"
)
@ApiModelProperty
(
value
=
""
)
private
String
value
;
//创建时间
@Column
(
name
=
"crt_time"
)
@ApiModelProperty
(
value
=
"创建时间"
,
hidden
=
true
)
private
Long
crtTime
;
//更新时间
@Column
(
name
=
"upd_time"
)
@ApiModelProperty
(
value
=
"更新时间"
,
hidden
=
true
)
private
Long
updTime
;
//是否删除;0-1正常;1-删除
@Column
(
name
=
"is_del"
)
@ApiModelProperty
(
value
=
"是否删除;0-1正常;1-删除"
)
private
Integer
isDel
;
}
xx-app/xx-app-api/src/main/java/com/xxfc/platform/app/feign/ConfigFeign.java
0 → 100644
View file @
85f0800a
package
com
.
xxfc
.
platform
.
app
.
feign
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.app.entity.Cofig
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
/**
* Created by ace on 2017/9/15.
*/
//@FeignClient(value = "${auth.serviceId}",configuration = {})
@FeignClient
(
"xx-app"
)
public
interface
ConfigFeign
{
@RequestMapping
(
value
=
"/cofig/types/{types}"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
<
Cofig
>
getAllByType
(
String
types
);
}
app/
app-server/pom.xml
→
xx-app/xx-
app-server/pom.xml
View file @
85f0800a
...
...
@@ -9,7 +9,7 @@
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
app-server
</artifactId>
<artifactId>
xx-
app-server
</artifactId>
<properties>
<mapper.version>
3.4.0
</mapper.version>
...
...
@@ -19,7 +19,7 @@
<!-- 自己项目 -->
<dependency>
<groupId>
com.xxfc.platform
</groupId>
<artifactId>
app-api
</artifactId>
<artifactId>
xx-
app-api
</artifactId>
<version>
2.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
...
...
app/
app-server/src/main/java/com/xxfc/platform/app/AppApplication.java
→
xx-app/xx-
app-server/src/main/java/com/xxfc/platform/app/AppApplication.java
View file @
85f0800a
...
...
@@ -16,8 +16,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableAceAuthClient
@EnableFeignClients
({
"com.github.wxiaoqi.security.auth.client.feign"
,
"com.xxfc.platform.app.feign"
})
@EnableAceCache
@MapperScan
(
"com.xxfc.platform.app.mapper"
)
@EnableSwagger2Doc
@tk
.
mybatis
.
spring
.
annotation
.
MapperScan
(
basePackages
=
"com.xxfc.platform.app.mapper"
)
public
class
AppApplication
{
public
static
void
main
(
String
[]
args
)
{
...
...
xx-app/xx-app-server/src/main/java/com/xxfc/platform/app/biz/CofigBiz.java
0 → 100644
View file @
85f0800a
package
com
.
xxfc
.
platform
.
app
.
biz
;
import
org.springframework.stereotype.Service
;
import
com.xxfc.platform.app.entity.Cofig
;
import
com.xxfc.platform.app.mapper.CofigMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
java.util.List
;
/**
* 系统配置表
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-03 15:57:13
*/
@Service
public
class
CofigBiz
extends
BaseBiz
<
CofigMapper
,
Cofig
>
{
public
List
<
Cofig
>
getConfigByType
(
List
<
Integer
>
list
){
return
mapper
.
getAllByType
(
list
);
}
}
\ No newline at end of file
xx-app/xx-app-server/src/main/java/com/xxfc/platform/app/config/RedisConfiguration.java
0 → 100644
View file @
85f0800a
package
com
.
xxfc
.
platform
.
app
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.serializer.RedisSerializer
;
import
org.springframework.data.redis.serializer.StringRedisSerializer
;
/**
* ${DESCRIPTION}
*
* @author wanghaobin
* @create 2017-06-21 8:39
*/
@Configuration
@Primary
public
class
RedisConfiguration
{
@Bean
public
RedisTemplate
<
String
,
Object
>
customRedisTemplate
(
RedisConnectionFactory
factory
)
{
RedisTemplate
redisTemplate
=
new
RedisTemplate
();
redisTemplate
.
setConnectionFactory
(
factory
);
RedisSerializer
<
String
>
stringSerializer
=
new
StringRedisSerializer
();
redisTemplate
.
setKeySerializer
(
stringSerializer
);
redisTemplate
.
setValueSerializer
(
stringSerializer
);
redisTemplate
.
setHashKeySerializer
(
stringSerializer
);
redisTemplate
.
setHashValueSerializer
(
stringSerializer
);
redisTemplate
.
afterPropertiesSet
();
return
redisTemplate
;
}
}
xx-app/xx-app-server/src/main/java/com/xxfc/platform/app/config/RestConfiguration.java
0 → 100644
View file @
85f0800a
package
com
.
xxfc
.
platform
.
app
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.client.RestTemplate
;
@Configuration
public
class
RestConfiguration
{
@Bean
public
RestTemplate
restTemplate
()
{
return
new
RestTemplate
();
}
}
xx-app/xx-app-server/src/main/java/com/xxfc/platform/app/config/SwaggerConfig.java
0 → 100644
View file @
85f0800a
package
com
.
xxfc
.
platform
.
app
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.ParameterBuilder
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
import
springfox.documentation.schema.ModelRef
;
import
springfox.documentation.service.ApiInfo
;
import
springfox.documentation.service.Parameter
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spring.web.plugins.Docket
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @Description : swagger配置配置
* @Author : Mars
* @Date : 2017年9月6日
*/
@Configuration
@EnableSwagger2
public
class
SwaggerConfig
{
/**
* Every Docket bean is picked up by the swagger-mvc framework - allowing for multiple
* swagger groups i.e. same code base multiple swagger resource listings.
*/
@Bean
public
Docket
customDocket
(){
ParameterBuilder
ticketPar
=
new
ParameterBuilder
();
List
<
Parameter
>
pars
=
new
ArrayList
<
Parameter
>();
ticketPar
.
name
(
"Authorization"
).
description
(
"user Authorization"
)
.
modelRef
(
new
ModelRef
(
"string"
)).
parameterType
(
"header"
)
.
required
(
false
).
build
();
//header中的ticket参数非必填,传空也可以
pars
.
add
(
ticketPar
.
build
());
//根据每个方法名也知道当前方法在设置什么参数
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.xxfc.platform.app"
))
//.apis(RequestHandlerSelectors.any())
.
build
()
.
globalOperationParameters
(
pars
)
.
apiInfo
(
apiInfo
());
}
ApiInfo
apiInfo
()
{
return
new
ApiInfoBuilder
()
.
title
(
"api swagger document"
)
.
description
(
"前后端联调swagger api 文档"
)
.
version
(
"2.1.5.5"
)
.
build
();
}
}
\ No newline at end of file
xx-app/xx-app-server/src/main/java/com/xxfc/platform/app/config/WebConfiguration.java
0 → 100644
View file @
85f0800a
package
com
.
xxfc
.
platform
.
app
.
config
;
import
com.github.wxiaoqi.security.auth.client.interceptor.ServiceAuthRestInterceptor
;
import
com.github.wxiaoqi.security.auth.client.interceptor.UserAuthRestInterceptor
;
import
com.github.wxiaoqi.security.common.handler.GlobalExceptionHandler
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
java.util.ArrayList
;
import
java.util.Collections
;
@Configuration
(
"appWebConfig"
)
@Primary
public
class
WebConfiguration
implements
WebMvcConfigurer
{
@Bean
GlobalExceptionHandler
getGlobalExceptionHandler
()
{
return
new
GlobalExceptionHandler
();
}
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
getServiceAuthRestInterceptor
()).
addPathPatterns
(
getIncludePathPatterns
());
registry
.
addInterceptor
(
getUserAuthRestInterceptor
()).
addPathPatterns
(
getIncludePathPatterns
());
}
@Bean
ServiceAuthRestInterceptor
getServiceAuthRestInterceptor
()
{
return
new
ServiceAuthRestInterceptor
();
}
@Bean
UserAuthRestInterceptor
getUserAuthRestInterceptor
()
{
return
new
UserAuthRestInterceptor
();
}
/**
* 需要用户和服务认证判断的路径
* @return
*/
private
ArrayList
<
String
>
getIncludePathPatterns
()
{
ArrayList
<
String
>
list
=
new
ArrayList
<>();
String
[]
urls
=
{
"/cofig/**"
};
Collections
.
addAll
(
list
,
urls
);
return
list
;
}
}
xx-app/xx-app-server/src/main/java/com/xxfc/platform/app/mapper/CofigMapper.java
0 → 100644
View file @
85f0800a
package
com
.
xxfc
.
platform
.
app
.
mapper
;
import
com.xxfc.platform.app.entity.Cofig
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.List
;
/**
* 系统配置表
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-03 15:57:13
*/
public
interface
CofigMapper
extends
Mapper
<
Cofig
>
{
public
List
<
Cofig
>
getAllByType
(
@Param
(
"typeList"
)
List
<
Integer
>
list
);
}
xx-app/xx-app-server/src/main/java/com/xxfc/platform/app/rest/CofigController.java
0 → 100644
View file @
85f0800a
package
com
.
xxfc
.
platform
.
app
.
rest
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.xxfc.platform.app.biz.CofigBiz
;
import
com.xxfc.platform.app.entity.Cofig
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.List
;
@RestController
@RequestMapping
(
"cofig"
)
@IgnoreClientToken
@Slf4j
public
class
CofigController
extends
BaseController
<
CofigBiz
,
Cofig
>
{
@RequestMapping
(
value
=
"/app/unauth/types"
,
method
=
RequestMethod
.
GET
)
@IgnoreUserToken
public
ObjectRestResponse
<
List
<
Cofig
>>
getAllByType
(
@RequestParam
(
value
=
"types"
,
defaultValue
=
""
)
String
types
){
if
(
StringUtils
.
isBlank
(
types
)){
throw
new
BaseException
(
ResultCode
.
NULL_CODE
);
}
String
[]
all
=
types
.
split
(
","
);
List
<
Integer
>
list
=
new
ArrayList
<>();
for
(
String
str:
all
){
if
(
StringUtils
.
isNotBlank
(
str
)){
list
.
add
(
Integer
.
parseInt
(
str
));
}
}
return
new
ObjectRestResponse
<>().
rel
(
true
).
data
(
baseBiz
.
getConfigByType
(
list
));
}
}
\ No newline at end of file
xx-app/xx-app-server/src/main/resources/bootstrap.yml
0 → 100644
View file @
85f0800a
#spring:
# application:
# name: vehicle
# cloud:
# nacos:
# config:
# server-addr: 127.0.0.1:8848
# file-extension: yaml
# profiles:
# active: dev
spring
:
profiles
:
active
:
dev
application
:
name
:
xx-app
cloud
:
nacos
:
config
:
file-extension
:
yaml
---
spring
:
profiles
:
dev
cloud
:
nacos
:
config
:
server-addr
:
127.0.0.1:8848
---
spring
:
profiles
:
pro
cloud
:
nacos
:
config
:
server-addr
:
10.5.52.2:8848
\ No newline at end of file
xx-app/xx-app-server/src/main/resources/builder/generatorConfig.xml
0 → 100644
View file @
85f0800a
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!--<properties resource="dev.properties"/>-->
<context
id=
"Mysql"
targetRuntime=
"MyBatis3Simple"
defaultModelType=
"flat"
>
<property
name=
"beginningDelimiter"
value=
"`"
/>
<property
name=
"endingDelimiter"
value=
"`"
/>
<property
name=
"mergeable"
value=
"false"
></property>
<plugin
type=
"tk.mybatis.mapper.generator.MapperPlugin"
>
<property
name=
"mappers"
value=
"tk.mybatis.mapper.common.Mapper"
/>
</plugin>
<jdbcConnection
driverClass=
"com.mysql.jdbc.Driver"
connectionURL=
"jdbc:mysql://localhost:3306/vehicle?useUnicode=true&characterEncoding=UTF8"
userId=
"root"
password=
"xx2019fc"
>
</jdbcConnection>
<javaModelGenerator
targetPackage=
"${targetModelPackage}"
targetProject=
"${targetJavaProject}"
/>
<sqlMapGenerator
targetPackage=
"${targetXMLPackage}"
targetProject=
"${targetResourcesProject}"
/>
<javaClientGenerator
targetPackage=
"${targetMapperPackage}"
targetProject=
"${targetJavaProject}"
type=
"XMLMAPPER"
/>
<!-- <table tableName="vehicle" domainObjectName="Vehicle">-->
<!-- </table>-->
<!-- <table tableName="vehicle_book_info" domainObjectName="VehicleBookInfo">-->
<!-- </table>-->
<!-- <table tableName="vehicle_book_record" domainObjectName="VehicleBookRecord">-->
<!-- </table>-->
<!-- <table tableName="branch_company" domainObjectName="BranchCompany">-->
<!-- </table>-->
<!-- <table tableName="branch_company_stock_info" domainObjectName="BranchCompanyStockInfo"></table>-->
<!-- <table tableName="branch_company_stock_apply_info" domainObjectName="BranchCompanyStockApplyInfo"></table>-->
<table
tableName=
"vehicle_upkeep_item"
domainObjectName=
"VehicleUpkeepItem"
></table>
<table
tableName=
"vehicle_upkeep_log"
domainObjectName=
"VehicleUpkeepLog"
></table>
</context>
</generatorConfiguration>
\ No newline at end of file
xx-app/xx-app-server/src/main/resources/mapper/CofigMapper.xml
0 → 100644
View file @
85f0800a
<?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.xxfc.platform.app.mapper.CofigMapper"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.xxfc.platform.app.entity.Cofig"
id=
"cofigMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"value"
column=
"value"
/>
<result
property=
"crtTime"
column=
"crt_time"
/>
<result
property=
"updTime"
column=
"upd_time"
/>
<result
property=
"isDel"
column=
"is_del"
/>
</resultMap>
<select
id=
"getAllByType"
resultMap=
"cofigMap"
>
select * from config
<where>
<if
test=
"typeList!= null and typeList.size() > 0"
>
type IN
<foreach
collection=
"typeList"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</where>
</select>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment