Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
payment
Project
Project
Details
Activity
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
曲欣亮
payment
Commits
289081f9
Commit
289081f9
authored
Aug 06, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
第一次提交
parents
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
486 additions
and
0 deletions
+486
-0
.gitignore
.gitignore
+5
-0
pom.xml
pom.xml
+108
-0
PaymentApplication.java
src/main/java/cn/ossip/payment/PaymentApplication.java
+40
-0
DataSourceConfig.java
src/main/java/cn/ossip/payment/config/DataSourceConfig.java
+44
-0
ExceptionHandler.java
src/main/java/cn/ossip/payment/config/ExceptionHandler.java
+38
-0
SwaggerConfig.java
src/main/java/cn/ossip/payment/config/SwaggerConfig.java
+35
-0
WebMvcConfig.java
src/main/java/cn/ossip/payment/config/WebMvcConfig.java
+57
-0
XException.java
src/main/java/cn/ossip/payment/config/XException.java
+43
-0
application-dev.properties
src/main/resources/application-dev.properties
+22
-0
application-pro.properties
src/main/resources/application-pro.properties
+21
-0
application-test.properties
src/main/resources/application-test.properties
+21
-0
application.properties
src/main/resources/application.properties
+2
-0
ehcache.xml
src/main/resources/ehcache.xml
+14
-0
logback.xml
src/main/resources/logback.xml
+36
-0
No files found.
.gitignore
0 → 100644
View file @
289081f9
/target/
/.settings/
.classpath
.project
\ No newline at end of file
pom.xml
0 → 100644
View file @
289081f9
<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>
<groupId>
com.egolm
</groupId>
<artifactId>
payment
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<description>
支付管理
</description>
<properties>
<start-class>
com.egolm.payment.PaymentApplication
</start-class>
</properties>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
1.5.9.RELEASE
</version>
</parent>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<dependency>
<groupId>
com.microsoft.sqlserver
</groupId>
<artifactId>
sqljdbc4
</artifactId>
<version>
4.0
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
1.2.38
</version>
</dependency>
<dependency>
<groupId>
com.egolm
</groupId>
<artifactId>
common
</artifactId>
<version>
0.0.1-RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid
</artifactId>
<version>
1.1.6
</version>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<version>
2.6.1
</version>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<version>
2.6.1
</version>
</dependency>
<dependency>
<groupId>
net.sf.ehcache
</groupId>
<artifactId>
ehcache
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
1.8
</source>
<target>
1.8
</target>
</configuration>
</plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<mainClass>
${start-class}
</mainClass>
<layout>
ZIP
</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>
my
</id>
<name>
my
</name>
<url>
http://git.egolm.com:9003/nexus/content/groups/public/
</url>
</repository>
<repository>
<id>
repo1
</id>
<name>
repo1
</name>
<url>
http://repo1.maven.org/maven2/
</url>
</repository>
<repository>
<id>
mvnrepository
</id>
<name>
mvnrepository
</name>
<url>
http://mvnrepository.com/
</url>
</repository>
</repositories>
</project>
\ No newline at end of file
src/main/java/cn/ossip/payment/PaymentApplication.java
0 → 100644
View file @
289081f9
package
cn
.
ossip
.
payment
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
@EnableCaching
@EnableSwagger2
@SpringBootApplication
@EnableTransactionManagement
public
class
PaymentApplication
{
private
static
ApplicationContext
applicationContext
;
public
static
void
main
(
String
[]
args
)
{
applicationContext
=
SpringApplication
.
run
(
PaymentApplication
.
class
,
args
);
}
public
static
ApplicationContext
getApplicationContext
()
{
return
applicationContext
;
}
public
static
Object
getBean
(
String
name
){
return
getApplicationContext
().
getBean
(
name
);
}
public
static
<
T
>
T
getBean
(
Class
<
T
>
clazz
){
return
getApplicationContext
().
getBean
(
clazz
);
}
public
static
<
T
>
T
getBean
(
String
name
,
Class
<
T
>
clazz
){
return
getApplicationContext
().
getBean
(
name
,
clazz
);
}
}
src/main/java/cn/ossip/payment/config/DataSourceConfig.java
0 → 100644
View file @
289081f9
package
cn
.
ossip
.
payment
.
config
;
import
javax.sql.DataSource
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
org.springframework.transaction.PlatformTransactionManager
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.dialect.MySqlDialect
;
@Configuration
public
class
DataSourceConfig
{
@Bean
@Primary
@ConfigurationProperties
(
prefix
=
"spring.datasource"
)
public
DataSource
getDataSource
()
{
return
DataSourceBuilder
.
create
().
type
(
DruidDataSource
.
class
).
build
();
}
@Bean
@Primary
public
PlatformTransactionManager
getTransactionManager
(
DataSource
dataSource
)
{
return
new
DataSourceTransactionManager
(
dataSource
);
}
@Bean
@Primary
public
JdbcTemplate
getJdbcTemplate
(
DataSource
dataSource
)
{
JdbcTemplate
jdbcTemplate
=
new
JdbcTemplate
();
jdbcTemplate
.
setDataSource
(
dataSource
);
jdbcTemplate
.
setDialect
(
new
MySqlDialect
());
jdbcTemplate
.
setSql_level
(
3
);
return
jdbcTemplate
;
}
}
\ No newline at end of file
src/main/java/cn/ossip/payment/config/ExceptionHandler.java
0 → 100644
View file @
289081f9
package
cn
.
ossip
.
payment
.
config
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.servlet.HandlerExceptionResolver
;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.servlet.view.json.MappingJackson2JsonView
;
import
com.egolm.common.bean.Rjx
;
@Component
public
class
ExceptionHandler
implements
HandlerExceptionResolver
{
private
static
final
Log
logger
=
LogFactory
.
getLog
(
ExceptionHandler
.
class
);
@Override
public
ModelAndView
resolveException
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
Exception
ex
)
{
ModelAndView
mav
=
new
ModelAndView
(
new
MappingJackson2JsonView
());
try
{
response
.
setContentType
(
"application/json"
);
if
(
ex
instanceof
XException
)
{
mav
.
addAllObjects
(((
XException
)
ex
).
getRjx
());
}
else
{
mav
.
addAllObjects
(
Rjx
.
jsonErr
().
setMessage
(
"未处理异常["
+
ex
.
getClass
().
getName
()
+
":"
+
ex
.
getMessage
()
+
"]"
));
}
}
catch
(
Exception
e
)
{
mav
.
addAllObjects
(
Rjx
.
jsonErr
().
setMessage
(
"异常处理失败"
));
}
finally
{
logger
.
error
(
""
,
ex
);
}
return
mav
;
}
}
src/main/java/cn/ossip/payment/config/SwaggerConfig.java
0 → 100644
View file @
289081f9
package
cn
.
ossip
.
payment
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
import
springfox.documentation.service.ApiInfo
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spring.web.plugins.Docket
;
@Configuration
public
class
SwaggerConfig
{
@Bean
public
Docket
createRestApi
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
apiInfo
(
apiInfo
())
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.egolm.msc"
))
.
paths
(
PathSelectors
.
any
())
.
build
();
}
private
ApiInfo
apiInfo
()
{
return
new
ApiInfoBuilder
()
.
title
(
"MessageCenter在线文档"
)
.
description
(
"MessageCenter在线文档"
)
.
termsOfServiceUrl
(
"NO terms of service"
)
.
version
(
"1.0"
)
.
build
();
}
}
src/main/java/cn/ossip/payment/config/WebMvcConfig.java
0 → 100644
View file @
289081f9
package
cn
.
ossip
.
payment
.
config
;
import
java.util.EventListener
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
import
org.springframework.boot.web.servlet.ServletListenerRegistrationBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.RequestContextListener
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.servlet.config.annotation.PathMatchConfigurer
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
;
@Configuration
public
class
WebMvcConfig
extends
WebMvcConfigurerAdapter
{
@Override
public
void
configurePathMatch
(
PathMatchConfigurer
configurer
)
{
configurer
.
setUseSuffixPatternMatch
(
false
).
setUseTrailingSlashMatch
(
false
);
}
@Bean
public
ServletListenerRegistrationBean
<
EventListener
>
getDemoListener
(){
ServletListenerRegistrationBean
<
EventListener
>
registrationBean
=
new
ServletListenerRegistrationBean
<>();
registrationBean
.
setListener
(
new
RequestContextListener
());
return
registrationBean
;
}
public
static
HttpServletRequest
getRequest
()
{
ServletRequestAttributes
servletRequestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
if
(
servletRequestAttributes
!=
null
)
{
return
servletRequestAttributes
.
getRequest
();
}
return
null
;
}
public
static
HttpServletResponse
getResponse
()
{
ServletRequestAttributes
servletRequestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
if
(
servletRequestAttributes
!=
null
)
{
return
servletRequestAttributes
.
getResponse
();
}
return
null
;
}
public
static
HttpSession
getSession
()
{
HttpServletRequest
request
=
WebMvcConfig
.
getRequest
();
if
(
request
!=
null
)
{
return
request
.
getSession
();
}
return
null
;
}
}
src/main/java/cn/ossip/payment/config/XException.java
0 → 100644
View file @
289081f9
package
cn
.
ossip
.
payment
.
config
;
import
com.egolm.common.bean.Rjx
;
public
class
XException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
1L
;
private
Rjx
rjx
=
Rjx
.
jsonErr
().
setStatus
(
500
).
setMessage
(
"ERROR"
);
public
XException
(
String
msg
)
{
super
(
msg
);
rjx
.
setMessage
(
msg
);
}
public
XException
(
String
msg
,
Throwable
e
)
{
super
(
msg
,
e
);
rjx
.
setMessage
(
msg
);
}
public
XException
(
String
msg
,
int
code
)
{
super
(
msg
);
rjx
.
setMessage
(
msg
);
rjx
.
setStatus
(
code
);
}
public
XException
(
String
msg
,
int
code
,
Throwable
e
)
{
super
(
msg
,
e
);
rjx
.
setMessage
(
msg
);
rjx
.
setStatus
(
code
);
}
public
Rjx
getRjx
()
{
return
rjx
;
}
public
static
void
assertNotBlank
(
Object
obj
,
String
message
)
{
if
(
obj
==
null
||
obj
.
toString
().
trim
().
equals
(
""
))
{
throw
new
XException
((
message
==
null
||
message
.
trim
().
equals
(
""
))
?
"对象不能为空"
:
message
);
}
}
}
src/main/resources/application-dev.properties
0 → 100644
View file @
289081f9
server.tomcat.max-threads
=
1000
server.tomcat.min-spare-threads
=
30
server.port
=
8086
server.context-path
=
/
server.session.timeout
=
90000
server.tomcat.uri-encoding
=
utf-8
spring.http.multipart.maxFileSize
=
5MB
spring.http.multipart.maxRequestSize
=
5MB
spring.http.encoding.force
=
true
spring.http.encoding.enabled
=
true
spring.http.encoding.charset
=
utf-8
spring.datasource.username
=
sa
spring.datasource.password
=
qiyang
spring.datasource.url
=
jdbc:sqlserver://10.10.0.51:56443;instanceName=SQLSERVER;DatabaseName=EGOLMSAAS
spring.datasource.driver-class-name
=
com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.testWhileIdle
=
true
spring.datasource.validationQuery
=
SELECT 1
spring.datasource.timeBetweenEvictionRunsMillis
=
3600000
\ No newline at end of file
src/main/resources/application-pro.properties
0 → 100644
View file @
289081f9
server.tomcat.max-threads
=
1000
server.tomcat.min-spare-threads
=
30
server.port
=
8086
server.context-path
=
/
server.session.timeout
=
90000
server.tomcat.uri-encoding
=
utf-8
spring.http.multipart.maxFileSize
=
5MB
spring.http.multipart.maxRequestSize
=
5MB
spring.http.encoding.force
=
true
spring.http.encoding.enabled
=
true
spring.http.encoding.charset
=
utf-8
spring.datasource.username
=
sa
spring.datasource.password
=
qiyang
spring.datasource.url
=
jdbc:sqlserver://10.10.0.51:56443;instanceName=SQLSERVER;DatabaseName=EGOLMSAAS
spring.datasource.driver-class-name
=
com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.testWhileIdle
=
true
spring.datasource.validationQuery
=
SELECT 1
spring.datasource.timeBetweenEvictionRunsMillis
=
3600000
src/main/resources/application-test.properties
0 → 100644
View file @
289081f9
server.tomcat.max-threads
=
1000
server.tomcat.min-spare-threads
=
30
server.port
=
8086
server.context-path
=
/
server.session.timeout
=
90000
server.tomcat.uri-encoding
=
utf-8
spring.http.multipart.maxFileSize
=
5MB
spring.http.multipart.maxRequestSize
=
5MB
spring.http.encoding.force
=
true
spring.http.encoding.enabled
=
true
spring.http.encoding.charset
=
utf-8
spring.datasource.username
=
sa
spring.datasource.password
=
qiyang
spring.datasource.url
=
jdbc:sqlserver://10.10.0.51:56443;instanceName=SQLSERVER;DatabaseName=EGOLMSAAS
spring.datasource.driver-class-name
=
com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.testWhileIdle
=
true
spring.datasource.validationQuery
=
SELECT 1
spring.datasource.timeBetweenEvictionRunsMillis
=
3600000
src/main/resources/application.properties
0 → 100644
View file @
289081f9
spring.profiles.active
=
dev
\ No newline at end of file
src/main/resources/ehcache.xml
0 → 100644
View file @
289081f9
<?xml version="1.0" encoding="UTF-8"?>
<ehcache
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://ehcache.org/ehcache.xsd"
updateCheck=
"false"
>
<defaultCache
eternal=
"false"
maxElementsInMemory=
"1000"
overflowToDisk=
"false"
diskPersistent=
"false"
timeToIdleSeconds=
"0"
timeToLiveSeconds=
"600"
memoryStoreEvictionPolicy=
"LRU"
/>
</ehcache>
src/main/resources/logback.xml
0 → 100644
View file @
289081f9
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property
name=
"LOG_BASE_PATH"
value=
"/data/logs/payment"
/>
<include
resource=
"org/springframework/boot/logging/logback/base.xml"
/>
<logger
name=
"org"
level=
"INFO"
/>
<logger
name=
"com"
level=
"INFO"
/>
<logger
name=
"com.egolm"
level=
"DEBUG"
/>
<appender
name=
"siftingAppender"
class=
"ch.qos.logback.classic.sift.SiftingAppender"
>
<discriminator>
<key>
CTX_PATH
</key>
<DefaultValue>
payment
</DefaultValue>
</discriminator>
<sift>
<appender
name=
"rollingFileAppender"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${LOG_BASE_PATH}/${CTX_PATH}-%d{yyyy-MM-dd}.log
</FileNamePattern>
<MaxHistory>
30
</MaxHistory>
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<pattern>
${CONSOLE_LOG_PATTERN}
</pattern>
</encoder>
</appender>
</sift>
</appender>
<root
level=
"INFO"
>
<appender-ref
ref=
"siftingAppender"
/>
</root>
</configuration>
\ 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