Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Jeepay
Commits
390da586
Commit
390da586
authored
Aug 20, 2017
by
jmdhappy
Browse files
1. 升级spring boot版本为1.5.6
2. 修复通知业务系统bug
parent
202bbb59
Changes
39
Hide whitespace changes
Inline
Side-by-side
xxpay4spring-cloud/xxpay-config/pom.xml
View file @
390da586
...
...
@@ -7,22 +7,15 @@
<artifactId>
xxpay-config
</artifactId>
<version>
1.0.0
</version>
<packaging>
jar
</packaging>
<name>
xxpay-config
</name>
<description></description>
<description>
xxpay-config
</description>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
1.4.5.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
<groupId>
org.xxpay
</groupId>
<artifactId>
xxpay4spring-cloud
</artifactId>
<version>
1.0.0
</version>
</parent>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<java.version>
1.8
</java.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
...
...
@@ -32,24 +25,8 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-security
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-eureka-server
</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-dependencies
</artifactId>
<version>
Camden.RELEASE
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
...
...
xxpay4spring-cloud/xxpay-config/src/main/resources/application.yml
View file @
390da586
...
...
@@ -21,3 +21,6 @@ eureka:
serviceUrl
:
defaultZone
:
http://localhost:2000/eureka/
logging
:
file
:
./log/xxpay-config.log
xxpay4spring-cloud/xxpay-config/src/main/resources/shared/xxpay-service-dev.properties
View file @
390da586
# \u652F\u4ED8\u5B9D\u56DE\u8C03\u5730\u5740
ali.notify_url
=
http://xxpay.
ngrok.cc
/notify/pay/aliPayNotifyRes.htm
ali.notify_url
=
http://
api.
xxpay.
org
/notify/pay/aliPayNotifyRes.htm
# \u5FAE\u4FE1\u652F\u4ED8\u56DE\u8C03\u5730\u5740
wx.notify_url
=
http://xxpay.
ngrok.cc
/notify/pay/wxPayNotifyRes.htm
wx.notify_url
=
http://
api.
xxpay.
org
/notify/pay/wxPayNotifyRes.htm
# \u652F\u4ED8\u8BC1\u4E66\u6839\u8DEF\u5F84
cert.root.path
=
/Users/dingzhiwei/java/tmp/cert
\ No newline at end of file
xxpay4spring-cloud/xxpay-config/src/main/resources/shared/xxpay-service-prod.properties
View file @
390da586
# \u652F\u4ED8\u5B9D\u56DE\u8C03\u5730\u5740
ali.notify_url
=
http://api.xxpay.org/notify/aliPayNotifyRes.htm
ali.notify_url
=
http://api.xxpay.org/notify/
pay/
aliPayNotifyRes.htm
# \u5FAE\u4FE1\u652F\u4ED8\u56DE\u8C03\u5730\u5740
wx.notify_url
=
http://api.xxpay.org/notify/wxPayNotifyRes.htm
wx.notify_url
=
http://api.xxpay.org/notify/pay/wxPayNotifyRes.htm
# \u652F\u4ED8\u8BC1\u4E66\u6839\u8DEF\u5F84
cert.root.path
=
/Users/dingzhiwei/java/tmp/cert
\ No newline at end of file
xxpay4spring-cloud/xxpay-config/src/main/resources/shared/xxpay-service-test.properties
View file @
390da586
# \u652F\u4ED8\u5B9D\u56DE\u8C03\u5730\u5740
ali.notify_url
=
http://api.xxpay.org/notify/aliPayNotifyRes.htm
ali.notify_url
=
http://api.xxpay.org/notify/
pay/
aliPayNotifyRes.htm
# \u5FAE\u4FE1\u652F\u4ED8\u56DE\u8C03\u5730\u5740
wx.notify_url
=
http://api.xxpay.org/notify/wxPayNotifyRes.htm
wx.notify_url
=
http://api.xxpay.org/notify/pay/wxPayNotifyRes.htm
# \u652F\u4ED8\u8BC1\u4E66\u6839\u8DEF\u5F84
cert.root.path
=
/Users/dingzhiwei/java/tmp/cert
\ No newline at end of file
xxpay4spring-cloud/xxpay-config/src/main/resources/shared/xxpay-service.yml
View file @
390da586
...
...
@@ -22,17 +22,15 @@ spring:
maxPoolPreparedStatementPerConnectionSize
:
20
# 指定每个连接上PSCache的大小
filters
:
stat,wall,log4j
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
connectionProperties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
profiles
:
active
:
prod
activemq
:
broker-url
:
failover:(tcp://127.0.0.1:61616?wireFormat.maxInactivityDuration=0)
in-memory
:
true
pool
:
enabled
:
true
logging
:
file
:
./log/xxpay-service.log
ali
:
notify_url
:
http://xxpay.ngrok.cc/notify/pay/aliPayNotifyRes.htm
xxpay4spring-cloud/xxpay-gateway/pom.xml
View file @
390da586
...
...
@@ -7,80 +7,31 @@
<artifactId>
xxpay-gateway
</artifactId>
<version>
1.0.0
</version>
<packaging>
jar
</packaging>
<name>
xxpay-gateway
</name>
<description>
xxpay
4spring-cloud
</description>
<description>
xxpay
-gateway
</description>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
1.3.5.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
<groupId>
org.xxpay
</groupId>
<artifactId>
xxpay4spring-cloud
</artifactId>
<version>
1.0.0
</version>
</parent>
<dependencies>
<dependency>
<groupId>
org.xxpay
</groupId>
<artifactId>
xxpay-common
</artifactId>
<version>
1.0.0
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-zuul
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-config
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-eureka-server
</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-dependencies
</artifactId>
<version>
Brixton.RELEASE
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/package.xml</descriptor>
</descriptors>
<finalName>
${project.name}
</finalName>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>-->
</plugin>
</plugins>
</build>
...
...
xxpay4spring-cloud/xxpay-server/pom.xml
View file @
390da586
...
...
@@ -7,74 +7,31 @@
<artifactId>
xxpay-server
</artifactId>
<version>
1.0.0
</version>
<packaging>
jar
</packaging>
<name>
xxpay-server
</name>
<description>
xxpay
4spring-cloud
</description>
<description>
xxpay
-server
</description>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
1.3.5.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
<groupId>
org.xxpay
</groupId>
<artifactId>
xxpay4spring-cloud
</artifactId>
<version>
1.0.0
</version>
</parent>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<java.version>
1.8
</java.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-eureka-server
</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-dependencies
</artifactId>
<version>
Brixton.RELEASE
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/package.xml</descriptor>
</descriptors>
<finalName>
${project.name}
</finalName>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>-->
</plugin>
</plugins>
</build>
...
...
xxpay4spring-cloud/xxpay-service/pom.xml
View file @
390da586
...
...
@@ -7,22 +7,15 @@
<artifactId>
xxpay-service
</artifactId>
<version>
1.0.0
</version>
<packaging>
jar
</packaging>
<name>
xxpay-service
</name>
<description>
xxpay
4spring-cloud
</description>
<description>
xxpay
-service
</description>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
1.3.5.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
<groupId>
org.xxpay
</groupId>
<artifactId>
xxpay4spring-cloud
</artifactId>
<version>
1.0.0
</version>
</parent>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<java.version>
1.8
</java.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.xxpay
</groupId>
...
...
@@ -30,27 +23,16 @@
<version>
1.0.0
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-eureka
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-config
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
<artifactId>
spring-boot-starter-activemq
</artifactId>
</dependency>
<dependency>
<groupId>
org.mybatis.spring.boot
</groupId>
<artifactId>
mybatis-spring-boot-starter
</artifactId>
<version>
1.
1.1
</version>
<version>
1.
3.0
</version>
</dependency>
<!--微信支付依赖-->
<!--wx_pay-->
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpcore
</artifactId>
...
...
@@ -71,7 +53,7 @@
<artifactId>
xstream
</artifactId>
<version>
1.4.7
</version>
</dependency>
<!--alipay
依赖
-->
<!--ali
_
pay-->
<dependency>
<groupId>
commons-httpclient
</groupId>
<artifactId>
commons-httpclient
</artifactId>
...
...
@@ -82,68 +64,17 @@
<artifactId>
jaxen
</artifactId>
<version>
1.1.6
</version>
</dependency>
<!--activeMq-->
<!--<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-pool</artifactId>
<version>5.7.0</version>
</dependency>-->
<!-- SpringBoot ActiveMQ依赖 -->
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-jms
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.activemq
</groupId>
<artifactId>
activemq-client
</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-dependencies
</artifactId>
<version>
Brixton.RELEASE
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<finalName>
xxpay-service
</finalName>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/package.xml</descriptor>
</descriptors>
<finalName>
${project.name}
</finalName>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>-->
</plugin>
</plugins>
</build>
...
...
xxpay4spring-cloud/xxpay-service/src/main/assembly/package.xml
deleted
100644 → 0
View file @
202bbb59
<assembly>
<id>
bin
</id>
<!-- 最终打包成一个用于发布的zip文件 -->
<formats>
<format>
tar.gz
</format>
</formats>
<!-- Adds dependencies to zip package under lib directory -->
<dependencySets>
<dependencySet>
<!-- 不使用项目的artifact,第三方jar不要解压,打包进zip文件的lib目录 -->
<useProjectArtifact>
false
</useProjectArtifact>
<outputDirectory>
lib
</outputDirectory>
<unpack>
false
</unpack>
</dependencySet>
</dependencySets>
<fileSets>
<!-- 把项目相关的说明文件,打包进zip文件的根目录 -->
<fileSet>
<directory>
${project.basedir}
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
README*
</include>
<include>
LICENSE*
</include>
<include>
NOTICE*
</include>
</includes>
</fileSet>
<!-- 把项目的配置文件,打包进zip文件的config目录 -->
<!--<fileSet>
<directory>${project.basedir}/src/main/resources</directory>
<outputDirectory>classes</outputDirectory>
<includes>
<include>*.xml</include>
<include>*.properties</include>
</includes>
</fileSet>-->
<!-- 把项目的脚本文件目录( src/main/scripts )中的启动脚本文件,打包进zip文件的跟目录 -->
<fileSet>
<directory>
${project.build.scriptSourceDirectory}
</directory>
<outputDirectory>
bin
</outputDirectory>
<includes>
<include>
*.*
</include>
</includes>
</fileSet>
<!-- 把项目的脚本文件(除了启动脚本文件),打包进zip文件的script目录 -->
<fileSet>
<directory>
${project.build.scriptSourceDirectory}
</directory>
<outputDirectory></outputDirectory>
<includes>
<include>
startup.*
</include>
</includes>
</fileSet>
<!-- 把项目自己编译出来的jar文件,打包进zip文件的根目录 -->
<!--<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>-->
<fileSet>
<directory>
${project.build.outputDirectory}
</directory>
<outputDirectory>
classes
</outputDirectory>
<includes>
<include>
**/*.class
</include>
<include>
**/*.xml
</include>
<include>
**/*.properties
</include>
</includes>
</fileSet>
</fileSets>
</assembly>
\ No newline at end of file
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/XxPayServiceApplication.java
View file @
390da586
...
...
@@ -3,7 +3,6 @@ package org.xxpay;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.context.annotation.Configuration
;
/**
* @Description: xxpay支付核心服务,包括:各支付渠道接口,通知处理
...
...
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/channel/tencent/common/Configure.java
View file @
390da586
...
...
@@ -4,15 +4,12 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.cloud.context.config.annotation.RefreshScope
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Service
;
import
org.xxpay.common.constant.PayConstant
;
import
org.xxpay.common.util.IPUtility
;
import
org.xxpay.common.util.MyLog
;
import
org.xxpay.common.util.PropertiesFileUtil
;
import
java.io.File
;
import
java.util.Date
;
import
java.util.Map
;
/**
* User: rizenguo
...
...
@@ -30,14 +27,13 @@ public class Configure {
JSONObject
paramObj
=
JSON
.
parseObject
(
configParam
);
this
.
setMchID
(
paramObj
.
getString
(
"mchId"
));
this
.
setAppID
(
paramObj
.
getString
(
"appId"
));
this
.
setCertLocalPath
(
Configure
.
class
.
getClassLoader
().
getResource
(
paramObj
.
getString
(
"certLocalPath"
))
.
getPath
())
;
this
.
setCertLocalPath
(
certRootPath
+
File
.
separator
+
paramObj
.
getString
(
"certLocalPath"
));
this
.
setCertPassword
(
paramObj
.
getString
(
"certPassword"
));
this
.
setKey
(
paramObj
.
getString
(
"key"
));
this
.
setIp
(
IPUtility
.
getLocalIP
());
return
this
;
}
// 这个就是自己要保管好的私有Key了(切记只能放在自己的后台代码里,不能放在任何可能被看到源代码的客户端程序中)
// 每次自己Post数据给API的时候都要用这个key来对所有字段进行签名,生成的签名会放在Sign这个字段,API收到Post数据的时候也会用同样的签名算法对Post过来的数据进行签名和验证
// 收到API的返回的时候也要用这个key来对返回的数据算下签名,跟API的Sign数据进行比较,如果值不一致,有可能数据被第三方给篡改
...
...
@@ -65,6 +61,9 @@ public class Configure {
//机器IP
private
String
ip
;
@Value
(
"${cert.root.path}"
)
private
String
certRootPath
;
//以下是几个API的路径:
//1)被扫支付API
public
static
String
PAY_API
=
"https://api.mch.weixin.qq.com/pay/micropay"
;
...
...
xxpay4spring-cloud/xxpay-service/src/main/java/org/xxpay/service/mq/Mq4PayNotify.java
View file @
390da586
...
...
@@ -8,6 +8,7 @@ import org.springframework.jms.annotation.JmsListener;
import
org.springframework.jms.core.JmsTemplate
;
import
org.springframework.jms.core.MessageCreator
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
org.xxpay.common.util.MyLog
;
import
org.xxpay.service.service.PayOrderService
;
...
...
@@ -36,15 +37,15 @@ import java.util.Date;
@Component
public
class
Mq4PayNotify
{
@Autowired
private
JmsTemplate
jmsTemplate
;
@Autowired
private
Queue
payNotifyQueue
;
@Autowired
private
PayOrderService
payOrderService
;
@Autowired
private
JmsTemplate
jmsTemplate
;
private
static
final
MyLog
_log
=
MyLog
.
getLog
(
Mq4PayNotify
.
class
);
public
void
send
(
String
msg
)
{
...
...
@@ -156,6 +157,13 @@ public class Mq4PayNotify {
}
catch
(
Exception
e
)
{
_log
.
error
(
e
,
"修改订单状态为处理完成异常"
);
}
// 修改通知次数
try
{
int
result
=
payOrderService
.
updateNotify
(
orderId
);
_log
.
info
(
"修改payOrderId={},通知业务系统次数->{}"
,
orderId
,
result
==
1
?
"成功"
:
"失败"
);
}
catch
(
Exception
e
)
{
_log
.
error
(
e
,
"修改通知次数异常"
);
}
return
;
// 通知成功结束
}
else
{
// 通知失败,延时再通知
...
...
xxpay4spring-cloud/xxpay-service/src/main/scripts/service.sh
deleted
100755 → 0
View file @
202bbb59
#!/bin/sh
#
#该脚本为Linux下启动java程序的通用脚本。即可以作为开机自启动service脚本被调用,
#也可以作为启动java程序的独立脚本来使用。
#
#JDK所在路径
JAVA_HOME
=
"/usr/local/jdk/jdk1.8.0_121"
#Java程序所在的目录(classes的上一级目录)
APP_HOME
=
/home/xxpay/service/xxpay-service
#需要启动的Java主程序(main方法类)
APP_MAINCLASS
=
org.xxpay.XxPayServiceApplication
#拼凑完整的classpath参数,包括指定lib目录下所有的jar
CLASSPATH
=
$APP_HOME
/classes
for
i
in
"
$APP_HOME
"
/lib/
*
.jar
;
do
CLASSPATH
=
"
$CLASSPATH
"
:
"
$i
"
done
#java虚拟机启动参数
JAVA_OPTS
=
"-ms512m -mx512m -Xmn128m -Djava.awt.headless=true -XX:MaxPermSize=64m"
###################################
#(函数)判断程序是否已启动
#
#说明:
#使用JDK自带的JPS命令及grep命令组合,准确查找pid
#jps 加 l 参数,表示显示java的完整包路径
#使用awk,分割出pid ($1部分),及Java程序名称($2部分)
#当jps命令不可用时,使用: ps -ef | grep $APP_MAINCLASS | grep -v "grep" | awk '{print $2}' 代替
###################################
#初始化psid变量(全局)
psid
=
0
checkpid
()
{
javaps
=
`
$JAVA_HOME
/bin/jps
-l
|
grep
$APP_MAINCLASS
`
#javaps=`ps -ef | grep $APP_MAINCLASS | grep -v "grep" | awk '{print $2}'`
if
[
-n
"
$javaps
"
]
;
then
psid
=
`
echo
$javaps
|
awk
'{print $1}'
`
else
psid
=
0
fi
}
###################################
#(函数)启动程序
#
#说明:
#1. 首先调用checkpid函数,刷新$psid全局变量
#2. 如果程序已经启动($psid不等于0),则提示程序已启动
#3. 如果程序没有被启动,则执行启动命令行
#4. 启动命令执行后,再次调用checkpid函数
#5. 如果步骤4的结果能够确认程序的pid,则打印[OK],否则打印[Failed]
#注意:echo -n 表示打印字符后,不换行
#注意: "nohup 某命令 >/dev/null 2>&1 &" 的用法
###################################
start
()
{
checkpid
if
[
$psid
-ne
0
]
;
then
echo
"================================"
echo
"warn:
$APP_MAINCLASS
already started! (pid=
$psid
)"
echo
"================================"
else
echo
-n
"Starting
$APP_MAINCLASS
..."
# -DlogFn=active 指的是生产日志文件名为active
nohup
$JAVA_HOME
/bin/java
$JAVA_OPTS
-DlogFn
=
level
-classpath
$CLASSPATH
$APP_MAINCLASS
>
/dev/null 2>&1 &
checkpid
if
[
$psid
-ne
0
]
;
then
echo
"(pid=
$psid
) [OK]"
else
echo
"[Failed]"
fi
fi
}
###################################
#(函数)停止程序
#
#说明:
#1. 首先调用checkpid函数,刷新$psid全局变量
#2. 如果程序已经启动($psid不等于0),则开始执行停止,否则,提示程序未运行
#3. 使用kill -9 pid命令进行强制杀死进程
#4. 执行kill命令行紧接其后,马上查看上一句命令的返回值: $?
#5. 如果步骤4的结果$?等于0,则打印[OK],否则打印[Failed]
#6. 为了防止java程序被启动多次,这里增加反复检查进程,反复杀死的处理(递归调用stop)。
#注意:echo -n 表示打印字符后,不换行
#注意: 在shell编程中,"$?" 表示上一句命令或者一个函数的返回值
###################################
stop
()
{
checkpid
if
[
$psid
-ne
0
]
;
then
echo
-n
"Stopping
$APP_MAINCLASS
...(pid=
$psid
) "
kill
-9
$psid
if
[
$?
-eq
0
]
;
then
echo
"[OK]"
else
echo
"[Failed]"
fi
checkpid
if
[
$psid
-ne
0
]
;
then
stop
fi
else
echo
"================================"
echo
"warn:
$APP_MAINCLASS
is not running"
echo
"================================"
fi
}
###################################
#(函数)检查程序运行状态
#
#说明:
#1. 首先调用checkpid函数,刷新$psid全局变量
#2. 如果程序已经启动($psid不等于0),则提示正在运行并表示出pid
#3. 否则,提示程序未运行
###################################
status
()
{
checkpid
if
[
$psid
-ne
0
]
;
then
echo
"
$APP_MAINCLASS
is running! (pid=
$psid
)"
else
echo
"
$APP_MAINCLASS
is not running"
fi
}
###################################
#(函数)打印系统环境参数
###################################
info
()
{
echo
"System Information:"
echo
"****************************"
echo
`
head
-n
1 /etc/issue
`
echo
`
uname
-a
`
echo
echo
"JAVA_HOME=
$JAVA_HOME
"
echo
`
$JAVA_HOME
/bin/java
-version
`
echo
echo
"APP_HOME=
$APP_HOME
"
echo
"APP_MAINCLASS=
$APP_MAINCLASS
"
echo
"****************************"
}
###################################
#读取脚本的第一个参数($1),进行判断
#参数取值范围:{start|stop|restart|status|info}
#如参数不在指定范围之内,则打印帮助信息
###################################
case
"
$1
"
in
'start'
)
start
;;
'stop'
)
stop
;;
'restart'
)
stop
start
;;
'status'
)
status
;;
'info'
)
info
;;
*
)
echo
"Usage:
$0
{start|stop|restart|status|info}"
exit
1
esac
exit
0
\ No newline at end of file
xxpay4spring-cloud/xxpay-service/src/test/java/org/xxpay/service/dal/ApplicationTests.java
View file @
390da586
...
...
@@ -3,15 +3,12 @@ package org.xxpay.service.dal;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.mock.web.MockServletContext
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.test.web.servlet.MockMvc
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringApplicationConfiguration
(
classes
=
MockServletContext
.
class
)
@WebAppConfiguration
public
class
ApplicationTests
{
...
...
xxpay4spring-cloud/xxpay-service/src/test/java/org/xxpay/service/dal/MchInfoTest.java
View file @
390da586
...
...
@@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.mock.web.MockServletContext
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.test.web.servlet.MockMvc
;
...
...
@@ -15,7 +13,6 @@ import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringApplicationConfiguration
(
classes
=
MockServletContext
.
class
)
@WebAppConfiguration
public
class
MchInfoTest
{
...
...
xxpay4spring-cloud/xxpay-service/src/test/java/org/xxpay/service/dal/PayOrderTest.java
View file @
390da586
...
...
@@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.mock.web.MockServletContext
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.test.web.servlet.MockMvc
;
...
...
@@ -15,7 +13,6 @@ import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringApplicationConfiguration
(
classes
=
MockServletContext
.
class
)
@WebAppConfiguration
public
class
PayOrderTest
{
...
...
xxpay4spring-cloud/xxpay-web/pom.xml
View file @
390da586
...
...
@@ -7,29 +7,21 @@
<artifactId>
xxpay-web
</artifactId>
<version>
1.0.0
</version>
<packaging>
jar
</packaging>
<name>
xxpay-web
</name>
<description>
xxpay
4spring-cloud
</description>
<description>
xxpay
-web
</description>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
1.3.5.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
<groupId>
org.xxpay
</groupId>
<artifactId>
xxpay4spring-cloud
</artifactId>
<version>
1.0.0
</version>
</parent>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<java.version>
1.8
</java.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.xxpay
</groupId>
<artifactId>
xxpay-common
</artifactId>
<version>
1.0.0
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-hystrix
</artifactId>
...
...
@@ -42,60 +34,17 @@
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-feign
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-config
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-eureka-server
</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-dependencies
</artifactId>
<version>
Brixton.RELEASE
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/package.xml</descriptor>
</descriptors>
<finalName>
${project.name}
</finalName>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>-->
</plugin>
</plugins>
</build>
...
...
xxpay4spring-cloud/xxpay-web/src/main/java/org/xxpay/web/controller/PayOrderController.java
View file @
390da586
...
...
@@ -55,7 +55,7 @@ public class PayOrderController {
* @param params
* @return
*/
@RequestMapping
(
value
=
"/pay/create_order"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/pay/create_order"
)
public
String
payOrder
(
@RequestParam
String
params
)
{
ServiceInstance
instance
=
client
.
getLocalServiceInstance
();
_log
.
info
(
"###### 开始接收商户统一下单请求 ######"
);
...
...
@@ -243,16 +243,6 @@ public class PayOrderController {
return
payOrder
;
}
/*String makeRetData(Map retMap) {
if(retMap.get(PayConstant.RETURN_PARAM_RETCODE).equals(PayConstant.RETURN_VALUE_SUCCESS)) {
String repKey = "Hpcl522AV6q613KIi46u6g6XuW8vM1N8bFgyv769770MdYe9u37M4y7rIpl8";
String sign = PayDigestUtil.getSign(retMap, repKey, "payParams");
retMap.put(PayConstant.RESULT_PARAM_SIGN, sign);
}
_log.info("生成响应数据:{}", retMap);
return JSON.toJSONString(retMap);
}*/
String
getJsonParam
(
String
[]
names
,
Object
[]
values
)
{
JSONObject
jsonParam
=
new
JSONObject
();
for
(
int
i
=
0
;
i
<
names
.
length
;
i
++)
{
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
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