From 9d2923edc929a42ae09e408d5d1c94c00f188fd6 Mon Sep 17 00:00:00 2001 From: BinaryWang Date: Fri, 8 Jul 2016 09:48:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84Demo=EF=BC=8C=E4=BF=9D?= =?UTF-8?q?=E8=AF=81=E5=85=B6=E4=B8=AD=E4=B8=80=E4=B8=AA=E5=85=AC=E4=BC=97?= =?UTF-8?q?=E5=8F=B7=E5=8F=AF=E4=BB=A5=E6=AD=A3=E5=B8=B8=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=EF=BC=8Cclose=20#7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/gzh1/Gzh1LocationHandler.java | 23 +++++++++++ .../spring/handler/gzh1/Gzh1MenuHadler.java | 23 +++++++++++ .../spring/handler/gzh1/Gzh1MsgHadler.java | 23 +++++++++++ .../handler/gzh1/Gzh1SubscribeHadler.java | 32 ++++++++++++++++ .../handler/gzh1/Gzh1UnSubscribeHadler.java | 23 +++++++++++ .../demo/spring/service/Gzh1WxService.java | 38 +++++++++++++------ 6 files changed, 150 insertions(+), 12 deletions(-) create mode 100644 weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1LocationHandler.java create mode 100644 weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1MenuHadler.java create mode 100644 weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1MsgHadler.java create mode 100644 weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1SubscribeHadler.java create mode 100644 weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1UnSubscribeHadler.java diff --git a/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1LocationHandler.java b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1LocationHandler.java new file mode 100644 index 00000000..efe4a727 --- /dev/null +++ b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1LocationHandler.java @@ -0,0 +1,23 @@ +package com.github.binarywang.demo.spring.handler.gzh1; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import com.github.binarywang.demo.spring.config.WxConfig; +import com.github.binarywang.demo.spring.config.WxGzh1Config; +import com.github.binarywang.demo.spring.handler.LocationHandler; + +@Component +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class Gzh1LocationHandler extends LocationHandler { + @Autowired + private WxGzh1Config wxConfig; + + @Override + protected WxConfig getWxConfig() { + return this.wxConfig; + } + +} diff --git a/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1MenuHadler.java b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1MenuHadler.java new file mode 100644 index 00000000..4368a604 --- /dev/null +++ b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1MenuHadler.java @@ -0,0 +1,23 @@ +package com.github.binarywang.demo.spring.handler.gzh1; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import com.github.binarywang.demo.spring.config.WxConfig; +import com.github.binarywang.demo.spring.config.WxGzh1Config; +import com.github.binarywang.demo.spring.handler.MenuHandler; + +@Component +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class Gzh1MenuHadler extends MenuHandler { + @Autowired + private WxGzh1Config wxConfig; + + @Override + protected WxConfig getWxConfig() { + return this.wxConfig; + } + +} diff --git a/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1MsgHadler.java b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1MsgHadler.java new file mode 100644 index 00000000..59ee6ae1 --- /dev/null +++ b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1MsgHadler.java @@ -0,0 +1,23 @@ +package com.github.binarywang.demo.spring.handler.gzh1; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import com.github.binarywang.demo.spring.config.WxConfig; +import com.github.binarywang.demo.spring.config.WxGzh1Config; +import com.github.binarywang.demo.spring.handler.MsgHandler; + +@Component +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class Gzh1MsgHadler extends MsgHandler { + @Autowired + private WxGzh1Config wxConfig; + + @Override + protected WxConfig getWxConfig() { + return this.wxConfig; + } + +} diff --git a/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1SubscribeHadler.java b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1SubscribeHadler.java new file mode 100644 index 00000000..cadfd1fa --- /dev/null +++ b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1SubscribeHadler.java @@ -0,0 +1,32 @@ +package com.github.binarywang.demo.spring.handler.gzh1; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import com.github.binarywang.demo.spring.config.WxConfig; +import com.github.binarywang.demo.spring.config.WxGzh1Config; +import com.github.binarywang.demo.spring.handler.SubscribeHandler; + +import me.chanjar.weixin.mp.bean.WxMpXmlMessage; +import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage; + +@Component +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class Gzh1SubscribeHadler extends SubscribeHandler { + @Autowired + private WxGzh1Config wxConfig; + + @Override + protected WxConfig getWxConfig() { + return this.wxConfig; + } + + @Override + protected WxMpXmlOutMessage handleSpecial(WxMpXmlMessage wxMessage) + throws Exception { + return null; + } + +} diff --git a/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1UnSubscribeHadler.java b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1UnSubscribeHadler.java new file mode 100644 index 00000000..a4e3a8ed --- /dev/null +++ b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1UnSubscribeHadler.java @@ -0,0 +1,23 @@ +package com.github.binarywang.demo.spring.handler.gzh1; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import com.github.binarywang.demo.spring.config.WxConfig; +import com.github.binarywang.demo.spring.config.WxGzh1Config; +import com.github.binarywang.demo.spring.handler.UnsubscribeHandler; + +@Component +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class Gzh1UnSubscribeHadler extends UnsubscribeHandler { + @Autowired + private WxGzh1Config wxConfig; + + @Override + protected WxConfig getWxConfig() { + return this.wxConfig; + } + +} diff --git a/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/service/Gzh1WxService.java b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/service/Gzh1WxService.java index 74e0e566..cd809951 100644 --- a/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/service/Gzh1WxService.java +++ b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/service/Gzh1WxService.java @@ -10,6 +10,11 @@ import com.github.binarywang.demo.spring.handler.MenuHandler; import com.github.binarywang.demo.spring.handler.MsgHandler; import com.github.binarywang.demo.spring.handler.SubscribeHandler; import com.github.binarywang.demo.spring.handler.UnsubscribeHandler; +import com.github.binarywang.demo.spring.handler.gzh1.Gzh1LocationHandler; +import com.github.binarywang.demo.spring.handler.gzh1.Gzh1MenuHadler; +import com.github.binarywang.demo.spring.handler.gzh1.Gzh1MsgHadler; +import com.github.binarywang.demo.spring.handler.gzh1.Gzh1SubscribeHadler; +import com.github.binarywang.demo.spring.handler.gzh1.Gzh1UnSubscribeHadler; /** * @@ -19,8 +24,23 @@ import com.github.binarywang.demo.spring.handler.UnsubscribeHandler; @Service public class Gzh1WxService extends BaseWxService { @Autowired - private WxGzh1Config wxConfig; + private WxGzh1Config wxConfig; + + @Autowired + private Gzh1LocationHandler locationHandler; + + @Autowired + private Gzh1MenuHadler menuHadler; + + @Autowired + private Gzh1MsgHadler msgHadler; + + @Autowired + private Gzh1UnSubscribeHadler unSubscribeHadler; + @Autowired + private Gzh1SubscribeHadler subscribeHadler; + @Override protected WxConfig getServerConfig() { return this.wxConfig; @@ -28,37 +48,31 @@ public class Gzh1WxService extends BaseWxService { @Override protected MenuHandler getMenuHandler() { - // TODO Auto-generated method stub - return null; + return this.menuHadler; } @Override protected SubscribeHandler getSubscribeHandler() { - // TODO Auto-generated method stub - return null; + return this.subscribeHadler; } @Override protected UnsubscribeHandler getUnsubscribeHandler() { - // TODO Auto-generated method stub - return null; + return this.unSubscribeHadler; } @Override protected AbstractHandler getLocationHandler() { - // TODO Auto-generated method stub - return null; + return this.locationHandler; } @Override protected MsgHandler getMsgHandler() { - // TODO Auto-generated method stub - return null; + return this.msgHadler; } @Override protected AbstractHandler getScanHandler() { - // TODO Auto-generated method stub return null; }