Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
huhu-partner
Project
Overview
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guanchen
huhu-partner
Commits
b62b8f24
Commit
b62b8f24
authored
Jun 27, 2019
by
guanchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新errorCode 打war包
parent
1c2cd56d
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
73 deletions
+16
-73
pom.xml
pom.xml
+9
-6
AuthenticationInterceptor.java
...lanren/huhu/partner/config/AuthenticationInterceptor.java
+4
-4
CommonStatusConstant.java
...m/lanren/huhu/partner/constants/CommonStatusConstant.java
+0
-56
MessageCodeLoader.java
...va/com/lanren/huhu/partner/manager/MessageCodeLoader.java
+0
-4
Result.java
src/main/java/com/lanren/huhu/partner/result/Result.java
+2
-2
msg.properties
src/main/resources/conf/msg.properties
+1
-1
No files found.
pom.xml
View file @
b62b8f24
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<version>
0.0.1-SNAPSHOT
</version>
<version>
0.0.1-SNAPSHOT
</version>
<name>
partner
</name>
<name>
partner
</name>
<description>
呼呼省钱合伙人相关服务
</description>
<description>
呼呼省钱合伙人相关服务
</description>
<packaging>
j
ar
</packaging>
<packaging>
w
ar
</packaging>
<properties>
<properties>
<java.version>
1.8
</java.version>
<java.version>
1.8
</java.version>
...
@@ -139,14 +139,16 @@
...
@@ -139,14 +139,16 @@
<properties>
<properties>
<profiles.active>
dev
</profiles.active>
<profiles.active>
dev
</profiles.active>
<mysql.server>
jdbc:mysql://10.9.121.204:3306/huhu
</mysql.server>
<mysql.server>
jdbc:mysql://10.9.121.204:3306/huhu
</mysql.server>
<mysql.username>
yanfa
</mysql.username>
<!--<mysql.username>yanfa</mysql.username>-->
<mysql.password>
cScdKw%ZKC1i$C!1uAz3Kg$c
</mysql.password>
<!--<mysql.password>cScdKw%ZKC1i$C!1uAz3Kg$c</mysql.password>-->
<mysql.username>
apihu
</mysql.username>
<mysql.password>
tqH9clYRAxZ@LV4x
</mysql.password>
<redis.host>
10.9.186.167
</redis.host>
<redis.host>
10.9.186.167
</redis.host>
<redis.password>
passwdredis
</redis.password>
<redis.password>
passwdredis
</redis.password>
<spring.profiles.active>
dev
</spring.profiles.active>
<spring.profiles.active>
dev
</spring.profiles.active>
<logfile_path>
./Users/housene/Documents/lanrenkeji/huhu-partner/data/logs/huhu/lanren
</logfile_path>
<logfile_path>
/Users/chen/Develop/workspace/partner/data/release/dev/logs
</logfile_path>
<!--<providers-path>/data/java/service</providers-path>-->
<!--<providers-path>/data/java/service</providers-path>-->
<providers-path>
/Users/
housene/Documents/lanrenkeji/huhu-
partner/data/release/dev
</providers-path>
<providers-path>
/Users/
chen/Develop/workspace/
partner/data/release/dev
</providers-path>
</properties>
</properties>
<!-- 默认是本地开发环境 -->
<!-- 默认是本地开发环境 -->
<activation>
<activation>
...
@@ -272,7 +274,8 @@
...
@@ -272,7 +274,8 @@
<if>
<if>
<equals
arg1=
"${project.packaging}"
arg2=
"war"
/>
<equals
arg1=
"${project.packaging}"
arg2=
"war"
/>
<then>
<then>
<copy
file=
"target/${project.artifactId}.${project.packaging}"
<!--<copy file="target/${project.artifactId}.${project.packaging}"-->
<copy
file=
"target/${project.artifactId}-${project.version}-bin.zip"
todir=
"${todir}"
/>
todir=
"${todir}"
/>
</then>
</then>
<else>
<else>
...
...
src/main/java/com/lanren/huhu/partner/config/AuthenticationInterceptor.java
View file @
b62b8f24
package
com
.
lanren
.
huhu
.
partner
.
config
;
package
com
.
lanren
.
huhu
.
partner
.
config
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.lanren.huhu.partner.
constants.CommonStatusConstant
;
import
com.lanren.huhu.partner.
util.MessageUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.method.HandlerMethod
;
...
@@ -40,10 +40,10 @@ public class AuthenticationInterceptor extends HandlerInterceptorAdapter {
...
@@ -40,10 +40,10 @@ public class AuthenticationInterceptor extends HandlerInterceptorAdapter {
private
void
returnMsg
(
HttpServletResponse
response
)
throws
IOException
{
private
void
returnMsg
(
HttpServletResponse
response
)
throws
IOException
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"code"
,
CommonStatusConstant
.
SESSION_TIMEOUT
.
getValue
()
);
map
.
put
(
"code"
,
410
);
map
.
put
(
"msg"
,
CommonStatusConstant
.
SESSION_TIMEOUT
.
getDesc
(
));
map
.
put
(
"msg"
,
MessageUtil
.
getMsg
(
410
));
response
.
setHeader
(
"Content-type"
,
"application/json;charset=UTF-8"
);
response
.
setHeader
(
"Content-type"
,
"application/json;charset=UTF-8"
);
logger
.
info
(
"msg :{}"
,
CommonStatusConstant
.
SESSION_TIMEOUT
.
getDesc
(
));
logger
.
info
(
"msg :{}"
,
MessageUtil
.
getMsg
(
410
));
response
.
getWriter
().
write
(
JSON
.
toJSONString
(
map
));
response
.
getWriter
().
write
(
JSON
.
toJSONString
(
map
));
}
}
}
}
src/main/java/com/lanren/huhu/partner/constants/CommonStatusConstant.java
deleted
100755 → 0
View file @
1c2cd56d
package
com
.
lanren
.
huhu
.
partner
.
constants
;
/**
* 改为枚举值定义
* 由于子项目的代码从10001开始,为避免重复,当前状态码应小于10000。
* MessageCodeLoader初始化时默认先加载当前枚举,然后加载msg.properties配置(实现继承关系:子项目不用再重复定义CommonStatus中已有的状态码)。
* 为避免子项目状态码重复,父类如已经定义,MessageCodeLoader不再加载子项目定义的冲突状态码(CommonStatus优先)。
*
* @author houseme
* @see com.lanren.huhu.partner.manager
* <p>
* <p>
* <p>
* 约定规则
* provider业务代码都应该在这里定义
* consumer业务代码在msg.properties定义
*/
public
enum
CommonStatusConstant
{
OK
(
200
,
"成功!"
),
CREATED
(
201
,
"已经创建!"
),
DEFAULT_BIZ_ERROR
(
202
,
"业务异常!(此处应该被具体业务代码重写)"
),
BAD_REQUEST
(
400
,
"请求失效,请稍后再试!"
),
UNAUTHORIZED
(
401
,
"未经授权的操作,请联系系统管理员!"
),
NOT_FOUND
(
404
,
"未找到资源,请稍后再试!"
),
METHOD_NOT_ALLOWED
(
405
,
"该方法禁止调用,请联系系统管理员!"
),
CONFLICT
(
409
,
"操作冲突,请稍后再试!"
),
SESSION_TIMEOUT
(
410
,
"用户信息超时,请重新登录!"
),
LOGIN_FAILD
(
411
,
"用户名或密码错误!"
),
SESSION_REFRESH
(
412
,
"Token Refreshed"
),
INVALID_PARAMETER
(
450
,
"参数验证未通过!"
),
PERMISSION_DENIED
(
452
,
"权限拒绝,请联系系统管理员!"
),
INTERNAL_SERVER_ERROR
(
500
,
"服务器内部异常,请稍后再试!"
),
NO_REPLY
(
558
,
"服务器无应答,请稍后再试!!"
),
UNCATCHED_EXCEPTION
(
553
,
"未捕获的异常,请稍后再试!"
),
ENTITY_NOT_FOUNT
(
601
,
"数据未找到,请稍后再试!"
);
private
Integer
value
;
private
String
desc
;
private
CommonStatusConstant
(
Integer
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
Integer
getValue
()
{
return
value
;
}
public
String
getDesc
()
{
return
desc
;
}
}
src/main/java/com/lanren/huhu/partner/manager/MessageCodeLoader.java
View file @
b62b8f24
package
com
.
lanren
.
huhu
.
partner
.
manager
;
package
com
.
lanren
.
huhu
.
partner
.
manager
;
import
com.lanren.huhu.partner.constants.CommonStatusConstant
;
import
com.lanren.huhu.partner.util.MessageUtil
;
import
com.lanren.huhu.partner.util.MessageUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -19,7 +18,6 @@ import java.util.Properties;
...
@@ -19,7 +18,6 @@ import java.util.Properties;
* 部分业务代码依赖CommonStatusConstant
* 部分业务代码依赖CommonStatusConstant
*
*
* @author houseme
* @author houseme
* @see com.lanren.huhu.partner.constants.CommonStatusConstant
*/
*/
@Component
@Component
public
class
MessageCodeLoader
{
public
class
MessageCodeLoader
{
...
@@ -37,8 +35,6 @@ public class MessageCodeLoader {
...
@@ -37,8 +35,6 @@ public class MessageCodeLoader {
try
{
try
{
Properties
p
=
new
Properties
();
Properties
p
=
new
Properties
();
p
.
load
(
this
.
getClass
().
getClassLoader
().
getResourceAsStream
(
resource
));
p
.
load
(
this
.
getClass
().
getClassLoader
().
getResourceAsStream
(
resource
));
Map
<
Integer
,
String
>
comm_code
=
toMap
(
CommonStatusConstant
.
class
);
MessageUtil
.
putAll
(
comm_code
);
for
(
Object
obj
:
p
.
keySet
())
{
for
(
Object
obj
:
p
.
keySet
())
{
MessageUtil
.
put
(
Integer
.
parseInt
(
obj
.
toString
()),
p
.
getProperty
(
obj
.
toString
()));
MessageUtil
.
put
(
Integer
.
parseInt
(
obj
.
toString
()),
p
.
getProperty
(
obj
.
toString
()));
}
}
...
...
src/main/java/com/lanren/huhu/partner/result/Result.java
View file @
b62b8f24
...
@@ -18,13 +18,13 @@ public class Result<T> {
...
@@ -18,13 +18,13 @@ public class Result<T> {
private
Long
time
;
private
Long
time
;
public
Result
()
{
public
Result
()
{
this
.
code
=
20
0
;
this
.
code
=
0
;
this
.
message
=
MessageUtil
.
getMsg
(
code
);
this
.
message
=
MessageUtil
.
getMsg
(
code
);
this
.
time
=
System
.
currentTimeMillis
();
this
.
time
=
System
.
currentTimeMillis
();
}
}
public
Result
(
T
data
)
{
public
Result
(
T
data
)
{
this
.
code
=
20
0
;
this
.
code
=
0
;
this
.
message
=
MessageUtil
.
getMsg
(
code
);
this
.
message
=
MessageUtil
.
getMsg
(
code
);
this
.
data
=
data
;
this
.
data
=
data
;
this
.
time
=
System
.
currentTimeMillis
();
this
.
time
=
System
.
currentTimeMillis
();
...
...
src/main/resources/conf/msg.properties
View file @
b62b8f24
20
0
=
\u6210\u
529F
0
=
\u6210\u
529F
201
=
\u
5DF2
\u
7ECF
\u
521B
\u
5EFA
201
=
\u
5DF2
\u
7ECF
\u
521B
\u
5EFA
202
=
\u
4E1A
\u
52A1
\u
5F02
\u
5E38
\u
FF01
\u
FF08
\u
6B64
\u5904\u
5E94
\u
8BE5
\u
88AB
\u5177\u
4F53
\u
4E1A
\u
52A1
\u
4EE3
\u7801\u
91CD
\u5199\u
FF09
202
=
\u
4E1A
\u
52A1
\u
5F02
\u
5E38
\u
FF01
\u
FF08
\u
6B64
\u5904\u
5E94
\u
8BE5
\u
88AB
\u5177\u
4F53
\u
4E1A
\u
52A1
\u
4EE3
\u7801\u
91CD
\u5199\u
FF09
400
=
\u
8BF7
\u
6C42
\u5931\u6548\u
FF0C
\u
8BF7
\u
7A0D
\u
540E
\u
518D
\u
8BD5
\u
FF01
400
=
\u
8BF7
\u
6C42
\u5931\u6548\u
FF0C
\u
8BF7
\u
7A0D
\u
540E
\u
518D
\u
8BD5
\u
FF01
...
...
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