Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
com.hdp.customerservice
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘文胜
com.hdp.customerservice
Commits
4354f368
Commit
4354f368
authored
Jun 17, 2015
by
刘文胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
111111111111
parent
c7de1137
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
5 deletions
+40
-5
Subscriber.java
src/main/java/com/hdp/pi/wechat/Subscriber.java
+5
-3
WechatMessageDTO.java
src/main/java/com/hdp/pi/wechat/dto/WechatMessageDTO.java
+29
-0
MessageHandler.java
src/main/java/com/hdp/pi/wechat/handler/MessageHandler.java
+1
-1
BaseEntity.java
src/main/java/com/hdp/pi/wechat/model/BaseEntity.java
+5
-1
No files found.
src/main/java/com/hdp/pi/wechat/Subscriber.java
View file @
4354f368
...
...
@@ -5,6 +5,8 @@ import org.dom4j.DocumentException;
import
org.dom4j.DocumentHelper
;
import
org.dom4j.Node
;
import
com.alibaba.fastjson.JSONObject
;
import
com.hdp.pi.wechat.dto.WechatMessageDTO
;
import
com.hdp.pi.wechat.handler.*
;
import
java.util.concurrent.ConcurrentHashMap
;
...
...
@@ -24,12 +26,12 @@ public class Subscriber {
handlers
.
put
(
"location"
,
new
LocationHandler
());
}
public
boolean
receiveMessage
(
String
message
)
{
String
type
=
""
;
boolean
result
=
Boolean
.
TRUE
;
try
{
type
=
getMsgType
(
message
);
WechatMessageDTO
wm
=
JSONObject
.
parseObject
(
message
,
WechatMessageDTO
.
class
);
String
type
=
getMsgType
(
wm
.
content
);
MessageHandler
handler
=
handlers
.
get
(
type
);
result
=
null
!=
handler
&&
handler
.
onMessage
(
type
,
message
);
result
=
null
!=
handler
&&
handler
.
onMessage
(
type
,
wm
.
entCode
,
wm
.
appId
,
wm
.
content
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
src/main/java/com/hdp/pi/wechat/dto/WechatMessageDTO.java
0 → 100644
View file @
4354f368
/**
* @Title: WechatMessageDTO.java
* @Package com.hdp.pi.wechat
* @Description: TODO
* @author new12304508_163_com
* @date 2015年6月17日 下午4:45:22
* @version V1.0
*/
package
com
.
hdp
.
pi
.
wechat
.
dto
;
import
com.alibaba.fastjson.annotation.JSONField
;
public
class
WechatMessageDTO
{
/**
* @Title: WechatMessageDTO.java
* @Package com.hdp.pi.wechat
* @Description: TODO
* @author new12304508_163_com
* @date 2015年6月17日 下午4:45:22
* @version V1.0
*/
@JSONField
(
name
=
"ent_code"
)
public
Integer
entCode
;
public
String
appId
;
public
String
content
;
}
src/main/java/com/hdp/pi/wechat/handler/MessageHandler.java
View file @
4354f368
...
...
@@ -46,7 +46,7 @@ public abstract class MessageHandler {
*通用的消息处理
* @throws Exception
**/
public
boolean
onMessage
(
String
msgType
,
String
message
)
throws
Exception
{
public
boolean
onMessage
(
String
msgType
,
Integer
entCode
,
String
appId
,
String
message
)
throws
Exception
{
if
(
""
.
equals
(
message
)){
return
false
;
}
...
...
src/main/java/com/hdp/pi/wechat/model/BaseEntity.java
View file @
4354f368
...
...
@@ -7,7 +7,11 @@ import java.util.Date;
* Created by Veal on 2015/5/13.
*/
public
abstract
class
BaseEntity
implements
Serializable
{
public
Integer
entCode
;
public
String
appId
;
public
String
msgType
;
public
String
openId
;
...
...
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