commit
a019d38c45
71 changed files with 6686 additions and 0 deletions
@ -0,0 +1,33 @@ |
||||
HELP.md |
||||
target/ |
||||
!.mvn/wrapper/maven-wrapper.jar |
||||
!**/src/main/**/target/ |
||||
!**/src/test/**/target/ |
||||
|
||||
### STS ### |
||||
.apt_generated |
||||
.classpath |
||||
.factorypath |
||||
.project |
||||
.settings |
||||
.springBeans |
||||
.sts4-cache |
||||
|
||||
### IntelliJ IDEA ### |
||||
.idea |
||||
*.iws |
||||
*.iml |
||||
*.ipr |
||||
|
||||
### NetBeans ### |
||||
/nbproject/private/ |
||||
/nbbuild/ |
||||
/dist/ |
||||
/nbdist/ |
||||
/.nb-gradle/ |
||||
build/ |
||||
!**/src/main/**/build/ |
||||
!**/src/test/**/build/ |
||||
|
||||
### VS Code ### |
||||
.vscode/ |
||||
Binary file not shown.
@ -0,0 +1,2 @@ |
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip |
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar |
||||
@ -0,0 +1,535 @@ |
||||
[15:02:41.242][org.apache.juli.logging.DirectJDKLog - log - 175] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.ExceptionInInitializerError] with root cause |
||||
java.lang.IllegalArgumentException: Directory couldn't be created: /wx-push-cache/wx-push-cache-data |
||||
at org.ehcache.impl.persistence.FileUtils.createLocationIfRequiredAndVerify(FileUtils.java:63) |
||||
at org.ehcache.impl.persistence.DefaultLocalPersistenceService.internalStart(DefaultLocalPersistenceService.java:85) |
||||
at org.ehcache.impl.persistence.DefaultLocalPersistenceService.start(DefaultLocalPersistenceService.java:75) |
||||
at org.ehcache.core.spi.ServiceLocator.startAllServices(ServiceLocator.java:128) |
||||
at org.ehcache.core.EhcacheManager.init(EhcacheManager.java:577) |
||||
at com.ynxbd.push.config.EhCacheConfig.initCacheManager(EhCacheConfig.java:45) |
||||
at com.ynxbd.push.config.EhCacheConfig.<clinit>(EhCacheConfig.java:36) |
||||
at WxCacheRequest.createAccessTokenCache(WxCacheHelper.java:27) |
||||
at WxCacheRequest.<clinit>(WxCacheHelper.java:16) |
||||
at com.ynxbd.push.httpRequest.tencent.WeChatDataRequest.getTemplateList(HttpWeChatDataHelper.java:38) |
||||
at com.ynxbd.push.httpRequest.tencent.WeChatDataRequest.getTemplateId(HttpWeChatDataHelper.java:43) |
||||
at com.ynxbd.push.controller.SendMessageController.templateMessageSend(SendMessageController.java:93) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) |
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) |
||||
at java.lang.reflect.Method.invoke(Method.java:498) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) |
||||
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) |
||||
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) |
||||
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) |
||||
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) |
||||
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) |
||||
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) |
||||
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) |
||||
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) |
||||
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) |
||||
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) |
||||
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) |
||||
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) |
||||
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) |
||||
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) |
||||
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) |
||||
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) |
||||
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) |
||||
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) |
||||
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) |
||||
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) |
||||
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) |
||||
at java.lang.Thread.run(Thread.java:748) |
||||
[15:08:40.062][WxCacheRequest - getWxAccessToken - 64] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:08:40.686][org.apache.juli.logging.DirectJDKLog - log - 175] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause |
||||
java.lang.NullPointerException: null |
||||
at com.ynxbd.push.httpRequest.tencent.WeChatDataRequest.getTemplateId(HttpWeChatDataHelper.java:43) |
||||
at com.ynxbd.push.controller.SendMessageController.templateMessageSend(SendMessageController.java:93) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) |
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) |
||||
at java.lang.reflect.Method.invoke(Method.java:498) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) |
||||
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) |
||||
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) |
||||
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) |
||||
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) |
||||
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) |
||||
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) |
||||
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) |
||||
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) |
||||
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) |
||||
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) |
||||
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) |
||||
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) |
||||
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) |
||||
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) |
||||
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) |
||||
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) |
||||
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) |
||||
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) |
||||
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) |
||||
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) |
||||
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) |
||||
at java.lang.Thread.run(Thread.java:748) |
||||
[15:40:37.894][WxCacheRequest - getWxAccessToken - 67] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:40:37.896][WxCacheRequest - getWxAccessToken - 72] 重试请求第1次 |
||||
[15:40:38.471][org.apache.juli.logging.DirectJDKLog - log - 175] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause |
||||
java.lang.NullPointerException: null |
||||
at com.ynxbd.push.httpRequest.tencent.WeChatDataRequest.getTemplateId(HttpWeChatDataHelper.java:43) |
||||
at com.ynxbd.push.controller.SendMessageController.templateMessageSend(SendMessageController.java:91) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) |
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) |
||||
at java.lang.reflect.Method.invoke(Method.java:498) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) |
||||
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) |
||||
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) |
||||
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) |
||||
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) |
||||
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) |
||||
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) |
||||
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) |
||||
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) |
||||
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) |
||||
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) |
||||
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) |
||||
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) |
||||
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) |
||||
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) |
||||
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) |
||||
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) |
||||
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) |
||||
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) |
||||
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) |
||||
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) |
||||
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) |
||||
at java.lang.Thread.run(Thread.java:748) |
||||
[15:44:09.611][WxCacheRequest - getWxAccessToken - 67] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:44:09.611][WxCacheRequest - getWxAccessToken - 72] 重试请求第1次 |
||||
[15:44:09.617][WxCacheRequest - getWxAccessToken - 67] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:44:09.617][WxCacheRequest - getWxAccessToken - 72] 重试请求第2次 |
||||
[15:44:09.622][WxCacheRequest - getWxAccessToken - 67] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:44:09.623][WxCacheRequest - getWxAccessToken - 72] 重试请求第3次 |
||||
[15:44:09.628][WxCacheRequest - getWxAccessToken - 67] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:44:09.628][WxCacheRequest - getWxAccessToken - 69] 多次请求后未获取到正确token,抛出异常 |
||||
[15:44:10.214][org.apache.juli.logging.DirectJDKLog - log - 175] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause |
||||
java.lang.NullPointerException: null |
||||
at com.ynxbd.push.httpRequest.tencent.WeChatDataRequest.getTemplateId(HttpWeChatDataHelper.java:43) |
||||
at com.ynxbd.push.controller.SendMessageController.templateMessageSend(SendMessageController.java:91) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) |
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) |
||||
at java.lang.reflect.Method.invoke(Method.java:498) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) |
||||
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) |
||||
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) |
||||
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) |
||||
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) |
||||
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) |
||||
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) |
||||
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) |
||||
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) |
||||
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) |
||||
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) |
||||
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) |
||||
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) |
||||
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) |
||||
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) |
||||
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) |
||||
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) |
||||
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) |
||||
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) |
||||
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) |
||||
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) |
||||
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) |
||||
at java.lang.Thread.run(Thread.java:748) |
||||
[15:44:35.211][WxCacheRequest - getWxAccessToken - 67] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:44:35.211][WxCacheRequest - getWxAccessToken - 69] 多次请求后未获取到正确token,抛出异常 |
||||
[15:44:35.293][org.apache.juli.logging.DirectJDKLog - log - 175] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause |
||||
java.lang.NullPointerException: null |
||||
at com.ynxbd.push.httpRequest.tencent.WeChatDataRequest.getTemplateId(HttpWeChatDataHelper.java:43) |
||||
at com.ynxbd.push.controller.SendMessageController.templateMessageSend(SendMessageController.java:91) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) |
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) |
||||
at java.lang.reflect.Method.invoke(Method.java:498) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) |
||||
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) |
||||
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) |
||||
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) |
||||
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) |
||||
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) |
||||
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) |
||||
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) |
||||
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) |
||||
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) |
||||
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) |
||||
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) |
||||
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) |
||||
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) |
||||
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) |
||||
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) |
||||
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) |
||||
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) |
||||
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) |
||||
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) |
||||
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) |
||||
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) |
||||
at java.lang.Thread.run(Thread.java:748) |
||||
[15:45:26.287][WxCacheRequest - getWxAccessToken - 68] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:45:26.289][WxCacheRequest - getWxAccessToken - 73] 重试请求第1次 |
||||
[15:45:26.294][WxCacheRequest - getWxAccessToken - 68] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:45:26.294][WxCacheRequest - getWxAccessToken - 73] 重试请求第2次 |
||||
[15:45:26.297][WxCacheRequest - getWxAccessToken - 68] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:45:26.297][WxCacheRequest - getWxAccessToken - 73] 重试请求第3次 |
||||
[15:45:26.301][WxCacheRequest - getWxAccessToken - 68] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:45:26.301][WxCacheRequest - getWxAccessToken - 70] 多次请求后未获取到正确token,抛出异常 |
||||
[15:45:26.911][org.apache.juli.logging.DirectJDKLog - log - 175] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause |
||||
java.lang.NullPointerException: null |
||||
at com.ynxbd.push.httpRequest.tencent.WeChatDataRequest.getTemplateId(HttpWeChatDataHelper.java:43) |
||||
at com.ynxbd.push.controller.SendMessageController.templateMessageSend(SendMessageController.java:91) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) |
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) |
||||
at java.lang.reflect.Method.invoke(Method.java:498) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) |
||||
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) |
||||
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) |
||||
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) |
||||
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) |
||||
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) |
||||
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) |
||||
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) |
||||
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) |
||||
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) |
||||
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) |
||||
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) |
||||
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) |
||||
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) |
||||
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) |
||||
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) |
||||
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) |
||||
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) |
||||
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) |
||||
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) |
||||
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) |
||||
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) |
||||
at java.lang.Thread.run(Thread.java:748) |
||||
[15:45:40.269][WxCacheRequest - getWxAccessToken - 68] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:45:40.271][WxCacheRequest - getWxAccessToken - 70] 多次请求后未获取到正确token,抛出异常 |
||||
[15:45:40.520][org.apache.juli.logging.DirectJDKLog - log - 175] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause |
||||
java.lang.NullPointerException: null |
||||
at com.ynxbd.push.httpRequest.tencent.WeChatDataRequest.getTemplateId(HttpWeChatDataHelper.java:43) |
||||
at com.ynxbd.push.controller.SendMessageController.templateMessageSend(SendMessageController.java:91) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) |
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) |
||||
at java.lang.reflect.Method.invoke(Method.java:498) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) |
||||
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) |
||||
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) |
||||
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) |
||||
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) |
||||
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) |
||||
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) |
||||
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) |
||||
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) |
||||
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) |
||||
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) |
||||
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) |
||||
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) |
||||
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) |
||||
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) |
||||
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) |
||||
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) |
||||
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) |
||||
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) |
||||
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) |
||||
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) |
||||
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) |
||||
at java.lang.Thread.run(Thread.java:748) |
||||
[15:47:11.309][WxCacheRequest - getWxAccessToken - 68] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:47:11.310][WxCacheRequest - getWxAccessToken - 73] 重试请求第1次 |
||||
[15:47:11.314][WxCacheRequest - getWxAccessToken - 68] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:47:11.314][WxCacheRequest - getWxAccessToken - 73] 重试请求第2次 |
||||
[15:47:11.316][WxCacheRequest - getWxAccessToken - 68] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:47:11.316][WxCacheRequest - getWxAccessToken - 73] 重试请求第3次 |
||||
[15:47:11.319][WxCacheRequest - getWxAccessToken - 68] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:47:11.319][WxCacheRequest - getWxAccessToken - 70] 多次请求后未获取到正确token,抛出异常 |
||||
[15:47:11.916][org.apache.juli.logging.DirectJDKLog - log - 175] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause |
||||
java.lang.NullPointerException: null |
||||
at com.ynxbd.push.httpRequest.tencent.WeChatDataRequest.getTemplateId(HttpWeChatDataHelper.java:43) |
||||
at com.ynxbd.push.controller.SendMessageController.templateMessageSend(SendMessageController.java:91) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) |
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) |
||||
at java.lang.reflect.Method.invoke(Method.java:498) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) |
||||
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) |
||||
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) |
||||
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) |
||||
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) |
||||
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) |
||||
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) |
||||
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) |
||||
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) |
||||
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) |
||||
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) |
||||
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) |
||||
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) |
||||
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) |
||||
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) |
||||
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) |
||||
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) |
||||
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) |
||||
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) |
||||
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) |
||||
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) |
||||
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) |
||||
at java.lang.Thread.run(Thread.java:748) |
||||
[15:47:21.788][WxCacheRequest - getWxAccessToken - 68] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:47:21.788][WxCacheRequest - getWxAccessToken - 73] 重试请求第1次 |
||||
[15:47:21.799][WxCacheRequest - getWxAccessToken - 68] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:47:21.799][WxCacheRequest - getWxAccessToken - 73] 重试请求第2次 |
||||
[15:47:21.810][WxCacheRequest - getWxAccessToken - 68] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:47:21.811][WxCacheRequest - getWxAccessToken - 73] 重试请求第3次 |
||||
[15:47:21.817][WxCacheRequest - getWxAccessToken - 68] 请求微信获取Token错误:I/O error on GET request for "http://127.0.0.1:8080/wx/api/getWxAccessToken.do": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) |
||||
[15:47:21.818][WxCacheRequest - getWxAccessToken - 70] 多次请求后未获取到正确token,抛出异常 |
||||
[15:47:21.890][org.apache.juli.logging.DirectJDKLog - log - 175] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause |
||||
java.lang.NullPointerException: null |
||||
at com.ynxbd.push.httpRequest.tencent.WeChatDataRequest.getTemplateId(HttpWeChatDataHelper.java:43) |
||||
at com.ynxbd.push.controller.SendMessageController.templateMessageSend(SendMessageController.java:91) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) |
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) |
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) |
||||
at java.lang.reflect.Method.invoke(Method.java:498) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) |
||||
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) |
||||
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) |
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) |
||||
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) |
||||
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) |
||||
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) |
||||
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) |
||||
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) |
||||
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) |
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) |
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) |
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) |
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) |
||||
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) |
||||
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) |
||||
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) |
||||
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) |
||||
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) |
||||
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) |
||||
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) |
||||
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) |
||||
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) |
||||
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) |
||||
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) |
||||
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) |
||||
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) |
||||
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) |
||||
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) |
||||
at java.lang.Thread.run(Thread.java:748) |
||||
@ -0,0 +1,357 @@ |
||||
[15:02:22.612][org.springframework.boot.StartupInfoLogger - logStarting - 55] Starting AppApplication on absorber.local with PID 63184 (/Users/absorber/Downloads/wx-push/target/classes started by absorber in /Users/absorber/Downloads/wx-push) |
||||
[15:02:22.614][org.springframework.boot.SpringApplication - logStartupProfileInfo - 651] No active profile set, falling back to default profiles: default |
||||
[15:02:23.864][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing ProtocolHandler ["http-nio-8123"] |
||||
[15:02:23.865][org.apache.juli.logging.DirectJDKLog - log - 173] Starting service [Tomcat] |
||||
[15:02:23.866][org.apache.juli.logging.DirectJDKLog - log - 173] Starting Servlet engine: [Apache Tomcat/9.0.36] |
||||
[15:02:23.922][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring embedded WebApplicationContext |
||||
[15:02:24.007][org.quartz.impl.StdSchedulerFactory - instantiate - 1220] Using default implementation for ThreadExecutor |
||||
[15:02:24.008][org.quartz.simpl.SimpleThreadPool - initialize - 268] Job execution threads will use class loader of thread: restartedMain |
||||
[15:02:24.013][org.quartz.core.SchedulerSignalerImpl - <init> - 61] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl |
||||
[15:02:24.014][org.quartz.core.QuartzScheduler - <init> - 229] Quartz Scheduler v.2.3.2 created. |
||||
[15:02:24.014][org.quartz.simpl.RAMJobStore - initialize - 155] RAMJobStore initialized. |
||||
[15:02:24.015][org.quartz.core.QuartzScheduler - initialize - 294] Scheduler meta-data: Quartz Scheduler (v2.3.2) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED' |
||||
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. |
||||
NOT STARTED. |
||||
Currently in standby mode. |
||||
Number of jobs executed: 0 |
||||
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. |
||||
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. |
||||
|
||||
[15:02:24.015][org.quartz.impl.StdSchedulerFactory - instantiate - 1374] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' |
||||
[15:02:24.015][org.quartz.impl.StdSchedulerFactory - instantiate - 1378] Quartz scheduler version: 2.3.2 |
||||
[15:02:24.317][org.apache.juli.logging.DirectJDKLog - log - 173] Starting ProtocolHandler ["http-nio-8123"] |
||||
[15:02:24.347][com.ynxbd.push.quartz.listener.AppStartQuartzJobListener - onApplicationEvent - 33] [<QUZRTZ DISPATCH>]Starting Quartz task ... |
||||
[15:02:24.352][org.quartz.core.QuartzScheduler - start - 547] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. |
||||
[15:02:24.355][org.springframework.boot.StartupInfoLogger - logStarted - 61] Started AppApplication in 2.14 seconds (JVM running for 3.266) |
||||
[15:02:40.528][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring DispatcherServlet 'dispatcherServlet' |
||||
[15:08:32.735][org.springframework.boot.StartupInfoLogger - logStarting - 55] Starting AppApplication on absorber.local with PID 63271 (/Users/absorber/Downloads/wx-push/target/classes started by absorber in /Users/absorber/Downloads/wx-push) |
||||
[15:08:32.740][org.springframework.boot.SpringApplication - logStartupProfileInfo - 651] No active profile set, falling back to default profiles: default |
||||
[15:08:33.872][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing ProtocolHandler ["http-nio-8123"] |
||||
[15:08:33.874][org.apache.juli.logging.DirectJDKLog - log - 173] Starting service [Tomcat] |
||||
[15:08:33.874][org.apache.juli.logging.DirectJDKLog - log - 173] Starting Servlet engine: [Apache Tomcat/9.0.36] |
||||
[15:08:33.926][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring embedded WebApplicationContext |
||||
[15:08:34.016][org.quartz.impl.StdSchedulerFactory - instantiate - 1220] Using default implementation for ThreadExecutor |
||||
[15:08:34.017][org.quartz.simpl.SimpleThreadPool - initialize - 268] Job execution threads will use class loader of thread: restartedMain |
||||
[15:08:34.022][org.quartz.core.SchedulerSignalerImpl - <init> - 61] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl |
||||
[15:08:34.022][org.quartz.core.QuartzScheduler - <init> - 229] Quartz Scheduler v.2.3.2 created. |
||||
[15:08:34.023][org.quartz.simpl.RAMJobStore - initialize - 155] RAMJobStore initialized. |
||||
[15:08:34.023][org.quartz.core.QuartzScheduler - initialize - 294] Scheduler meta-data: Quartz Scheduler (v2.3.2) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED' |
||||
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. |
||||
NOT STARTED. |
||||
Currently in standby mode. |
||||
Number of jobs executed: 0 |
||||
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. |
||||
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. |
||||
|
||||
[15:08:34.023][org.quartz.impl.StdSchedulerFactory - instantiate - 1374] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' |
||||
[15:08:34.024][org.quartz.impl.StdSchedulerFactory - instantiate - 1378] Quartz scheduler version: 2.3.2 |
||||
[15:08:34.314][org.apache.juli.logging.DirectJDKLog - log - 173] Starting ProtocolHandler ["http-nio-8123"] |
||||
[15:08:34.344][com.ynxbd.push.quartz.listener.AppStartQuartzJobListener - onApplicationEvent - 33] [<QUZRTZ DISPATCH>]Starting Quartz task ... |
||||
[15:08:34.349][org.quartz.core.QuartzScheduler - start - 547] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. |
||||
[15:08:34.353][org.springframework.boot.StartupInfoLogger - logStarted - 61] Started AppApplication in 1.996 seconds (JVM running for 2.798) |
||||
[15:08:39.179][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring DispatcherServlet 'dispatcherServlet' |
||||
[15:08:40.018][com.ynxbd.push.config.IniConfig - <clinit> - 31] IP:10.37.129.2 |
||||
[15:08:40.021][WxCacheRequest - getWxAccessToken - 56] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:08:40.318][weixin.popular.client.LocalHttpClient - loggerRequest - 257] URI[d11da03d-1506-4d59-9dc6-c3f796cde111] https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token&lang=zh_CN |
||||
[15:08:40.634][weixin.popular.client.JsonResponseHandler$JsonResponseHandlerImpl - handleResponse - 39] URI[d11da03d-1506-4d59-9dc6-c3f796cde111] elapsed time:317 ms RESPONSE DATA:{"errcode":41001,"errmsg":"access_token missing rid: 62d8fb78-2dfd219b-19bc134f"} |
||||
[15:09:34.927][org.springframework.boot.StartupInfoLogger - logStarting - 55] Starting AppApplication on absorber.local with PID 63302 (/Users/absorber/Downloads/wx-push/target/classes started by absorber in /Users/absorber/Downloads/wx-push) |
||||
[15:09:34.930][org.springframework.boot.SpringApplication - logStartupProfileInfo - 651] No active profile set, falling back to default profiles: default |
||||
[15:09:35.929][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing ProtocolHandler ["http-nio-8123"] |
||||
[15:09:35.931][org.apache.juli.logging.DirectJDKLog - log - 173] Starting service [Tomcat] |
||||
[15:09:35.931][org.apache.juli.logging.DirectJDKLog - log - 173] Starting Servlet engine: [Apache Tomcat/9.0.36] |
||||
[15:09:35.981][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring embedded WebApplicationContext |
||||
[15:09:36.067][org.quartz.impl.StdSchedulerFactory - instantiate - 1220] Using default implementation for ThreadExecutor |
||||
[15:09:36.068][org.quartz.simpl.SimpleThreadPool - initialize - 268] Job execution threads will use class loader of thread: restartedMain |
||||
[15:09:36.073][org.quartz.core.SchedulerSignalerImpl - <init> - 61] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl |
||||
[15:09:36.073][org.quartz.core.QuartzScheduler - <init> - 229] Quartz Scheduler v.2.3.2 created. |
||||
[15:09:36.075][org.quartz.simpl.RAMJobStore - initialize - 155] RAMJobStore initialized. |
||||
[15:09:36.076][org.quartz.core.QuartzScheduler - initialize - 294] Scheduler meta-data: Quartz Scheduler (v2.3.2) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED' |
||||
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. |
||||
NOT STARTED. |
||||
Currently in standby mode. |
||||
Number of jobs executed: 0 |
||||
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. |
||||
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. |
||||
|
||||
[15:09:36.076][org.quartz.impl.StdSchedulerFactory - instantiate - 1374] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' |
||||
[15:09:36.077][org.quartz.impl.StdSchedulerFactory - instantiate - 1378] Quartz scheduler version: 2.3.2 |
||||
[15:09:36.437][org.apache.juli.logging.DirectJDKLog - log - 173] Starting ProtocolHandler ["http-nio-8123"] |
||||
[15:09:36.465][com.ynxbd.push.quartz.listener.AppStartQuartzJobListener - onApplicationEvent - 33] [<QUZRTZ DISPATCH>]Starting Quartz task ... |
||||
[15:09:36.471][org.quartz.core.QuartzScheduler - start - 547] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. |
||||
[15:09:36.477][org.springframework.boot.StartupInfoLogger - logStarted - 61] Started AppApplication in 1.878 seconds (JVM running for 2.506) |
||||
[15:09:43.918][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring DispatcherServlet 'dispatcherServlet' |
||||
[15:09:44.768][com.ynxbd.push.config.IniConfig - <clinit> - 31] IP:10.37.129.2 |
||||
[15:09:44.770][WxCacheRequest - getWxAccessToken - 56] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:09:56.545][WxCacheRequest - getWxAccessToken - 58] access_code:200 |
||||
[15:09:56.550][WxCacheRequest - getWxAccessToken - 60] access_token:59_vfTkhTVx3IQDup-W54HuGwW89_6rbcXQUAvgHxJ5UaT2e6FL33gj-BghbAhx3sg2bCBa2uBdw-5qxj3JxIiPDMKQp0QLJh32xfUmMydQntM0Ry2Ri_lOWWhz6ZdFLWv3EkZ-bV0CSR1uLO2DRBWaAGAHRM |
||||
[15:09:56.789][weixin.popular.client.LocalHttpClient - loggerRequest - 257] URI[a6bad539-9b7f-448d-bc1d-96b9c4a1c7b8] https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=59_vfTkhTVx3IQDup-W54HuGwW89_6rbcXQUAvgHxJ5UaT2e6FL33gj-BghbAhx3sg2bCBa2uBdw-5qxj3JxIiPDMKQp0QLJh32xfUmMydQntM0Ry2Ri_lOWWhz6ZdFLWv3EkZ-bV0CSR1uLO2DRBWaAGAHRM&lang=zh_CN |
||||
[15:09:57.310][weixin.popular.client.JsonResponseHandler$JsonResponseHandlerImpl - handleResponse - 39] URI[a6bad539-9b7f-448d-bc1d-96b9c4a1c7b8] elapsed time:521 ms RESPONSE DATA:{"template_list":[{"template_id":"gEe0a8JwbNw_rII5nzM9b5ipsqu7eoMzUM4oU4ndcoI","title":"订阅模板消息","primary_industry":"","deputy_industry":"","content":"{{content.DATA}}","example":""},{"template_id":"Rt30w4zFMuKe62wpEfELZkC42qjVVs1j9nOm2pnuPWk","title":"信息完善提醒","primary_industry":"医疗护理","deputy_industry":"医药医疗","content":"{{first.DATA}}\n信息类型:{{keyword1.DATA}}\n医院:{{keyword2.DATA}}\n{{remark.DATA}}","example":"您好,为了更好跟踪您的病情,请完善您的个人信息\r\n信息类型:生活习惯\r\n医院:广东省中医院\r\n点击完善个人信息。"},{"template_id":"CkUk68zgI2nU2eHHQ6K-6RuJDbDQbf_xw6EVyfpYiKs","title":"排队叫号提醒","primary_industry":"医疗护理","deputy_industry":"医药医疗","content":"{{first.DATA}}\n科室:{{keyword1.DATA}}\n医生:{{keyword2.DATA}}\n当前叫号:{{keyword3.DATA}}\n本人号码:{{keyword4.DATA}}\n需等待人数:{{keyword5.DATA}}\n{{remark.DATA}}","example":"您已进入候诊队列,请及时查看。\r\n科室:内科\r\n医生:张医生\r\n当前叫号:001\r\n本人号码:009\r\n需等待人数:8\r\n请合理安排好时间及时就诊,以免过号。"},{"template_id":"tbHXha5siTC1Fs0vCXQoHB0zlKmgtOp2Ihf_CzH2d4o","title":"健康卡成功升级通知","primary_industry":"医疗护理","deputy_industry":"医药医疗","content":"{{first.DATA}}\n升级时间:{{keyword1.DATA}}\n升级说明:{{keyword2.DATA}}\n{{remark.DATA}}","example":"您已成功将就诊卡升级为健康卡!\r\n升级时间:2014年7月21日 18:36\r\n升级说明:健康卡可完全替代就诊卡,支持区域内多家医院跨院就医,无需重复办卡,实现线上挂号缴费,线下扫码就医。\r\n点击查看健康卡"},{"template_id":"yN0-xsCzSlDRcGZlMhifWBkziwyGlBHXrK-fzF76EzI","title":"绑定通知","primary_industry":"医疗护理","deputy_industry":"医药医疗","content":"{{first.DATA}}\n内容:{{keyword1.DATA}}\n时间:{{keyword2.DATA}}\n{{remark.DATA}}","example":"刘先生,你好:\r\n内容:某某医生提醒您尽快绑定xx账号,以便沟通\r\n时间:2015年9月29日 12:36\r\n点击详情查看更多"}]} |
||||
[15:09:57.338][com.ynxbd.push.controller.SendMessageController - templateMessageSend - 95] template_id:yN0-xsCzSlDRcGZlMhifWBkziwyGlBHXrK-fzF76EzI |
||||
[15:09:57.338][com.ynxbd.push.controller.SendMessageController - templateMessageSend - 96] code:0 |
||||
[15:09:57.339][com.ynxbd.push.controller.SendMessageController - templateMessageSend - 97] open_id:34AA9283E73A1796A8A89DCB5D6CCA721024D2B37F85D3740B2B51C650D4D610 |
||||
[15:09:57.385][com.ynxbd.push.helper.MessageApiHelper - templateMessage - 76] SendTenCentJson:{"data":{"keyword5":{"color":"#173177","value":null},"keyword3":{"color":"#173177","value":null},"keyword4":{"color":"#173177","value":null},"keyword1":{"color":"#173177","value":"测试"},"keyword2":{"color":"#173177","value":"测试"},"remark":{"color":"#173177","value":"测试"},"first":{"color":"#173177","value":"测试"}},"template_id":"yN0-xsCzSlDRcGZlMhifWBkziwyGlBHXrK-fzF76EzI","touser":"oX5GuwV9DOhctadDV3OD7vkWQpGE","url":null,"miniprogram":{"pagepath":null,"appid":null},"title":null,"scene":null} |
||||
[15:09:57.395][weixin.popular.client.LocalHttpClient - loggerRequest - 250] URI[717d9c1b-8bd2-49e1-b2a9-23b600bd64b9] https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=59_vfTkhTVx3IQDup-W54HuGwW89_6rbcXQUAvgHxJ5UaT2e6FL33gj-BghbAhx3sg2bCBa2uBdw-5qxj3JxIiPDMKQp0QLJh32xfUmMydQntM0Ry2Ri_lOWWhz6ZdFLWv3EkZ-bV0CSR1uLO2DRBWaAGAHRM Content-Type: text/plain; charset=UTF-8 ContentLength:511 Content:{"data":{"keyword5":{"color":"#173177","value":null},"keyword3":{"color":"#173177","value":null},"keyword4":{"color":"#173177","value":null},"keyword1":{"color":"#173177","value":"测试"},"keyword2":{"color":"#173177","value":"测试"},"remark":{"color":"#173177","value":"测试"},"first":{"color":"#173177","value":"测试"}},"template_id":"yN0-xsCzSlDRcGZlMhifWBkziwyGlBHXrK-fzF76EzI","touser":"oX5GuwV9DOhctadDV3OD7vkWQpGE","url":null,"miniprogram":{"pagepath":null,"appid":null},"title":null,"scene":null} |
||||
[15:09:57.836][weixin.popular.client.JsonResponseHandler$JsonResponseHandlerImpl - handleResponse - 39] URI[717d9c1b-8bd2-49e1-b2a9-23b600bd64b9] elapsed time:441 ms RESPONSE DATA:{"errcode":0,"errmsg":"ok","msgid":2496367981904855042} |
||||
[15:09:57.844][com.ynxbd.push.helper.MessageApiHelper - templateMessageSend - 63] TenCent Return Message0 |
||||
[15:10:12.388][weixin.popular.client.LocalHttpClient - loggerRequest - 257] URI[0faadec5-3023-401b-b7e8-1b36890dfdba] https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=59_vfTkhTVx3IQDup-W54HuGwW89_6rbcXQUAvgHxJ5UaT2e6FL33gj-BghbAhx3sg2bCBa2uBdw-5qxj3JxIiPDMKQp0QLJh32xfUmMydQntM0Ry2Ri_lOWWhz6ZdFLWv3EkZ-bV0CSR1uLO2DRBWaAGAHRM&lang=zh_CN |
||||
[15:10:12.662][weixin.popular.client.JsonResponseHandler$JsonResponseHandlerImpl - handleResponse - 39] URI[0faadec5-3023-401b-b7e8-1b36890dfdba] elapsed time:275 ms RESPONSE DATA:{"template_list":[{"template_id":"gEe0a8JwbNw_rII5nzM9b5ipsqu7eoMzUM4oU4ndcoI","title":"订阅模板消息","primary_industry":"","deputy_industry":"","content":"{{content.DATA}}","example":""},{"template_id":"Rt30w4zFMuKe62wpEfELZkC42qjVVs1j9nOm2pnuPWk","title":"信息完善提醒","primary_industry":"医疗护理","deputy_industry":"医药医疗","content":"{{first.DATA}}\n信息类型:{{keyword1.DATA}}\n医院:{{keyword2.DATA}}\n{{remark.DATA}}","example":"您好,为了更好跟踪您的病情,请完善您的个人信息\r\n信息类型:生活习惯\r\n医院:广东省中医院\r\n点击完善个人信息。"},{"template_id":"CkUk68zgI2nU2eHHQ6K-6RuJDbDQbf_xw6EVyfpYiKs","title":"排队叫号提醒","primary_industry":"医疗护理","deputy_industry":"医药医疗","content":"{{first.DATA}}\n科室:{{keyword1.DATA}}\n医生:{{keyword2.DATA}}\n当前叫号:{{keyword3.DATA}}\n本人号码:{{keyword4.DATA}}\n需等待人数:{{keyword5.DATA}}\n{{remark.DATA}}","example":"您已进入候诊队列,请及时查看。\r\n科室:内科\r\n医生:张医生\r\n当前叫号:001\r\n本人号码:009\r\n需等待人数:8\r\n请合理安排好时间及时就诊,以免过号。"},{"template_id":"tbHXha5siTC1Fs0vCXQoHB0zlKmgtOp2Ihf_CzH2d4o","title":"健康卡成功升级通知","primary_industry":"医疗护理","deputy_industry":"医药医疗","content":"{{first.DATA}}\n升级时间:{{keyword1.DATA}}\n升级说明:{{keyword2.DATA}}\n{{remark.DATA}}","example":"您已成功将就诊卡升级为健康卡!\r\n升级时间:2014年7月21日 18:36\r\n升级说明:健康卡可完全替代就诊卡,支持区域内多家医院跨院就医,无需重复办卡,实现线上挂号缴费,线下扫码就医。\r\n点击查看健康卡"},{"template_id":"yN0-xsCzSlDRcGZlMhifWBkziwyGlBHXrK-fzF76EzI","title":"绑定通知","primary_industry":"医疗护理","deputy_industry":"医药医疗","content":"{{first.DATA}}\n内容:{{keyword1.DATA}}\n时间:{{keyword2.DATA}}\n{{remark.DATA}}","example":"刘先生,你好:\r\n内容:某某医生提醒您尽快绑定xx账号,以便沟通\r\n时间:2015年9月29日 12:36\r\n点击详情查看更多"}]} |
||||
[15:10:12.667][com.ynxbd.push.controller.SendMessageController - templateMessageSend - 95] template_id:yN0-xsCzSlDRcGZlMhifWBkziwyGlBHXrK-fzF76EzI |
||||
[15:10:12.668][com.ynxbd.push.controller.SendMessageController - templateMessageSend - 96] code:0 |
||||
[15:10:12.668][com.ynxbd.push.controller.SendMessageController - templateMessageSend - 97] open_id:34AA9283E73A1796A8A89DCB5D6CCA721024D2B37F85D3740B2B51C650D4D610 |
||||
[15:10:12.700][com.ynxbd.push.helper.MessageApiHelper - templateMessage - 76] SendTenCentJson:{"data":{"keyword5":{"color":"#173177","value":null},"keyword3":{"color":"#173177","value":null},"keyword4":{"color":"#173177","value":null},"keyword1":{"color":"#173177","value":"测试"},"keyword2":{"color":"#173177","value":"测试"},"remark":{"color":"#173177","value":"测试"},"first":{"color":"#173177","value":"测试"}},"template_id":"yN0-xsCzSlDRcGZlMhifWBkziwyGlBHXrK-fzF76EzI","touser":"oX5GuwV9DOhctadDV3OD7vkWQpGE","url":null,"miniprogram":{"pagepath":null,"appid":null},"title":null,"scene":null} |
||||
[15:10:12.704][weixin.popular.client.LocalHttpClient - loggerRequest - 250] URI[d2b8823e-f222-4303-b5d3-cf9837fb624f] https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=59_vfTkhTVx3IQDup-W54HuGwW89_6rbcXQUAvgHxJ5UaT2e6FL33gj-BghbAhx3sg2bCBa2uBdw-5qxj3JxIiPDMKQp0QLJh32xfUmMydQntM0Ry2Ri_lOWWhz6ZdFLWv3EkZ-bV0CSR1uLO2DRBWaAGAHRM Content-Type: text/plain; charset=UTF-8 ContentLength:511 Content:{"data":{"keyword5":{"color":"#173177","value":null},"keyword3":{"color":"#173177","value":null},"keyword4":{"color":"#173177","value":null},"keyword1":{"color":"#173177","value":"测试"},"keyword2":{"color":"#173177","value":"测试"},"remark":{"color":"#173177","value":"测试"},"first":{"color":"#173177","value":"测试"}},"template_id":"yN0-xsCzSlDRcGZlMhifWBkziwyGlBHXrK-fzF76EzI","touser":"oX5GuwV9DOhctadDV3OD7vkWQpGE","url":null,"miniprogram":{"pagepath":null,"appid":null},"title":null,"scene":null} |
||||
[15:10:13.078][weixin.popular.client.JsonResponseHandler$JsonResponseHandlerImpl - handleResponse - 39] URI[d2b8823e-f222-4303-b5d3-cf9837fb624f] elapsed time:375 ms RESPONSE DATA:{"errcode":0,"errmsg":"ok","msgid":2496368237858062338} |
||||
[15:10:13.080][com.ynxbd.push.helper.MessageApiHelper - templateMessageSend - 63] TenCent Return Message0 |
||||
[15:28:38.359][org.springframework.boot.StartupInfoLogger - logStarting - 55] Starting AppApplication on absorber.local with PID 63607 (/Users/absorber/Downloads/wx-push/target/classes started by absorber in /Users/absorber/Downloads/wx-push) |
||||
[15:28:38.364][org.springframework.boot.SpringApplication - logStartupProfileInfo - 651] No active profile set, falling back to default profiles: default |
||||
[15:28:39.531][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing ProtocolHandler ["http-nio-8123"] |
||||
[15:28:39.532][org.apache.juli.logging.DirectJDKLog - log - 173] Starting service [Tomcat] |
||||
[15:28:39.532][org.apache.juli.logging.DirectJDKLog - log - 173] Starting Servlet engine: [Apache Tomcat/9.0.36] |
||||
[15:28:39.597][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring embedded WebApplicationContext |
||||
[15:28:39.696][org.quartz.impl.StdSchedulerFactory - instantiate - 1220] Using default implementation for ThreadExecutor |
||||
[15:28:39.697][org.quartz.simpl.SimpleThreadPool - initialize - 268] Job execution threads will use class loader of thread: restartedMain |
||||
[15:28:39.702][org.quartz.core.SchedulerSignalerImpl - <init> - 61] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl |
||||
[15:28:39.702][org.quartz.core.QuartzScheduler - <init> - 229] Quartz Scheduler v.2.3.2 created. |
||||
[15:28:39.702][org.quartz.simpl.RAMJobStore - initialize - 155] RAMJobStore initialized. |
||||
[15:28:39.703][org.quartz.core.QuartzScheduler - initialize - 294] Scheduler meta-data: Quartz Scheduler (v2.3.2) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED' |
||||
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. |
||||
NOT STARTED. |
||||
Currently in standby mode. |
||||
Number of jobs executed: 0 |
||||
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. |
||||
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. |
||||
|
||||
[15:28:39.703][org.quartz.impl.StdSchedulerFactory - instantiate - 1374] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' |
||||
[15:28:39.703][org.quartz.impl.StdSchedulerFactory - instantiate - 1378] Quartz scheduler version: 2.3.2 |
||||
[15:28:39.991][org.apache.juli.logging.DirectJDKLog - log - 173] Starting ProtocolHandler ["http-nio-8123"] |
||||
[15:28:40.019][com.ynxbd.push.quartz.listener.AppStartQuartzJobListener - onApplicationEvent - 33] [<QUZRTZ DISPATCH>]Starting Quartz task ... |
||||
[15:28:40.025][org.quartz.core.QuartzScheduler - start - 547] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. |
||||
[15:28:40.029][org.springframework.boot.StartupInfoLogger - logStarted - 61] Started AppApplication in 2.105 seconds (JVM running for 3.01) |
||||
[15:40:30.532][org.springframework.boot.StartupInfoLogger - logStarting - 55] Starting AppApplication on absorber.local with PID 63752 (/Users/absorber/Downloads/wx-push/target/classes started by absorber in /Users/absorber/Downloads/wx-push) |
||||
[15:40:30.537][org.springframework.boot.SpringApplication - logStartupProfileInfo - 651] No active profile set, falling back to default profiles: default |
||||
[15:40:31.739][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing ProtocolHandler ["http-nio-8123"] |
||||
[15:40:31.741][org.apache.juli.logging.DirectJDKLog - log - 173] Starting service [Tomcat] |
||||
[15:40:31.741][org.apache.juli.logging.DirectJDKLog - log - 173] Starting Servlet engine: [Apache Tomcat/9.0.36] |
||||
[15:40:31.803][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring embedded WebApplicationContext |
||||
[15:40:31.889][org.quartz.impl.StdSchedulerFactory - instantiate - 1220] Using default implementation for ThreadExecutor |
||||
[15:40:31.890][org.quartz.simpl.SimpleThreadPool - initialize - 268] Job execution threads will use class loader of thread: restartedMain |
||||
[15:40:31.895][org.quartz.core.SchedulerSignalerImpl - <init> - 61] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl |
||||
[15:40:31.895][org.quartz.core.QuartzScheduler - <init> - 229] Quartz Scheduler v.2.3.2 created. |
||||
[15:40:31.895][org.quartz.simpl.RAMJobStore - initialize - 155] RAMJobStore initialized. |
||||
[15:40:31.896][org.quartz.core.QuartzScheduler - initialize - 294] Scheduler meta-data: Quartz Scheduler (v2.3.2) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED' |
||||
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. |
||||
NOT STARTED. |
||||
Currently in standby mode. |
||||
Number of jobs executed: 0 |
||||
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. |
||||
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. |
||||
|
||||
[15:40:31.896][org.quartz.impl.StdSchedulerFactory - instantiate - 1374] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' |
||||
[15:40:31.896][org.quartz.impl.StdSchedulerFactory - instantiate - 1378] Quartz scheduler version: 2.3.2 |
||||
[15:40:32.189][org.apache.juli.logging.DirectJDKLog - log - 173] Starting ProtocolHandler ["http-nio-8123"] |
||||
[15:40:32.218][com.ynxbd.push.quartz.listener.AppStartQuartzJobListener - onApplicationEvent - 33] [<QUZRTZ DISPATCH>]Starting Quartz task ... |
||||
[15:40:32.224][org.quartz.core.QuartzScheduler - start - 547] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. |
||||
[15:40:32.228][org.springframework.boot.StartupInfoLogger - logStarted - 61] Started AppApplication in 2.079 seconds (JVM running for 2.925) |
||||
[15:40:36.941][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring DispatcherServlet 'dispatcherServlet' |
||||
[15:40:37.851][com.ynxbd.push.config.IniConfig - <clinit> - 31] IP:10.37.129.2 |
||||
[15:40:37.854][WxCacheRequest - getWxAccessToken - 58] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:40:38.139][weixin.popular.client.LocalHttpClient - loggerRequest - 257] URI[b143d739-1695-497f-adac-f549c33a1637] https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token&lang=zh_CN |
||||
[15:40:38.419][weixin.popular.client.JsonResponseHandler$JsonResponseHandlerImpl - handleResponse - 39] URI[b143d739-1695-497f-adac-f549c33a1637] elapsed time:282 ms RESPONSE DATA:{"errcode":41001,"errmsg":"access_token missing rid: 62d902f6-2f03e732-2cd63ec1"} |
||||
[15:43:59.781][org.springframework.boot.StartupInfoLogger - logStarting - 55] Starting AppApplication on absorber.local with PID 63812 (/Users/absorber/Downloads/wx-push/target/classes started by absorber in /Users/absorber/Downloads/wx-push) |
||||
[15:43:59.784][org.springframework.boot.SpringApplication - logStartupProfileInfo - 651] No active profile set, falling back to default profiles: default |
||||
[15:44:00.875][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing ProtocolHandler ["http-nio-8123"] |
||||
[15:44:00.877][org.apache.juli.logging.DirectJDKLog - log - 173] Starting service [Tomcat] |
||||
[15:44:00.877][org.apache.juli.logging.DirectJDKLog - log - 173] Starting Servlet engine: [Apache Tomcat/9.0.36] |
||||
[15:44:00.932][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring embedded WebApplicationContext |
||||
[15:44:01.043][org.quartz.impl.StdSchedulerFactory - instantiate - 1220] Using default implementation for ThreadExecutor |
||||
[15:44:01.044][org.quartz.simpl.SimpleThreadPool - initialize - 268] Job execution threads will use class loader of thread: restartedMain |
||||
[15:44:01.053][org.quartz.core.SchedulerSignalerImpl - <init> - 61] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl |
||||
[15:44:01.054][org.quartz.core.QuartzScheduler - <init> - 229] Quartz Scheduler v.2.3.2 created. |
||||
[15:44:01.054][org.quartz.simpl.RAMJobStore - initialize - 155] RAMJobStore initialized. |
||||
[15:44:01.055][org.quartz.core.QuartzScheduler - initialize - 294] Scheduler meta-data: Quartz Scheduler (v2.3.2) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED' |
||||
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. |
||||
NOT STARTED. |
||||
Currently in standby mode. |
||||
Number of jobs executed: 0 |
||||
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. |
||||
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. |
||||
|
||||
[15:44:01.055][org.quartz.impl.StdSchedulerFactory - instantiate - 1374] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' |
||||
[15:44:01.055][org.quartz.impl.StdSchedulerFactory - instantiate - 1378] Quartz scheduler version: 2.3.2 |
||||
[15:44:01.377][org.apache.juli.logging.DirectJDKLog - log - 173] Starting ProtocolHandler ["http-nio-8123"] |
||||
[15:44:01.402][com.ynxbd.push.quartz.listener.AppStartQuartzJobListener - onApplicationEvent - 33] [<QUZRTZ DISPATCH>]Starting Quartz task ... |
||||
[15:44:01.408][org.quartz.core.QuartzScheduler - start - 547] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. |
||||
[15:44:01.412][org.springframework.boot.StartupInfoLogger - logStarted - 61] Started AppApplication in 1.966 seconds (JVM running for 2.734) |
||||
[15:44:08.746][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring DispatcherServlet 'dispatcherServlet' |
||||
[15:44:09.575][com.ynxbd.push.config.IniConfig - <clinit> - 31] IP:10.37.129.2 |
||||
[15:44:09.577][WxCacheRequest - getWxAccessToken - 58] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:44:09.612][WxCacheRequest - getWxAccessToken - 58] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:44:09.618][WxCacheRequest - getWxAccessToken - 58] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:44:09.623][WxCacheRequest - getWxAccessToken - 58] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:44:09.892][weixin.popular.client.LocalHttpClient - loggerRequest - 257] URI[6e6cc995-4014-4452-b42b-d10222d693f6] https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token&lang=zh_CN |
||||
[15:44:10.166][weixin.popular.client.JsonResponseHandler$JsonResponseHandlerImpl - handleResponse - 39] URI[6e6cc995-4014-4452-b42b-d10222d693f6] elapsed time:275 ms RESPONSE DATA:{"errcode":41001,"errmsg":"access_token missing rid: 62d903ca-02c4bc43-5edaae1e"} |
||||
[15:44:35.196][WxCacheRequest - getWxAccessToken - 58] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:44:35.212][weixin.popular.client.LocalHttpClient - loggerRequest - 257] URI[4829c1d7-228d-4a48-9da7-66b6ed57858d] https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token&lang=zh_CN |
||||
[15:44:35.285][weixin.popular.client.JsonResponseHandler$JsonResponseHandlerImpl - handleResponse - 39] URI[4829c1d7-228d-4a48-9da7-66b6ed57858d] elapsed time:73 ms RESPONSE DATA:{"errcode":41001,"errmsg":"access_token missing rid: 62d903e3-717a2262-3c394660"} |
||||
[15:45:19.389][org.springframework.boot.StartupInfoLogger - logStarting - 55] Starting AppApplication on absorber.local with PID 63878 (/Users/absorber/Downloads/wx-push/target/classes started by absorber in /Users/absorber/Downloads/wx-push) |
||||
[15:45:19.391][org.springframework.boot.SpringApplication - logStartupProfileInfo - 651] No active profile set, falling back to default profiles: default |
||||
[15:45:20.607][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing ProtocolHandler ["http-nio-8123"] |
||||
[15:45:20.608][org.apache.juli.logging.DirectJDKLog - log - 173] Starting service [Tomcat] |
||||
[15:45:20.608][org.apache.juli.logging.DirectJDKLog - log - 173] Starting Servlet engine: [Apache Tomcat/9.0.36] |
||||
[15:45:20.663][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring embedded WebApplicationContext |
||||
[15:45:20.752][org.quartz.impl.StdSchedulerFactory - instantiate - 1220] Using default implementation for ThreadExecutor |
||||
[15:45:20.753][org.quartz.simpl.SimpleThreadPool - initialize - 268] Job execution threads will use class loader of thread: restartedMain |
||||
[15:45:20.758][org.quartz.core.SchedulerSignalerImpl - <init> - 61] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl |
||||
[15:45:20.758][org.quartz.core.QuartzScheduler - <init> - 229] Quartz Scheduler v.2.3.2 created. |
||||
[15:45:20.758][org.quartz.simpl.RAMJobStore - initialize - 155] RAMJobStore initialized. |
||||
[15:45:20.759][org.quartz.core.QuartzScheduler - initialize - 294] Scheduler meta-data: Quartz Scheduler (v2.3.2) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED' |
||||
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. |
||||
NOT STARTED. |
||||
Currently in standby mode. |
||||
Number of jobs executed: 0 |
||||
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. |
||||
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. |
||||
|
||||
[15:45:20.759][org.quartz.impl.StdSchedulerFactory - instantiate - 1374] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' |
||||
[15:45:20.759][org.quartz.impl.StdSchedulerFactory - instantiate - 1378] Quartz scheduler version: 2.3.2 |
||||
[15:45:21.049][org.apache.juli.logging.DirectJDKLog - log - 173] Starting ProtocolHandler ["http-nio-8123"] |
||||
[15:45:21.078][com.ynxbd.push.quartz.listener.AppStartQuartzJobListener - onApplicationEvent - 33] [<QUZRTZ DISPATCH>]Starting Quartz task ... |
||||
[15:45:21.086][org.quartz.core.QuartzScheduler - start - 547] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. |
||||
[15:45:21.090][org.springframework.boot.StartupInfoLogger - logStarted - 61] Started AppApplication in 2.035 seconds (JVM running for 2.671) |
||||
[15:45:25.436][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring DispatcherServlet 'dispatcherServlet' |
||||
[15:45:26.252][com.ynxbd.push.config.IniConfig - <clinit> - 31] IP:10.37.129.2 |
||||
[15:45:26.254][WxCacheRequest - getWxAccessToken - 59] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:45:26.290][WxCacheRequest - getWxAccessToken - 59] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:45:26.294][WxCacheRequest - getWxAccessToken - 59] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:45:26.298][WxCacheRequest - getWxAccessToken - 59] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:45:26.581][weixin.popular.client.LocalHttpClient - loggerRequest - 257] URI[0873d514-a726-455a-b271-5c979f16c022] https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token&lang=zh_CN |
||||
[15:45:26.865][weixin.popular.client.JsonResponseHandler$JsonResponseHandlerImpl - handleResponse - 39] URI[0873d514-a726-455a-b271-5c979f16c022] elapsed time:284 ms RESPONSE DATA:{"errcode":41001,"errmsg":"access_token missing rid: 62d90416-4a9bf85b-32945600"} |
||||
[15:45:40.235][WxCacheRequest - getWxAccessToken - 59] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:45:40.273][weixin.popular.client.LocalHttpClient - loggerRequest - 257] URI[3a5c66f8-43db-47a8-8fcc-7bc120c635dc] https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token&lang=zh_CN |
||||
[15:45:40.505][weixin.popular.client.JsonResponseHandler$JsonResponseHandlerImpl - handleResponse - 39] URI[3a5c66f8-43db-47a8-8fcc-7bc120c635dc] elapsed time:231 ms RESPONSE DATA:{"errcode":41001,"errmsg":"access_token missing rid: 62d90424-3baccba1-1f925962"} |
||||
[15:47:04.008][org.springframework.boot.StartupInfoLogger - logStarting - 55] Starting AppApplication on absorber.local with PID 63927 (/Users/absorber/Downloads/wx-push/target/classes started by absorber in /Users/absorber/Downloads/wx-push) |
||||
[15:47:04.010][org.springframework.boot.SpringApplication - logStartupProfileInfo - 651] No active profile set, falling back to default profiles: default |
||||
[15:47:05.147][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing ProtocolHandler ["http-nio-8123"] |
||||
[15:47:05.149][org.apache.juli.logging.DirectJDKLog - log - 173] Starting service [Tomcat] |
||||
[15:47:05.149][org.apache.juli.logging.DirectJDKLog - log - 173] Starting Servlet engine: [Apache Tomcat/9.0.36] |
||||
[15:47:05.199][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring embedded WebApplicationContext |
||||
[15:47:05.295][org.quartz.impl.StdSchedulerFactory - instantiate - 1220] Using default implementation for ThreadExecutor |
||||
[15:47:05.296][org.quartz.simpl.SimpleThreadPool - initialize - 268] Job execution threads will use class loader of thread: restartedMain |
||||
[15:47:05.302][org.quartz.core.SchedulerSignalerImpl - <init> - 61] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl |
||||
[15:47:05.302][org.quartz.core.QuartzScheduler - <init> - 229] Quartz Scheduler v.2.3.2 created. |
||||
[15:47:05.302][org.quartz.simpl.RAMJobStore - initialize - 155] RAMJobStore initialized. |
||||
[15:47:05.303][org.quartz.core.QuartzScheduler - initialize - 294] Scheduler meta-data: Quartz Scheduler (v2.3.2) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED' |
||||
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. |
||||
NOT STARTED. |
||||
Currently in standby mode. |
||||
Number of jobs executed: 0 |
||||
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. |
||||
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. |
||||
|
||||
[15:47:05.303][org.quartz.impl.StdSchedulerFactory - instantiate - 1374] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' |
||||
[15:47:05.303][org.quartz.impl.StdSchedulerFactory - instantiate - 1378] Quartz scheduler version: 2.3.2 |
||||
[15:47:05.593][org.apache.juli.logging.DirectJDKLog - log - 173] Starting ProtocolHandler ["http-nio-8123"] |
||||
[15:47:05.622][com.ynxbd.push.quartz.listener.AppStartQuartzJobListener - onApplicationEvent - 33] [<QUZRTZ DISPATCH>]Starting Quartz task ... |
||||
[15:47:05.628][org.quartz.core.QuartzScheduler - start - 547] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. |
||||
[15:47:05.632][org.springframework.boot.StartupInfoLogger - logStarted - 61] Started AppApplication in 1.996 seconds (JVM running for 2.789) |
||||
[15:47:10.440][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring DispatcherServlet 'dispatcherServlet' |
||||
[15:47:11.275][com.ynxbd.push.config.IniConfig - <clinit> - 31] IP:10.37.129.2 |
||||
[15:47:11.277][WxCacheRequest - getWxAccessToken - 59] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:47:11.310][WxCacheRequest - getWxAccessToken - 59] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:47:11.314][WxCacheRequest - getWxAccessToken - 59] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:47:11.316][WxCacheRequest - getWxAccessToken - 59] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:47:11.594][weixin.popular.client.LocalHttpClient - loggerRequest - 257] URI[6afe4efa-133a-45c1-804b-013c7d014563] https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token&lang=zh_CN |
||||
[15:47:11.869][weixin.popular.client.JsonResponseHandler$JsonResponseHandlerImpl - handleResponse - 39] URI[6afe4efa-133a-45c1-804b-013c7d014563] elapsed time:276 ms RESPONSE DATA:{"errcode":41001,"errmsg":"access_token missing rid: 62d9047f-00e94d66-08b67f56"} |
||||
[15:47:21.774][WxCacheRequest - getWxAccessToken - 59] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:47:21.790][WxCacheRequest - getWxAccessToken - 59] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:47:21.800][WxCacheRequest - getWxAccessToken - 59] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:47:21.812][WxCacheRequest - getWxAccessToken - 59] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:47:21.819][weixin.popular.client.LocalHttpClient - loggerRequest - 257] URI[60825f3b-b0fb-42c5-86ed-2211ff96c512] https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token&lang=zh_CN |
||||
[15:47:21.885][weixin.popular.client.JsonResponseHandler$JsonResponseHandlerImpl - handleResponse - 39] URI[60825f3b-b0fb-42c5-86ed-2211ff96c512] elapsed time:66 ms RESPONSE DATA:{"errcode":41001,"errmsg":"access_token missing rid: 62d90489-2f1501fa-10b09f13"} |
||||
[15:51:53.104][org.springframework.boot.StartupInfoLogger - logStarting - 55] Starting AppApplication on absorber.local with PID 64020 (/Users/absorber/Downloads/wx-push/target/classes started by absorber in /Users/absorber/Downloads/wx-push) |
||||
[15:51:53.108][org.springframework.boot.SpringApplication - logStartupProfileInfo - 651] No active profile set, falling back to default profiles: default |
||||
[15:51:54.530][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing ProtocolHandler ["http-nio-8123"] |
||||
[15:51:54.532][org.apache.juli.logging.DirectJDKLog - log - 173] Starting service [Tomcat] |
||||
[15:51:54.532][org.apache.juli.logging.DirectJDKLog - log - 173] Starting Servlet engine: [Apache Tomcat/9.0.36] |
||||
[15:51:54.585][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring embedded WebApplicationContext |
||||
[15:51:54.675][org.quartz.impl.StdSchedulerFactory - instantiate - 1220] Using default implementation for ThreadExecutor |
||||
[15:51:54.676][org.quartz.simpl.SimpleThreadPool - initialize - 268] Job execution threads will use class loader of thread: restartedMain |
||||
[15:51:54.680][org.quartz.core.SchedulerSignalerImpl - <init> - 61] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl |
||||
[15:51:54.681][org.quartz.core.QuartzScheduler - <init> - 229] Quartz Scheduler v.2.3.2 created. |
||||
[15:51:54.681][org.quartz.simpl.RAMJobStore - initialize - 155] RAMJobStore initialized. |
||||
[15:51:54.682][org.quartz.core.QuartzScheduler - initialize - 294] Scheduler meta-data: Quartz Scheduler (v2.3.2) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED' |
||||
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. |
||||
NOT STARTED. |
||||
Currently in standby mode. |
||||
Number of jobs executed: 0 |
||||
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. |
||||
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. |
||||
|
||||
[15:51:54.682][org.quartz.impl.StdSchedulerFactory - instantiate - 1374] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' |
||||
[15:51:54.682][org.quartz.impl.StdSchedulerFactory - instantiate - 1378] Quartz scheduler version: 2.3.2 |
||||
[15:51:54.999][org.apache.juli.logging.DirectJDKLog - log - 173] Starting ProtocolHandler ["http-nio-8123"] |
||||
[15:51:55.029][com.ynxbd.push.quartz.listener.AppStartQuartzJobListener - onApplicationEvent - 33] [<QUZRTZ DISPATCH>]Starting Quartz task ... |
||||
[15:51:55.036][org.quartz.core.QuartzScheduler - start - 547] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. |
||||
[15:51:55.040][org.springframework.boot.StartupInfoLogger - logStarted - 61] Started AppApplication in 2.325 seconds (JVM running for 3.159) |
||||
[15:53:26.451][org.springframework.boot.StartupInfoLogger - logStarting - 55] Starting AppApplication on absorber.local with PID 64041 (/Users/absorber/Downloads/wx-push/target/classes started by absorber in /Users/absorber/Downloads/wx-push) |
||||
[15:53:26.453][org.springframework.boot.SpringApplication - logStartupProfileInfo - 651] No active profile set, falling back to default profiles: default |
||||
[15:53:27.667][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing ProtocolHandler ["http-nio-8123"] |
||||
[15:53:27.669][org.apache.juli.logging.DirectJDKLog - log - 173] Starting service [Tomcat] |
||||
[15:53:27.669][org.apache.juli.logging.DirectJDKLog - log - 173] Starting Servlet engine: [Apache Tomcat/9.0.36] |
||||
[15:53:27.731][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring embedded WebApplicationContext |
||||
[15:53:27.819][org.quartz.impl.StdSchedulerFactory - instantiate - 1220] Using default implementation for ThreadExecutor |
||||
[15:53:27.820][org.quartz.simpl.SimpleThreadPool - initialize - 268] Job execution threads will use class loader of thread: restartedMain |
||||
[15:53:27.824][org.quartz.core.SchedulerSignalerImpl - <init> - 61] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl |
||||
[15:53:27.825][org.quartz.core.QuartzScheduler - <init> - 229] Quartz Scheduler v.2.3.2 created. |
||||
[15:53:27.825][org.quartz.simpl.RAMJobStore - initialize - 155] RAMJobStore initialized. |
||||
[15:53:27.826][org.quartz.core.QuartzScheduler - initialize - 294] Scheduler meta-data: Quartz Scheduler (v2.3.2) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED' |
||||
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. |
||||
NOT STARTED. |
||||
Currently in standby mode. |
||||
Number of jobs executed: 0 |
||||
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. |
||||
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. |
||||
|
||||
[15:53:27.826][org.quartz.impl.StdSchedulerFactory - instantiate - 1374] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' |
||||
[15:53:27.826][org.quartz.impl.StdSchedulerFactory - instantiate - 1378] Quartz scheduler version: 2.3.2 |
||||
[15:53:28.100][org.apache.juli.logging.DirectJDKLog - log - 173] Starting ProtocolHandler ["http-nio-8123"] |
||||
[15:53:28.130][com.ynxbd.push.quartz.listener.AppStartQuartzJobListener - onApplicationEvent - 33] [<QUZRTZ DISPATCH>]Starting Quartz task ... |
||||
[15:53:28.138][org.quartz.core.QuartzScheduler - start - 547] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. |
||||
[15:53:28.142][org.springframework.boot.StartupInfoLogger - logStarted - 61] Started AppApplication in 2.031 seconds (JVM running for 2.664) |
||||
[15:53:32.421][org.apache.juli.logging.DirectJDKLog - log - 173] Initializing Spring DispatcherServlet 'dispatcherServlet' |
||||
[15:53:33.263][com.ynxbd.push.config.IniConfig - <clinit> - 31] IP:10.37.129.2 |
||||
[15:53:33.266][WxCacheRequest - getWxAccessToken - 59] 启动医院为:(本地)蒙自市第一人民医院 |
||||
[15:53:33.457][WxCacheRequest - getWxAccessToken - 61] access_code:200 |
||||
[15:53:33.463][WxCacheRequest - getWxAccessToken - 63] access_token:59_vfTkhTVx3IQDup-W54HuGwW89_6rbcXQUAvgHxJ5UaT2e6FL33gj-BghbAhx3sg2bCBa2uBdw-5qxj3JxIiPDMKQp0QLJh32xfUmMydQntM0Ry2Ri_lOWWhz6ZdFLWv3EkZ-bV0CSR1uLO2DRBWaAGAHRM |
||||
[15:53:33.708][weixin.popular.client.LocalHttpClient - loggerRequest - 257] URI[275474df-17e7-4f12-9fa7-f00451aa5762] https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=59_vfTkhTVx3IQDup-W54HuGwW89_6rbcXQUAvgHxJ5UaT2e6FL33gj-BghbAhx3sg2bCBa2uBdw-5qxj3JxIiPDMKQp0QLJh32xfUmMydQntM0Ry2Ri_lOWWhz6ZdFLWv3EkZ-bV0CSR1uLO2DRBWaAGAHRM&lang=zh_CN |
||||
[15:53:34.236][weixin.popular.client.JsonResponseHandler$JsonResponseHandlerImpl - handleResponse - 39] URI[275474df-17e7-4f12-9fa7-f00451aa5762] elapsed time:530 ms RESPONSE DATA:{"template_list":[{"template_id":"gEe0a8JwbNw_rII5nzM9b5ipsqu7eoMzUM4oU4ndcoI","title":"订阅模板消息","primary_industry":"","deputy_industry":"","content":"{{content.DATA}}","example":""},{"template_id":"Rt30w4zFMuKe62wpEfELZkC42qjVVs1j9nOm2pnuPWk","title":"信息完善提醒","primary_industry":"医疗护理","deputy_industry":"医药医疗","content":"{{first.DATA}}\n信息类型:{{keyword1.DATA}}\n医院:{{keyword2.DATA}}\n{{remark.DATA}}","example":"您好,为了更好跟踪您的病情,请完善您的个人信息\r\n信息类型:生活习惯\r\n医院:广东省中医院\r\n点击完善个人信息。"},{"template_id":"CkUk68zgI2nU2eHHQ6K-6RuJDbDQbf_xw6EVyfpYiKs","title":"排队叫号提醒","primary_industry":"医疗护理","deputy_industry":"医药医疗","content":"{{first.DATA}}\n科室:{{keyword1.DATA}}\n医生:{{keyword2.DATA}}\n当前叫号:{{keyword3.DATA}}\n本人号码:{{keyword4.DATA}}\n需等待人数:{{keyword5.DATA}}\n{{remark.DATA}}","example":"您已进入候诊队列,请及时查看。\r\n科室:内科\r\n医生:张医生\r\n当前叫号:001\r\n本人号码:009\r\n需等待人数:8\r\n请合理安排好时间及时就诊,以免过号。"},{"template_id":"tbHXha5siTC1Fs0vCXQoHB0zlKmgtOp2Ihf_CzH2d4o","title":"健康卡成功升级通知","primary_industry":"医疗护理","deputy_industry":"医药医疗","content":"{{first.DATA}}\n升级时间:{{keyword1.DATA}}\n升级说明:{{keyword2.DATA}}\n{{remark.DATA}}","example":"您已成功将就诊卡升级为健康卡!\r\n升级时间:2014年7月21日 18:36\r\n升级说明:健康卡可完全替代就诊卡,支持区域内多家医院跨院就医,无需重复办卡,实现线上挂号缴费,线下扫码就医。\r\n点击查看健康卡"},{"template_id":"yN0-xsCzSlDRcGZlMhifWBkziwyGlBHXrK-fzF76EzI","title":"绑定通知","primary_industry":"医疗护理","deputy_industry":"医药医疗","content":"{{first.DATA}}\n内容:{{keyword1.DATA}}\n时间:{{keyword2.DATA}}\n{{remark.DATA}}","example":"刘先生,你好:\r\n内容:某某医生提醒您尽快绑定xx账号,以便沟通\r\n时间:2015年9月29日 12:36\r\n点击详情查看更多"}]} |
||||
[15:53:34.260][com.ynxbd.push.controller.SendMessageController - templateMessageSend - 93] template_id:yN0-xsCzSlDRcGZlMhifWBkziwyGlBHXrK-fzF76EzI |
||||
[15:53:34.260][com.ynxbd.push.controller.SendMessageController - templateMessageSend - 94] code:0 |
||||
[15:53:34.260][com.ynxbd.push.controller.SendMessageController - templateMessageSend - 95] open_id:34AA9283E73A1796A8A89DCB5D6CCA721024D2B37F85D3740B2B51C650D4D610 |
||||
[15:53:34.304][com.ynxbd.push.helper.MessageApiHelper - templateMessage - 76] SendTenCentJson:{"data":{"keyword5":{"color":"#173177","value":null},"keyword3":{"color":"#173177","value":null},"keyword4":{"color":"#173177","value":null},"keyword1":{"color":"#173177","value":"测试"},"keyword2":{"color":"#173177","value":"测试"},"remark":{"color":"#173177","value":"测试"},"first":{"color":"#173177","value":"测试"}},"template_id":"yN0-xsCzSlDRcGZlMhifWBkziwyGlBHXrK-fzF76EzI","touser":"oX5GuwV9DOhctadDV3OD7vkWQpGE","url":null,"miniprogram":{"pagepath":null,"appid":null},"title":null,"scene":null} |
||||
[15:53:34.314][weixin.popular.client.LocalHttpClient - loggerRequest - 250] URI[2a6ca860-f4ef-4eaf-8a1d-7fad8b822804] https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=59_vfTkhTVx3IQDup-W54HuGwW89_6rbcXQUAvgHxJ5UaT2e6FL33gj-BghbAhx3sg2bCBa2uBdw-5qxj3JxIiPDMKQp0QLJh32xfUmMydQntM0Ry2Ri_lOWWhz6ZdFLWv3EkZ-bV0CSR1uLO2DRBWaAGAHRM Content-Type: text/plain; charset=UTF-8 ContentLength:511 Content:{"data":{"keyword5":{"color":"#173177","value":null},"keyword3":{"color":"#173177","value":null},"keyword4":{"color":"#173177","value":null},"keyword1":{"color":"#173177","value":"测试"},"keyword2":{"color":"#173177","value":"测试"},"remark":{"color":"#173177","value":"测试"},"first":{"color":"#173177","value":"测试"}},"template_id":"yN0-xsCzSlDRcGZlMhifWBkziwyGlBHXrK-fzF76EzI","touser":"oX5GuwV9DOhctadDV3OD7vkWQpGE","url":null,"miniprogram":{"pagepath":null,"appid":null},"title":null,"scene":null} |
||||
[15:53:34.654][weixin.popular.client.JsonResponseHandler$JsonResponseHandlerImpl - handleResponse - 39] URI[2a6ca860-f4ef-4eaf-8a1d-7fad8b822804] elapsed time:340 ms RESPONSE DATA:{"errcode":0,"errmsg":"ok","msgid":2496411885748420612} |
||||
[15:53:34.661][com.ynxbd.push.helper.MessageApiHelper - templateMessageSend - 63] TenCent Return Message0 |
||||
[16:10:51.628][org.springframework.boot.StartupInfoLogger - logStarting - 55] Starting AppApplicationTests on absorber.local with PID 64330 (started by absorber in /Users/absorber/Downloads/wx-push) |
||||
[16:10:51.632][org.springframework.boot.SpringApplication - logStartupProfileInfo - 651] No active profile set, falling back to default profiles: default |
||||
[16:10:52.760][org.quartz.impl.StdSchedulerFactory - instantiate - 1220] Using default implementation for ThreadExecutor |
||||
[16:10:52.762][org.quartz.simpl.SimpleThreadPool - initialize - 268] Job execution threads will use class loader of thread: main |
||||
[16:10:52.771][org.quartz.core.SchedulerSignalerImpl - <init> - 61] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl |
||||
[16:10:52.771][org.quartz.core.QuartzScheduler - <init> - 229] Quartz Scheduler v.2.3.2 created. |
||||
[16:10:52.772][org.quartz.simpl.RAMJobStore - initialize - 155] RAMJobStore initialized. |
||||
[16:10:52.773][org.quartz.core.QuartzScheduler - initialize - 294] Scheduler meta-data: Quartz Scheduler (v2.3.2) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED' |
||||
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. |
||||
NOT STARTED. |
||||
Currently in standby mode. |
||||
Number of jobs executed: 0 |
||||
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. |
||||
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. |
||||
|
||||
[16:10:52.773][org.quartz.impl.StdSchedulerFactory - instantiate - 1374] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' |
||||
[16:10:52.773][org.quartz.impl.StdSchedulerFactory - instantiate - 1378] Quartz scheduler version: 2.3.2 |
||||
[16:10:53.905][com.ynxbd.push.quartz.listener.AppStartQuartzJobListener - onApplicationEvent - 33] [<QUZRTZ DISPATCH>]Starting Quartz task ... |
||||
[16:10:53.915][org.quartz.core.QuartzScheduler - start - 547] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. |
||||
[16:10:53.922][org.springframework.boot.StartupInfoLogger - logStarted - 61] Started AppApplicationTests in 2.738 seconds (JVM running for 4.003) |
||||
[16:10:54.250][org.quartz.core.QuartzScheduler - shutdown - 666] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutting down. |
||||
[16:10:54.252][org.quartz.core.QuartzScheduler - standby - 585] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED paused. |
||||
[16:10:54.253][org.quartz.core.QuartzScheduler - shutdown - 740] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutdown complete. |
||||
@ -0,0 +1,316 @@ |
||||
#!/bin/sh |
||||
# ---------------------------------------------------------------------------- |
||||
# Licensed to the Apache Software Foundation (ASF) under one |
||||
# or more contributor license agreements. See the NOTICE file |
||||
# distributed with this work for additional information |
||||
# regarding copyright ownership. The ASF licenses this file |
||||
# to you under the Apache License, Version 2.0 (the |
||||
# "License"); you may not use this file except in compliance |
||||
# with the License. You may obtain a copy of the License at |
||||
# |
||||
# https://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, |
||||
# software distributed under the License is distributed on an |
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
# KIND, either express or implied. See the License for the |
||||
# specific language governing permissions and limitations |
||||
# under the License. |
||||
# ---------------------------------------------------------------------------- |
||||
|
||||
# ---------------------------------------------------------------------------- |
||||
# Maven Start Up Batch script |
||||
# |
||||
# Required ENV vars: |
||||
# ------------------ |
||||
# JAVA_HOME - location of a JDK home dir |
||||
# |
||||
# Optional ENV vars |
||||
# ----------------- |
||||
# M2_HOME - location of maven2's installed home dir |
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven |
||||
# e.g. to debug Maven itself, use |
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files |
||||
# ---------------------------------------------------------------------------- |
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then |
||||
|
||||
if [ -f /usr/local/etc/mavenrc ] ; then |
||||
. /usr/local/etc/mavenrc |
||||
fi |
||||
|
||||
if [ -f /etc/mavenrc ] ; then |
||||
. /etc/mavenrc |
||||
fi |
||||
|
||||
if [ -f "$HOME/.mavenrc" ] ; then |
||||
. "$HOME/.mavenrc" |
||||
fi |
||||
|
||||
fi |
||||
|
||||
# OS specific support. $var _must_ be set to either true or false. |
||||
cygwin=false; |
||||
darwin=false; |
||||
mingw=false |
||||
case "`uname`" in |
||||
CYGWIN*) cygwin=true ;; |
||||
MINGW*) mingw=true;; |
||||
Darwin*) darwin=true |
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home |
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html |
||||
if [ -z "$JAVA_HOME" ]; then |
||||
if [ -x "/usr/libexec/java_home" ]; then |
||||
export JAVA_HOME="`/usr/libexec/java_home`" |
||||
else |
||||
export JAVA_HOME="/Library/Java/Home" |
||||
fi |
||||
fi |
||||
;; |
||||
esac |
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then |
||||
if [ -r /etc/gentoo-release ] ; then |
||||
JAVA_HOME=`java-config --jre-home` |
||||
fi |
||||
fi |
||||
|
||||
if [ -z "$M2_HOME" ] ; then |
||||
## resolve links - $0 may be a link to maven's home |
||||
PRG="$0" |
||||
|
||||
# need this for relative symlinks |
||||
while [ -h "$PRG" ] ; do |
||||
ls=`ls -ld "$PRG"` |
||||
link=`expr "$ls" : '.*-> \(.*\)$'` |
||||
if expr "$link" : '/.*' > /dev/null; then |
||||
PRG="$link" |
||||
else |
||||
PRG="`dirname "$PRG"`/$link" |
||||
fi |
||||
done |
||||
|
||||
saveddir=`pwd` |
||||
|
||||
M2_HOME=`dirname "$PRG"`/.. |
||||
|
||||
# make it fully qualified |
||||
M2_HOME=`cd "$M2_HOME" && pwd` |
||||
|
||||
cd "$saveddir" |
||||
# echo Using m2 at $M2_HOME |
||||
fi |
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched |
||||
if $cygwin ; then |
||||
[ -n "$M2_HOME" ] && |
||||
M2_HOME=`cygpath --unix "$M2_HOME"` |
||||
[ -n "$JAVA_HOME" ] && |
||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"` |
||||
[ -n "$CLASSPATH" ] && |
||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"` |
||||
fi |
||||
|
||||
# For Mingw, ensure paths are in UNIX format before anything is touched |
||||
if $mingw ; then |
||||
[ -n "$M2_HOME" ] && |
||||
M2_HOME="`(cd "$M2_HOME"; pwd)`" |
||||
[ -n "$JAVA_HOME" ] && |
||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" |
||||
fi |
||||
|
||||
if [ -z "$JAVA_HOME" ]; then |
||||
javaExecutable="`which javac`" |
||||
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then |
||||
# readlink(1) is not available as standard on Solaris 10. |
||||
readLink=`which readlink` |
||||
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then |
||||
if $darwin ; then |
||||
javaHome="`dirname \"$javaExecutable\"`" |
||||
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" |
||||
else |
||||
javaExecutable="`readlink -f \"$javaExecutable\"`" |
||||
fi |
||||
javaHome="`dirname \"$javaExecutable\"`" |
||||
javaHome=`expr "$javaHome" : '\(.*\)/bin'` |
||||
JAVA_HOME="$javaHome" |
||||
export JAVA_HOME |
||||
fi |
||||
fi |
||||
fi |
||||
|
||||
if [ -z "$JAVACMD" ] ; then |
||||
if [ -n "$JAVA_HOME" ] ; then |
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then |
||||
# IBM's JDK on AIX uses strange locations for the executables |
||||
JAVACMD="$JAVA_HOME/jre/sh/java" |
||||
else |
||||
JAVACMD="$JAVA_HOME/bin/java" |
||||
fi |
||||
else |
||||
JAVACMD="`\\unset -f command; \\command -v java`" |
||||
fi |
||||
fi |
||||
|
||||
if [ ! -x "$JAVACMD" ] ; then |
||||
echo "Error: JAVA_HOME is not defined correctly." >&2 |
||||
echo " We cannot execute $JAVACMD" >&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then |
||||
echo "Warning: JAVA_HOME environment variable is not set." |
||||
fi |
||||
|
||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher |
||||
|
||||
# traverses directory structure from process work directory to filesystem root |
||||
# first directory with .mvn subdirectory is considered project base directory |
||||
find_maven_basedir() { |
||||
|
||||
if [ -z "$1" ] |
||||
then |
||||
echo "Path not specified to find_maven_basedir" |
||||
return 1 |
||||
fi |
||||
|
||||
basedir="$1" |
||||
wdir="$1" |
||||
while [ "$wdir" != '/' ] ; do |
||||
if [ -d "$wdir"/.mvn ] ; then |
||||
basedir=$wdir |
||||
break |
||||
fi |
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc) |
||||
if [ -d "${wdir}" ]; then |
||||
wdir=`cd "$wdir/.."; pwd` |
||||
fi |
||||
# end of workaround |
||||
done |
||||
echo "${basedir}" |
||||
} |
||||
|
||||
# concatenates all lines of a file |
||||
concat_lines() { |
||||
if [ -f "$1" ]; then |
||||
echo "$(tr -s '\n' ' ' < "$1")" |
||||
fi |
||||
} |
||||
|
||||
BASE_DIR=`find_maven_basedir "$(pwd)"` |
||||
if [ -z "$BASE_DIR" ]; then |
||||
exit 1; |
||||
fi |
||||
|
||||
########################################################################################## |
||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central |
||||
# This allows using the maven wrapper in projects that prohibit checking in binary data. |
||||
########################################################################################## |
||||
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then |
||||
if [ "$MVNW_VERBOSE" = true ]; then |
||||
echo "Found .mvn/wrapper/maven-wrapper.jar" |
||||
fi |
||||
else |
||||
if [ "$MVNW_VERBOSE" = true ]; then |
||||
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." |
||||
fi |
||||
if [ -n "$MVNW_REPOURL" ]; then |
||||
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
||||
else |
||||
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
||||
fi |
||||
while IFS="=" read key value; do |
||||
case "$key" in (wrapperUrl) jarUrl="$value"; break ;; |
||||
esac |
||||
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" |
||||
if [ "$MVNW_VERBOSE" = true ]; then |
||||
echo "Downloading from: $jarUrl" |
||||
fi |
||||
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" |
||||
if $cygwin; then |
||||
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` |
||||
fi |
||||
|
||||
if command -v wget > /dev/null; then |
||||
if [ "$MVNW_VERBOSE" = true ]; then |
||||
echo "Found wget ... using wget" |
||||
fi |
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then |
||||
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" |
||||
else |
||||
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" |
||||
fi |
||||
elif command -v curl > /dev/null; then |
||||
if [ "$MVNW_VERBOSE" = true ]; then |
||||
echo "Found curl ... using curl" |
||||
fi |
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then |
||||
curl -o "$wrapperJarPath" "$jarUrl" -f |
||||
else |
||||
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f |
||||
fi |
||||
|
||||
else |
||||
if [ "$MVNW_VERBOSE" = true ]; then |
||||
echo "Falling back to using Java to download" |
||||
fi |
||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" |
||||
# For Cygwin, switch paths to Windows format before running javac |
||||
if $cygwin; then |
||||
javaClass=`cygpath --path --windows "$javaClass"` |
||||
fi |
||||
if [ -e "$javaClass" ]; then |
||||
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then |
||||
if [ "$MVNW_VERBOSE" = true ]; then |
||||
echo " - Compiling MavenWrapperDownloader.java ..." |
||||
fi |
||||
# Compiling the Java class |
||||
("$JAVA_HOME/bin/javac" "$javaClass") |
||||
fi |
||||
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then |
||||
# Running the downloader |
||||
if [ "$MVNW_VERBOSE" = true ]; then |
||||
echo " - Running MavenWrapperDownloader.java ..." |
||||
fi |
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") |
||||
fi |
||||
fi |
||||
fi |
||||
fi |
||||
########################################################################################## |
||||
# End of extension |
||||
########################################################################################## |
||||
|
||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} |
||||
if [ "$MVNW_VERBOSE" = true ]; then |
||||
echo $MAVEN_PROJECTBASEDIR |
||||
fi |
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" |
||||
|
||||
# For Cygwin, switch paths to Windows format before running java |
||||
if $cygwin; then |
||||
[ -n "$M2_HOME" ] && |
||||
M2_HOME=`cygpath --path --windows "$M2_HOME"` |
||||
[ -n "$JAVA_HOME" ] && |
||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` |
||||
[ -n "$CLASSPATH" ] && |
||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"` |
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] && |
||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` |
||||
fi |
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will |
||||
# work with both Windows and non-Windows executions. |
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" |
||||
export MAVEN_CMD_LINE_ARGS |
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain |
||||
|
||||
exec "$JAVACMD" \ |
||||
$MAVEN_OPTS \ |
||||
$MAVEN_DEBUG_OPTS \ |
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ |
||||
"-Dmaven.home=${M2_HOME}" \ |
||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ |
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" |
||||
@ -0,0 +1,188 @@ |
||||
@REM ---------------------------------------------------------------------------- |
||||
@REM Licensed to the Apache Software Foundation (ASF) under one |
||||
@REM or more contributor license agreements. See the NOTICE file |
||||
@REM distributed with this work for additional information |
||||
@REM regarding copyright ownership. The ASF licenses this file |
||||
@REM to you under the Apache License, Version 2.0 (the |
||||
@REM "License"); you may not use this file except in compliance |
||||
@REM with the License. You may obtain a copy of the License at |
||||
@REM |
||||
@REM https://www.apache.org/licenses/LICENSE-2.0 |
||||
@REM |
||||
@REM Unless required by applicable law or agreed to in writing, |
||||
@REM software distributed under the License is distributed on an |
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
@REM KIND, either express or implied. See the License for the |
||||
@REM specific language governing permissions and limitations |
||||
@REM under the License. |
||||
@REM ---------------------------------------------------------------------------- |
||||
|
||||
@REM ---------------------------------------------------------------------------- |
||||
@REM Maven Start Up Batch script |
||||
@REM |
||||
@REM Required ENV vars: |
||||
@REM JAVA_HOME - location of a JDK home dir |
||||
@REM |
||||
@REM Optional ENV vars |
||||
@REM M2_HOME - location of maven2's installed home dir |
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands |
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending |
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven |
||||
@REM e.g. to debug Maven itself, use |
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files |
||||
@REM ---------------------------------------------------------------------------- |
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' |
||||
@echo off |
||||
@REM set title of command window |
||||
title %0 |
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' |
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% |
||||
|
||||
@REM set %HOME% to equivalent of $HOME |
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") |
||||
|
||||
@REM Execute a user defined script before this one |
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre |
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending |
||||
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* |
||||
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* |
||||
:skipRcPre |
||||
|
||||
@setlocal |
||||
|
||||
set ERROR_CODE=0 |
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal |
||||
@setlocal |
||||
|
||||
@REM ==== START VALIDATION ==== |
||||
if not "%JAVA_HOME%" == "" goto OkJHome |
||||
|
||||
echo. |
||||
echo Error: JAVA_HOME not found in your environment. >&2 |
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2 |
||||
echo location of your Java installation. >&2 |
||||
echo. |
||||
goto error |
||||
|
||||
:OkJHome |
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init |
||||
|
||||
echo. |
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2 |
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2 |
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2 |
||||
echo location of your Java installation. >&2 |
||||
echo. |
||||
goto error |
||||
|
||||
@REM ==== END VALIDATION ==== |
||||
|
||||
:init |
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". |
||||
@REM Fallback to current working directory if not found. |
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% |
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir |
||||
|
||||
set EXEC_DIR=%CD% |
||||
set WDIR=%EXEC_DIR% |
||||
:findBaseDir |
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound |
||||
cd .. |
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound |
||||
set WDIR=%CD% |
||||
goto findBaseDir |
||||
|
||||
:baseDirFound |
||||
set MAVEN_PROJECTBASEDIR=%WDIR% |
||||
cd "%EXEC_DIR%" |
||||
goto endDetectBaseDir |
||||
|
||||
:baseDirNotFound |
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR% |
||||
cd "%EXEC_DIR%" |
||||
|
||||
:endDetectBaseDir |
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig |
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion |
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a |
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% |
||||
|
||||
:endReadAdditionalConfig |
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" |
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" |
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain |
||||
|
||||
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
||||
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( |
||||
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B |
||||
) |
||||
|
||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central |
||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data. |
||||
if exist %WRAPPER_JAR% ( |
||||
if "%MVNW_VERBOSE%" == "true" ( |
||||
echo Found %WRAPPER_JAR% |
||||
) |
||||
) else ( |
||||
if not "%MVNW_REPOURL%" == "" ( |
||||
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
||||
) |
||||
if "%MVNW_VERBOSE%" == "true" ( |
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ... |
||||
echo Downloading from: %DOWNLOAD_URL% |
||||
) |
||||
|
||||
powershell -Command "&{"^ |
||||
"$webclient = new-object System.Net.WebClient;"^ |
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ |
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ |
||||
"}"^ |
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ |
||||
"}" |
||||
if "%MVNW_VERBOSE%" == "true" ( |
||||
echo Finished downloading %WRAPPER_JAR% |
||||
) |
||||
) |
||||
@REM End of extension |
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will |
||||
@REM work with both Windows and non-Windows executions. |
||||
set MAVEN_CMD_LINE_ARGS=%* |
||||
|
||||
%MAVEN_JAVA_EXE% ^ |
||||
%JVM_CONFIG_MAVEN_PROPS% ^ |
||||
%MAVEN_OPTS% ^ |
||||
%MAVEN_DEBUG_OPTS% ^ |
||||
-classpath %WRAPPER_JAR% ^ |
||||
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ |
||||
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* |
||||
if ERRORLEVEL 1 goto error |
||||
goto end |
||||
|
||||
:error |
||||
set ERROR_CODE=1 |
||||
|
||||
:end |
||||
@endlocal & set ERROR_CODE=%ERROR_CODE% |
||||
|
||||
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost |
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending |
||||
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" |
||||
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" |
||||
:skipRcPost |
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' |
||||
if "%MAVEN_BATCH_PAUSE%"=="on" pause |
||||
|
||||
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% |
||||
|
||||
cmd /C exit /B %ERROR_CODE% |
||||
@ -0,0 +1,150 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-parent</artifactId> |
||||
<version>2.3.1.RELEASE</version> |
||||
<relativePath/> <!-- lookup parent from repository --> |
||||
</parent> |
||||
<groupId>com.ynxbd</groupId> |
||||
<artifactId>push</artifactId> |
||||
<version>0.0.1</version> |
||||
<name>push</name> |
||||
<description>wx push</description> |
||||
|
||||
<properties> |
||||
<java.version>1.8</java.version> |
||||
<swagger.version>3.0.0</swagger.version> |
||||
<logback.version>1.2.11</logback.version> |
||||
<fastjson.version>1.2.83</fastjson.version> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-web</artifactId> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-devtools</artifactId> |
||||
<scope>runtime</scope> |
||||
<optional>true</optional> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.projectlombok</groupId> |
||||
<artifactId>lombok</artifactId> |
||||
<optional>true</optional> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.ehcache</groupId> |
||||
<artifactId>ehcache</artifactId> |
||||
<version>3.9.9</version> |
||||
</dependency> |
||||
|
||||
|
||||
<dependency> |
||||
<groupId>ch.qos.logback</groupId> |
||||
<artifactId>logback-classic</artifactId> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>commons-codec</groupId> |
||||
<artifactId>commons-codec</artifactId> |
||||
<version>1.15</version> |
||||
</dependency> |
||||
|
||||
<!--dom4j--> |
||||
<dependency> |
||||
<groupId>org.dom4j</groupId> |
||||
<artifactId>dom4j</artifactId> |
||||
<version>2.1.3</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-test</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>com.alibaba</groupId> |
||||
<artifactId>fastjson</artifactId> |
||||
<version>${fastjson.version}</version> |
||||
</dependency> |
||||
|
||||
|
||||
<dependency> |
||||
<groupId>org.apache.commons</groupId> |
||||
<artifactId>commons-lang3</artifactId> |
||||
<version>3.4</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.apache.commons</groupId> |
||||
<artifactId>commons-compress</artifactId> |
||||
<version>1.19</version> |
||||
</dependency> |
||||
<!--微信插件--> |
||||
|
||||
<dependency> |
||||
<groupId>com.github.liyiorg</groupId> |
||||
<artifactId>weixin-popular</artifactId> |
||||
<version>2.8.30</version> |
||||
</dependency> |
||||
|
||||
<!-- mysql驱动包 --> |
||||
<dependency> |
||||
<groupId>mysql</groupId> |
||||
<artifactId>mysql-connector-java</artifactId> |
||||
<version>5.1.47</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.quartz-scheduler</groupId> |
||||
<artifactId>quartz</artifactId> |
||||
<version>2.3.2</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.apache.httpcomponents</groupId> |
||||
<artifactId>httpasyncclient</artifactId> |
||||
<version>4.1.4</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.apache.httpcomponents</groupId> |
||||
<artifactId>httpcore-nio</artifactId> |
||||
<version>4.4.3</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.ini4j</groupId> |
||||
<artifactId>ini4j</artifactId> |
||||
<version>0.5.4</version> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
|
||||
<configuration> |
||||
<excludes> |
||||
<exclude> |
||||
<groupId>org.projectlombok</groupId> |
||||
<artifactId>lombok</artifactId> |
||||
</exclude> |
||||
</excludes> |
||||
</configuration> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
|
||||
</project> |
||||
@ -0,0 +1,19 @@ |
||||
package com.ynxbd.push; |
||||
|
||||
import com.ynxbd.push.config.IniConfig; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.boot.SpringApplication; |
||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
import org.springframework.boot.builder.SpringApplicationBuilder; |
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
||||
|
||||
@Slf4j |
||||
@SpringBootApplication() |
||||
public class AppApplication extends SpringBootServletInitializer { |
||||
|
||||
|
||||
public static void main(String[] args) { |
||||
SpringApplication.run(AppApplication.class, args); |
||||
log.info("启动医院为:{}", IniConfig.getInstance("name")); |
||||
} |
||||
} |
||||
@ -0,0 +1,150 @@ |
||||
package com.ynxbd.push.config; |
||||
|
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.ehcache.Cache; |
||||
import org.ehcache.CacheManager; |
||||
import org.ehcache.config.ResourcePools; |
||||
import org.ehcache.config.ResourceType; |
||||
import org.ehcache.config.builders.CacheConfigurationBuilder; |
||||
import org.ehcache.config.builders.CacheManagerBuilder; |
||||
import org.ehcache.config.builders.ExpiryPolicyBuilder; |
||||
import org.ehcache.config.builders.ResourcePoolsBuilder; |
||||
import org.ehcache.config.units.MemoryUnit; |
||||
import org.ehcache.xml.XmlConfiguration; |
||||
|
||||
import java.net.URL; |
||||
import java.time.Duration; |
||||
|
||||
/** |
||||
* EHCache缓存 |
||||
* |
||||
* @Author wsq |
||||
* @Date 2020-09-09 11:50 |
||||
*/ |
||||
@Slf4j |
||||
public class EhCacheConfig { |
||||
|
||||
// 私有化构造方法
|
||||
private EhCacheConfig() { |
||||
} |
||||
|
||||
private static CacheManager cacheManager = null; |
||||
|
||||
private static Cache<String, String> cache = null; |
||||
|
||||
static { |
||||
initCacheManager(); |
||||
} |
||||
|
||||
public synchronized static void initCacheManager() { |
||||
if (cacheManager == null) { |
||||
URL url = EhCacheConfig.class.getResource("/ehcache.xml"); |
||||
if (url != null) { |
||||
XmlConfiguration xmlConfiguration = new XmlConfiguration(url); |
||||
cacheManager = CacheManagerBuilder.newCacheManager(xmlConfiguration); |
||||
cacheManager.init(); |
||||
cache = cacheManager.getCache("default_cache", String.class, String.class); |
||||
} else { |
||||
log.error("EHCache读取配置文件失败"); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public static Cache<String, String> getDefaultCache() { |
||||
if (cache == null) { |
||||
if (cacheManager == null) { |
||||
initCacheManager(); |
||||
} |
||||
cache = cacheManager.getCache("default_cache", String.class, String.class); |
||||
} |
||||
return cache; |
||||
} |
||||
|
||||
/** |
||||
* 创建一个缓存 |
||||
* |
||||
* @param K key |
||||
* @param V val |
||||
* @param cacheName 缓存名 |
||||
* @param timeToLiveExpiration 最大过期时间(S) |
||||
* @return 缓存 |
||||
*/ |
||||
public static <K, V> Cache<K, V> createCacheTTL(Class<K> K, Class<V> V, String cacheName, Long timeToLiveExpiration) { |
||||
return createCache(K, V, cacheName, null, null, null, true, timeToLiveExpiration, null); |
||||
} |
||||
|
||||
/** |
||||
* 创建一个缓存 |
||||
* |
||||
* @param cacheName 缓存名 |
||||
* @param timeToIdleExpiration 最大空闲时间(S) |
||||
* @return 缓存 |
||||
*/ |
||||
public static <K, V> Cache<K, V> createCacheTTI(Class<K> K, Class<V> V, String cacheName, Long timeToIdleExpiration) { |
||||
return createCache(K, V, cacheName, null, null, null, true, null, timeToIdleExpiration); |
||||
} |
||||
|
||||
/** |
||||
* 创建一个缓存 |
||||
* |
||||
* @param cacheName 缓存名 |
||||
* @param heap 堆内缓存大小(MB) |
||||
* @param offHeap 堆外缓存大小(MB) |
||||
* @param disk 磁盘缓存大小(MB) |
||||
* @param isPersistent 重启时是否从磁盘中读取 |
||||
* <p> |
||||
* 两者不可并存,方法中两者同时存在时以[ttl最大存活时间为主] |
||||
* @param timeToLiveExpiration 最大存活时间(S) |
||||
* @param timeToIdleExpiration 该时间内未访问则失效(S) |
||||
* @return 缓存对象 |
||||
*/ |
||||
public synchronized static <K, V> Cache<K, V> createCache(Class<K> K, Class<V> V, String cacheName, Long heap, Long offHeap, Long disk, boolean isPersistent, Long timeToLiveExpiration, Long timeToIdleExpiration) { |
||||
if (timeToLiveExpiration != null && timeToIdleExpiration != null) { |
||||
timeToIdleExpiration = null; |
||||
} |
||||
|
||||
if (cacheManager == null) { |
||||
initCacheManager(); |
||||
} |
||||
|
||||
if (heap == null || offHeap == null || disk == null) { |
||||
// 读取xml配置
|
||||
ResourcePools resourcePools = cache.getRuntimeConfiguration().getResourcePools(); |
||||
System.out.println(resourcePools); |
||||
heap = resourcePools.getPoolForResource(ResourceType.Core.HEAP).getSize(); |
||||
offHeap = resourcePools.getPoolForResource(ResourceType.Core.OFFHEAP).getSize(); |
||||
disk = resourcePools.getPoolForResource(ResourceType.Core.DISK).getSize(); |
||||
} |
||||
|
||||
Cache<K, V> cache = cacheManager.getCache(cacheName, K, V); |
||||
if (cache != null) { |
||||
return cache; |
||||
} |
||||
|
||||
return cacheManager.createCache(cacheName, |
||||
CacheConfigurationBuilder.newCacheConfigurationBuilder(K, V, |
||||
ResourcePoolsBuilder.newResourcePoolsBuilder() |
||||
.heap(heap, MemoryUnit.MB) |
||||
.offheap(offHeap, MemoryUnit.MB) |
||||
.disk(disk, MemoryUnit.MB, isPersistent)).withExpiry( |
||||
timeToLiveExpiration == null |
||||
? ExpiryPolicyBuilder.timeToIdleExpiration(Duration.ofSeconds(timeToIdleExpiration)) |
||||
: ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofSeconds(timeToLiveExpiration)) |
||||
) |
||||
); |
||||
} |
||||
|
||||
public static void close() { |
||||
if (cacheManager != null) cacheManager.close(); |
||||
} |
||||
|
||||
|
||||
public static void main(String[] args) throws InterruptedException { |
||||
Cache<String, String> testCache = EhCacheConfig.createCacheTTL(String.class, String.class, "test", 3600L); |
||||
|
||||
testCache.put("1", "123"); |
||||
System.out.println(testCache.get("1")); |
||||
|
||||
cacheManager.close(); |
||||
} |
||||
} |
||||
@ -0,0 +1,73 @@ |
||||
package com.ynxbd.push.config; |
||||
|
||||
import com.ynxbd.push.helper.IPHelper; |
||||
import com.ynxbd.push.helper.ProperHelper; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.ini4j.Wini; |
||||
import org.springframework.util.ResourceUtils; |
||||
|
||||
import java.io.IOException; |
||||
import java.io.InputStream; |
||||
|
||||
|
||||
/** |
||||
* 获取有关appId跟secret等相关配置信息 |
||||
* |
||||
* @author 李进才 |
||||
* 单例模式-静态代码块 |
||||
*/ |
||||
@Slf4j |
||||
public class IniConfig { |
||||
private IniConfig() { |
||||
} |
||||
|
||||
private static final Wini WINI; |
||||
private static final String IP; |
||||
|
||||
// 静态内部类保证Wini只实例化一次
|
||||
static { |
||||
WINI = initConfig(); |
||||
IP = IPHelper.getIp(); |
||||
log.info("IP:{}", IP); |
||||
} |
||||
|
||||
/** |
||||
* 获取项目的配置信息 |
||||
*/ |
||||
public synchronized static Wini initConfig() { |
||||
try { |
||||
Wini wini = new Wini(); |
||||
try (InputStream in = IniConfig.class.getClassLoader().getResourceAsStream("weChat.ini")) { |
||||
wini.load(in); |
||||
} catch (IOException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return wini; |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取项目的配置信息 |
||||
* |
||||
* @param key 配置信息的关键词 |
||||
*/ |
||||
public static String getInstance(String key) { |
||||
return WINI.fetch(IP, key); |
||||
} |
||||
|
||||
/** |
||||
* 测试是否读取成功 |
||||
* |
||||
*/ |
||||
public static String test() { |
||||
return WINI.fetch("10.20.10.60", "name"); |
||||
} |
||||
|
||||
public static void main(String[] args) { |
||||
System.out.println(test()); |
||||
} |
||||
} |
||||
@ -0,0 +1,51 @@ |
||||
package com.ynxbd.push.controller; |
||||
|
||||
|
||||
import com.ynxbd.push.config.IniConfig; |
||||
import com.ynxbd.push.entity.tencent.SendMessageTemplate; |
||||
import com.ynxbd.push.helper.DesEncryptHelper; |
||||
import com.ynxbd.push.helper.MessageApiHelper; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
import weixin.popular.bean.message.MessageSendResult; |
||||
|
||||
import java.io.IOException; |
||||
|
||||
|
||||
/** |
||||
* @author absorber |
||||
*/ |
||||
@Slf4j |
||||
@Controller |
||||
public class MiddlePlatformController { |
||||
|
||||
|
||||
@GetMapping(value = "DaoYiXun") |
||||
@ResponseBody |
||||
public MessageSendResult daoYiXun(String openId, String deptName, String deptCode, String patientName, String content) throws IOException { |
||||
String templateId = IniConfig.getInstance("daoYiXunTemplateId"); |
||||
openId = DesEncryptHelper.deCode(openId); |
||||
log.info("openid={}, templateId={}", openId, templateId); |
||||
|
||||
String daoYiXunAppId = IniConfig.getInstance("daoYiXunAppId"); |
||||
String daoYiXunSecret = IniConfig.getInstance("daoYiXunSecret"); |
||||
String daoYiXunHospitalId = IniConfig.getInstance("daoYiXunHospitalId"); |
||||
SendMessageTemplate sendMessageTemplate = SendMessageTemplate.builder() |
||||
.appId(daoYiXunAppId) |
||||
.template_id(templateId) |
||||
.keyword1(patientName) |
||||
.keyword2(content) |
||||
.keyword3(deptName) |
||||
.first("点击进入导航") |
||||
.openId(openId) |
||||
.url(new StringBuilder().append("https://map.ipsmap.com?id=").append(daoYiXunHospitalId) |
||||
.append("&poi=0324&appKey=").append(daoYiXunSecret).toString()) |
||||
.pagePath(new StringBuilder().append("pages/index?id=").append(daoYiXunHospitalId) |
||||
.append("&poi=").append(deptCode).append("&appKey=").append(daoYiXunSecret).toString()) |
||||
.build(); |
||||
|
||||
return MessageApiHelper.templateMessageSend(sendMessageTemplate); |
||||
} |
||||
} |
||||
@ -0,0 +1,125 @@ |
||||
package com.ynxbd.push.controller; |
||||
|
||||
|
||||
import com.ynxbd.push.config.IniConfig; |
||||
import com.ynxbd.push.entity.tencent.SendMessageTemplate; |
||||
import com.ynxbd.push.helper.DesEncryptHelper; |
||||
import com.ynxbd.push.helper.MessageApiHelper; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
import weixin.popular.bean.message.MessageSendResult; |
||||
|
||||
import java.io.IOException; |
||||
|
||||
|
||||
/** |
||||
* @author 李进才 |
||||
* @ClassName RegisteredController |
||||
* @Description 微信挂号相关提醒 |
||||
* @date 2021/12/6 4:07 下午 |
||||
*/ |
||||
@Slf4j |
||||
@Controller |
||||
public class RegisteredController { |
||||
|
||||
/** |
||||
* 预约挂号成功提醒 对应我代码规定的第12个模版 code 12 |
||||
* |
||||
* @param openId |
||||
* @param deptName |
||||
* @param patientName |
||||
* @param sex |
||||
* @param seq |
||||
* @return |
||||
*/ |
||||
@GetMapping(value = "AppointmentSuccess") |
||||
@ResponseBody |
||||
public MessageSendResult AppointmentSuccess(String openId, String doctor, String deptName, String patientName, String sex, String seq) throws IOException { |
||||
String templateId = IniConfig.getInstance("templateId12"); |
||||
String hospital = IniConfig.getInstance("name"); |
||||
openId = DesEncryptHelper.deCode(openId); |
||||
|
||||
log.info("openid={}, patientName={}, deptName={}, seq={}", openId, patientName, deptName, seq); |
||||
|
||||
|
||||
SendMessageTemplate sendMessageTemplate = SendMessageTemplate.builder() |
||||
.template_id(templateId) |
||||
.code(12) |
||||
.doctor(doctor) |
||||
.openId(openId) |
||||
.department(deptName) |
||||
.patientName(patientName) |
||||
.hospitalName(hospital) |
||||
.first("预约挂号成功") |
||||
.seq(seq) |
||||
.patientSex(sex) |
||||
.remarkColor("#fa4028") |
||||
.remark(IniConfig.getInstance("remark12")) |
||||
.build(); |
||||
|
||||
return MessageApiHelper.templateMessageSend(sendMessageTemplate); |
||||
} |
||||
|
||||
/** |
||||
* 取消预约挂号 对应我代码规定的第9个模版 code 9 |
||||
* |
||||
* @param deptName |
||||
* @param doctor |
||||
* @param treatTime |
||||
* @param openId |
||||
* @param patientName |
||||
* @param seq |
||||
* @return |
||||
* @throws IOException |
||||
*/ |
||||
@GetMapping(value = "AppointmentCancel") |
||||
@ResponseBody |
||||
public MessageSendResult AppointmentCancel(String deptName, String doctor, String treatTime, String openId, String patientName, String seq) throws IOException { |
||||
String templateId = IniConfig.getInstance("templateId9"); |
||||
String hospital = IniConfig.getInstance("name"); |
||||
openId = DesEncryptHelper.deCode(openId); |
||||
SendMessageTemplate sendMessageTemplate = SendMessageTemplate.builder() |
||||
.template_id(templateId) |
||||
.openId(openId) |
||||
.keyword1(hospital) |
||||
.keyword2(deptName) |
||||
.keyword3(doctor) |
||||
.keyword4(treatTime) |
||||
.remarkColor("#fa4028") |
||||
.remark(new StringBuilder().append("取消预约,").append("患者姓名:").append(patientName).append(",").append("流水号:").append(seq).toString()) |
||||
.build(); |
||||
return MessageApiHelper.templateMessageSend(sendMessageTemplate); |
||||
} |
||||
|
||||
/** |
||||
* 缴费成功提醒 对应我代码规定的第4个模版 code 4 |
||||
* |
||||
* @param openId |
||||
* @param patientName |
||||
* @param deptName |
||||
* @param doctor |
||||
* @param allMoney |
||||
* @param payTime |
||||
* @return |
||||
* @throws IOException |
||||
*/ |
||||
@GetMapping(value = "PaymentSuccess") |
||||
@ResponseBody |
||||
public MessageSendResult PaymentSuccess(String openId, String patientName, String deptName, String doctor, String allMoney, String payTime) throws IOException { |
||||
openId = DesEncryptHelper.deCode(openId); |
||||
String templateId = IniConfig.getInstance("templateId4"); |
||||
SendMessageTemplate sendMessageTemplate = SendMessageTemplate.builder() |
||||
.keyword1(patientName) |
||||
.keyword2(deptName) |
||||
.keyword3(doctor) |
||||
.keyword4(allMoney) |
||||
.keyword5(payTime) |
||||
.template_id(templateId) |
||||
.openId(openId) |
||||
.build(); |
||||
return MessageApiHelper.templateMessageSend(sendMessageTemplate); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,66 @@ |
||||
package com.ynxbd.push.controller; |
||||
|
||||
import com.ynxbd.push.config.IniConfig; |
||||
import com.ynxbd.push.entity.tencent.SendMessageTemplate; |
||||
import com.ynxbd.push.entity.tencent.WeChatResponse; |
||||
import com.ynxbd.push.helper.DesEncryptHelper; |
||||
import com.ynxbd.push.helper.MessageApiHelper; |
||||
import org.apache.http.Header; |
||||
import org.apache.http.client.methods.HttpUriRequest; |
||||
import org.apache.http.client.methods.RequestBuilder; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
import weixin.popular.bean.message.MessageSendResult; |
||||
import weixin.popular.client.LocalHttpClient; |
||||
|
||||
import java.io.IOException; |
||||
|
||||
/** |
||||
* @author 李进才 |
||||
* @ClassName ReportController |
||||
* @Description 发送lis报告单结果推送 |
||||
* @date 2021/12/6 3:23 下午 |
||||
*/ |
||||
@Controller |
||||
public class ReportController { |
||||
|
||||
public static final String NOT_FIND_DATA = "40004"; |
||||
protected static Header jsonHeader; |
||||
|
||||
@GetMapping(value = "Report") |
||||
@ResponseBody |
||||
public MessageSendResult ReportTip(String patientId, String itemName, String collectTime, String patientName) throws IOException { |
||||
String reportTemplateId = IniConfig.getInstance("lisReportTemplateId"); |
||||
String weChatUrl = IniConfig.getInstance("weChatUrl"); |
||||
HttpUriRequest httpUriRequest = RequestBuilder |
||||
.get() |
||||
.setHeader(jsonHeader) |
||||
.setUri(new StringBuilder() |
||||
.append(weChatUrl) |
||||
.append("patient/getOpenIdsByPatientId.do").toString()) |
||||
.addParameter("patientId", patientId) |
||||
.addParameter("algorithm", "des") |
||||
.addParameter("isEncryptComma", "false") |
||||
.addParameter("isLastBind", "true") |
||||
.build(); |
||||
WeChatResponse weChatResponse = LocalHttpClient.executeJsonResult(httpUriRequest, WeChatResponse.class); |
||||
if (weChatResponse.getData() == null) { |
||||
MessageSendResult messageSendResult = new MessageSendResult(); |
||||
messageSendResult.setErrcode(NOT_FIND_DATA); |
||||
messageSendResult.setMsg_status("NOT_FIND_DATA"); |
||||
return messageSendResult; |
||||
} |
||||
String openId = DesEncryptHelper.deCode(weChatResponse.getData()); |
||||
SendMessageTemplate sendMessageTemplate = SendMessageTemplate.builder() |
||||
.template_id(reportTemplateId) |
||||
.keyword1(itemName) |
||||
.keyword2(patientName) |
||||
.keyword3(collectTime) |
||||
.first("您的检验报告结果已经出来了") |
||||
.openId(openId) |
||||
.url(new StringBuilder().append(weChatUrl).append("web/all-result.html#/lis-report-inspect").toString()) |
||||
.build(); |
||||
return MessageApiHelper.templateMessageSend(sendMessageTemplate); |
||||
} |
||||
} |
||||
@ -0,0 +1,24 @@ |
||||
package com.ynxbd.push.controller; |
||||
|
||||
import com.ynxbd.push.helper.RSAHelper; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
||||
|
||||
/** |
||||
* @author 李进才 |
||||
*/ |
||||
@Slf4j |
||||
@Controller |
||||
public class RsaController { |
||||
|
||||
@GetMapping(value = "PublicKey") |
||||
@ResponseBody |
||||
public String publicKey() { |
||||
log.info("privateKey={}" + RSAHelper.getPrivateKey()); |
||||
return RSAHelper.getPublicKey(); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,175 @@ |
||||
package com.ynxbd.push.controller; |
||||
|
||||
|
||||
import com.ynxbd.push.entity.*; |
||||
import com.ynxbd.push.entity.tencent.AllUser; |
||||
import com.ynxbd.push.entity.tencent.SendMessageTemplate; |
||||
import com.ynxbd.push.entity.tencent.Subscribe; |
||||
import com.ynxbd.push.entity.tencent.WeChatUserInfo; |
||||
import com.ynxbd.push.helper.DesEncryptHelper; |
||||
import com.ynxbd.push.httpRequest.tencent.WeChatDataRequest; |
||||
import com.ynxbd.push.helper.MessageApiHelper; |
||||
import com.ynxbd.push.httpRequest.xbd.wx.WxCacheRequest; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
import weixin.popular.bean.message.MessageSendResult; |
||||
|
||||
import java.io.IOException; |
||||
|
||||
/** |
||||
* @author 李进才 |
||||
*/ |
||||
@Slf4j |
||||
@Controller |
||||
public class SendMessageController { |
||||
|
||||
|
||||
/** |
||||
* 发送微信客服消息接口 |
||||
* |
||||
* @param openId 客户openid,指示哪个用户 |
||||
* @param content 内容 |
||||
* @return 是否发送成功 |
||||
*/ |
||||
|
||||
@GetMapping(value = "SendMessage") |
||||
@ResponseBody |
||||
public Boolean sendMessage(String openId, String content) { |
||||
openId = DesEncryptHelper.deCode(openId); |
||||
String messageSendResult = MessageApiHelper.sendTextForOpenId(openId, content).getErrcode(); |
||||
return "0".equals(messageSendResult); |
||||
} |
||||
|
||||
/** |
||||
* 发送微信客服带图片链接消息接口 |
||||
* |
||||
* @param openId 客户id,指示哪个用户 |
||||
* @param title 标题 |
||||
* @param description 描述 |
||||
* @param url 跳转链接 |
||||
* @param thumbUrl 图片链接 |
||||
* @return 是否发送成功 |
||||
*/ |
||||
|
||||
@PostMapping(value = "SendLinkMessage") |
||||
@ResponseBody |
||||
public Boolean sendLinkMessage(String openId, String title, String description, String url, String thumbUrl) { |
||||
openId = DesEncryptHelper.deCode(openId); |
||||
String messageSendResult = MessageApiHelper.sendLinkForOpenId(openId, title, description, url, thumbUrl).getErrcode(); |
||||
return "0".equals(messageSendResult); |
||||
} |
||||
|
||||
/** |
||||
* 群发消息接口 |
||||
* |
||||
* @param content 内容 |
||||
* @return 是否发送成功 |
||||
*/ |
||||
@GetMapping(value = "GroupMessage") |
||||
@ResponseBody |
||||
public Boolean groupMessage(String content) { |
||||
if (content == null) { |
||||
return false; |
||||
} |
||||
String messageSendResult = MessageApiHelper.group(content).getErrcode(); |
||||
return "0".equals(messageSendResult); |
||||
} |
||||
|
||||
/** |
||||
* 发送模板信息接口 |
||||
* |
||||
* @param sendMessageTemplate 不同模板的对应参数 |
||||
* @return 是否发送成功 |
||||
*/ |
||||
@PostMapping(value = "TemplateMessageSend") |
||||
@ResponseBody |
||||
public MessageSendResult templateMessageSend(SendMessageTemplate sendMessageTemplate) { |
||||
if (StringUtils.isNotBlank(sendMessageTemplate.getDoctor())) { |
||||
sendMessageTemplate.setOpenId(WeChatDataRequest.getOpenIdForDoctorCode(sendMessageTemplate.getDoctorCode()).getData()); |
||||
} |
||||
if (StringUtils.isNotBlank(sendMessageTemplate.getTemplate_name()) && !StringUtils.isNotBlank(sendMessageTemplate.getTemplate_id())) { |
||||
sendMessageTemplate.setTemplate_id(WeChatDataRequest.getTemplateId(sendMessageTemplate.getTemplate_name())); |
||||
} |
||||
log.info("template_id:" + sendMessageTemplate.getTemplate_id()); |
||||
log.info("code:" + sendMessageTemplate.getCode()); |
||||
log.info("open_id:" + sendMessageTemplate.getOpenId()); |
||||
|
||||
sendMessageTemplate.setOpenId(DesEncryptHelper.deCode(sendMessageTemplate.getOpenId())); |
||||
return MessageApiHelper.templateMessageSend(sendMessageTemplate); |
||||
} |
||||
|
||||
/** |
||||
* 请求access_token |
||||
* |
||||
* @return access_token值 |
||||
*/ |
||||
@PostMapping(value = "AccessToken") |
||||
@ResponseBody |
||||
public String accessToken() { |
||||
return WxCacheRequest.getAccessToken(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取微信用户详细信息 |
||||
* |
||||
* @param openId |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
@PostMapping(value = "UserInfo") |
||||
@ResponseBody |
||||
public WeChatUserInfo userInfo(String openId) throws Exception { |
||||
log.info("UserInfo:OpenId=" + DesEncryptHelper.deCode(openId)); |
||||
return WeChatDataRequest.userInfo(DesEncryptHelper.deCode(openId)); |
||||
} |
||||
|
||||
/** |
||||
* 解密 |
||||
* |
||||
* @param openId |
||||
* @return |
||||
*/ |
||||
@GetMapping(value = "Encode") |
||||
@ResponseBody |
||||
public String encode(String openId) { |
||||
return DesEncryptHelper.enCode(openId); |
||||
} |
||||
|
||||
/** |
||||
* 获取所有用户openid |
||||
* |
||||
* @param nextOpenid |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
@PostMapping(value = "GetAllUser") |
||||
@ResponseBody |
||||
public AllUser getAllUser(String nextOpenid) { |
||||
return MessageApiHelper.getAllUser(nextOpenid); |
||||
} |
||||
|
||||
/** |
||||
* 群发模版消息 |
||||
* |
||||
* @param sendMessageTemplate |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
@PostMapping(value = "GroupTemplateMessage") |
||||
@ResponseBody |
||||
public CompleteThreadCount groupTemplateMessage(SendMessageTemplate sendMessageTemplate) throws IOException, InterruptedException { |
||||
return MessageApiHelper.groupTemplateSend(sendMessageTemplate); |
||||
} |
||||
|
||||
|
||||
@PostMapping(value = "SubscribeMessage") |
||||
@ResponseBody |
||||
public MessageSendResult subscribeMessage(Subscribe subscribe) throws Exception { |
||||
return MessageApiHelper.subscribeMessage(subscribe); |
||||
} |
||||
} |
||||
@ -0,0 +1,18 @@ |
||||
package com.ynxbd.push.controller; |
||||
|
||||
import com.ynxbd.push.config.IniConfig; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
@RestController |
||||
@RequestMapping("test") |
||||
public class TestController { |
||||
|
||||
@GetMapping("test01") |
||||
public String test01() { |
||||
String id = IniConfig.test(); |
||||
System.out.println(id); |
||||
return "success"; |
||||
} |
||||
} |
||||
@ -0,0 +1,12 @@ |
||||
package com.ynxbd.push.entity; |
||||
|
||||
import lombok.Builder; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
@Builder |
||||
public class CompleteThreadCount { |
||||
private Integer completed; |
||||
private Integer failed; |
||||
private Integer cancelled; |
||||
} |
||||
@ -0,0 +1,16 @@ |
||||
package com.ynxbd.push.entity.tencent; |
||||
|
||||
import lombok.Data; |
||||
import lombok.ToString; |
||||
import weixin.popular.bean.BaseResult; |
||||
|
||||
import java.util.Map; |
||||
|
||||
@Data |
||||
@ToString |
||||
public class AllUser extends BaseResult { |
||||
private Integer total; |
||||
private Integer count; |
||||
private Map<String, Object> data; |
||||
private String next_openid; |
||||
} |
||||
@ -0,0 +1,48 @@ |
||||
package com.ynxbd.push.entity.tencent; |
||||
|
||||
|
||||
|
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 客户接口消息发送实体 |
||||
* |
||||
* @author |
||||
* @date 2018-2-6 11:00:30 |
||||
*/ |
||||
public class LinkMessage { |
||||
|
||||
//openid
|
||||
private String touser; |
||||
|
||||
//消息类型
|
||||
private String msgtype; |
||||
|
||||
//消息内容
|
||||
private Map<String,Object> link ; |
||||
|
||||
|
||||
public String getTouser() { |
||||
return touser; |
||||
} |
||||
|
||||
public void setTouser(String touser) { |
||||
this.touser = touser; |
||||
} |
||||
|
||||
public String getMsgtype() { |
||||
return msgtype; |
||||
} |
||||
|
||||
public void setMsgtype(String msgtype) { |
||||
this.msgtype = msgtype; |
||||
} |
||||
|
||||
public Map<String, Object> getLink() { |
||||
return link; |
||||
} |
||||
|
||||
public void setLink(Map<String, Object> link) { |
||||
this.link = link; |
||||
} |
||||
} |
||||
@ -0,0 +1,11 @@ |
||||
package com.ynxbd.push.entity.tencent; |
||||
|
||||
import lombok.Builder; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
@Builder |
||||
public class OpenId { |
||||
private String openid; |
||||
private String lang; |
||||
} |
||||
@ -0,0 +1,16 @@ |
||||
package com.ynxbd.push.entity.tencent; |
||||
|
||||
import lombok.Builder; |
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author 李进才 |
||||
*/ |
||||
@Data |
||||
@Builder |
||||
public class OpenIdList { |
||||
List<List<String>> openIds; |
||||
Integer count; |
||||
} |
||||
@ -0,0 +1,84 @@ |
||||
package com.ynxbd.push.entity.tencent; |
||||
|
||||
import lombok.Builder; |
||||
import lombok.Data; |
||||
import lombok.experimental.Tolerate; |
||||
|
||||
/** |
||||
* @author absorber |
||||
*/ |
||||
@Builder |
||||
@Data |
||||
public class SendMessageTemplate { |
||||
private int code; |
||||
public String template_id; |
||||
public String keyword1; |
||||
private String template_name; |
||||
private String keyword1Color = "#173177"; |
||||
public String keyword2; |
||||
private String keyword2Color = "#173177"; |
||||
public String keyword3; |
||||
private String keyword3Color = "#173177"; |
||||
public String keyword4; |
||||
private String keyword4Color = "#173177"; |
||||
public String keyword5; |
||||
private String keyword5Color = "#173177"; |
||||
private String openId; |
||||
private String url; |
||||
private String first; |
||||
private String firstColor = "#173177"; |
||||
private String patientName; |
||||
private String patientSex; |
||||
private String appId; |
||||
private String pagePath; |
||||
private String hospitalName; |
||||
private String department; |
||||
private String doctor; |
||||
private String seq; |
||||
private String remark; |
||||
|
||||
private String remarkColor = "#173177"; |
||||
/** |
||||
* 当前号码 |
||||
*/ |
||||
private String currentNumber; |
||||
/** |
||||
* 自身号码 |
||||
*/ |
||||
private String selfNumber; |
||||
/** |
||||
* 等待人数 |
||||
*/ |
||||
private String waitNumber; |
||||
/** |
||||
* 检查结果通知-就诊项目 |
||||
*/ |
||||
private String item; |
||||
private String time; |
||||
private String money; |
||||
private String bedNumber; |
||||
private String arrivalTime; |
||||
/** |
||||
* 信息完善提醒-消息类型 |
||||
*/ |
||||
private String messageType; |
||||
/** |
||||
* 健康卡成功升级通知-升级说明 |
||||
*/ |
||||
private String updateDescription; |
||||
/** |
||||
* 随访开始提醒-随访人员 |
||||
*/ |
||||
private String followUpStaff; |
||||
|
||||
private Long timestamp; |
||||
|
||||
/** |
||||
* 医生工号 |
||||
*/ |
||||
private String doctorCode; |
||||
|
||||
@Tolerate |
||||
SendMessageTemplate() { |
||||
} |
||||
} |
||||
@ -0,0 +1,48 @@ |
||||
package com.ynxbd.push.entity.tencent; |
||||
|
||||
import lombok.Builder; |
||||
import lombok.Data; |
||||
import lombok.experimental.Tolerate; |
||||
|
||||
/** |
||||
* @author 李进才 |
||||
*/ |
||||
@Data |
||||
@Builder |
||||
public class Subscribe { |
||||
/** |
||||
* openId |
||||
*/ |
||||
private String touser; |
||||
/** |
||||
* 模版id |
||||
*/ |
||||
private String template_id; |
||||
/** |
||||
* 跳转链接 |
||||
*/ |
||||
private String url; |
||||
/** |
||||
* 小程序appId |
||||
*/ |
||||
private String appid; |
||||
/** |
||||
* 小程序路径 |
||||
*/ |
||||
private String pagepath; |
||||
/** |
||||
* 一次性订阅消息权值(1代表同意了1权值的消息发送,1就失效;0-10000) |
||||
*/ |
||||
private Integer scene; |
||||
/** |
||||
* 标题 |
||||
*/ |
||||
private String title; |
||||
/** |
||||
* 内容 |
||||
*/ |
||||
private String content; |
||||
|
||||
@Tolerate |
||||
Subscribe(){} |
||||
} |
||||
@ -0,0 +1,19 @@ |
||||
package com.ynxbd.push.entity.tencent; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author 李进才 |
||||
* @ClassName Template |
||||
* @Description description |
||||
* @date 2022/7/14 10:55 |
||||
*/ |
||||
@Data |
||||
public class Template { |
||||
private String template_id; |
||||
private String title; |
||||
private String primary_industry; |
||||
private String deputy_industry; |
||||
private String content; |
||||
private String example; |
||||
} |
||||
@ -0,0 +1,21 @@ |
||||
package com.ynxbd.push.entity.tencent; |
||||
|
||||
import lombok.Builder; |
||||
import lombok.Data; |
||||
|
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author 李进才 |
||||
*/ |
||||
@Data |
||||
@Builder |
||||
public class TemplateJson { |
||||
private Map<String, Object> data; |
||||
private String template_id; |
||||
private String touser; |
||||
private String url; |
||||
private Map<String, Object> miniprogram; |
||||
private String title; |
||||
private Integer scene; |
||||
} |
||||
@ -0,0 +1,14 @@ |
||||
package com.ynxbd.push.entity.tencent; |
||||
|
||||
import lombok.Builder; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author 李进才 |
||||
*/ |
||||
@Data |
||||
@Builder |
||||
public class TemplateJsonValue { |
||||
private String color; |
||||
private String value; |
||||
} |
||||
@ -0,0 +1,17 @@ |
||||
package com.ynxbd.push.entity.tencent; |
||||
|
||||
import com.ynxbd.push.entity.tencent.Template; |
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author 李进才 |
||||
* @ClassName TemplateList |
||||
* @Description description |
||||
* @date 2022/7/14 10:54 |
||||
*/ |
||||
@Data |
||||
public class TemplateList { |
||||
private List<Template> template_list; |
||||
} |
||||
@ -0,0 +1,15 @@ |
||||
package com.ynxbd.push.entity.tencent; |
||||
|
||||
|
||||
import lombok.Builder; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author 李进才 |
||||
*/ |
||||
@Data |
||||
@Builder |
||||
public class TemplateRemark { |
||||
private String color; |
||||
private String value; |
||||
} |
||||
@ -0,0 +1,46 @@ |
||||
package com.ynxbd.push.entity.tencent; |
||||
|
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 客户接口消息发送实体 |
||||
* |
||||
* @author |
||||
* @date 2018-2-6 11:00:30 |
||||
*/ |
||||
public class TestMessage { |
||||
|
||||
//openid
|
||||
private String touser; |
||||
|
||||
//消息类型
|
||||
private String msgtype; |
||||
|
||||
//消息内容
|
||||
private Map<String,Object> text ; |
||||
|
||||
|
||||
public String getTouser() { |
||||
return touser; |
||||
} |
||||
|
||||
public void setTouser(String touser) { |
||||
this.touser = touser; |
||||
} |
||||
|
||||
public String getMsgtype() { |
||||
return msgtype; |
||||
} |
||||
|
||||
public void setMsgtype(String msgtype) { |
||||
this.msgtype = msgtype; |
||||
} |
||||
|
||||
public Map<String, Object> getText() { |
||||
return text; |
||||
} |
||||
|
||||
public void setText(Map<String, Object> text) { |
||||
this.text = text; |
||||
} |
||||
} |
||||
@ -0,0 +1,14 @@ |
||||
package com.ynxbd.push.entity.tencent; |
||||
|
||||
import lombok.Builder; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author 李进才 |
||||
*/ |
||||
@Data |
||||
@Builder |
||||
public class WeChatProperties { |
||||
private String appId; |
||||
private String secret; |
||||
} |
||||
@ -0,0 +1,17 @@ |
||||
package com.ynxbd.push.entity.tencent; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author 李进才 |
||||
* @ClassName WeChatResponse |
||||
* @Description description |
||||
* @date 2021/12/6 3:53 下午 |
||||
*/ |
||||
|
||||
@Data |
||||
public class WeChatResponse { |
||||
private String code; |
||||
private String data; |
||||
private String message; |
||||
} |
||||
@ -0,0 +1,38 @@ |
||||
package com.ynxbd.push.entity.tencent; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Data |
||||
public class WeChatUserInfo { |
||||
//用户是否订阅该公众号标识,值为0时,代表此用户没有关注该公众号,拉取不到其余信息。
|
||||
private Integer subscribe; |
||||
//用户的标识,对当前公众号唯一
|
||||
private String openid; |
||||
//用户的昵称
|
||||
private String nickname; |
||||
//用户的性别,值为1时是男性,值为2时是女性,值为0时是未知
|
||||
private Integer sex; |
||||
private String language; |
||||
private String city; |
||||
private String province; |
||||
private String country; |
||||
private String headimgurl; |
||||
//用户关注时间,为时间戳。如果用户曾多次关注,则取最后关注时间
|
||||
private Long subscribe_time; |
||||
//只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段。
|
||||
private String unionid; |
||||
//公众号运营者对粉丝的备注,公众号运营者可在微信公众平台用户管理界面对粉丝添加备注
|
||||
private String remark; |
||||
//用户所在的分组ID(兼容旧的用户分组接口)
|
||||
private Integer groupid; |
||||
//返回用户关注的渠道来源,ADD_SCENE_SEARCH 公众号搜索,ADD_SCENE_ACCOUNT_MIGRATION 公众号迁移,ADD_SCENE_PROFILE_CARD 名片分享,ADD_SCENE_QR_CODE 扫描二维码,ADD_SCENE_PROFILE_LINK 图文页内名称点击,ADD_SCENE_PROFILE_ITEM 图文页右上角菜单,ADD_SCENE_PAID 支付后关注,ADD_SCENE_WECHAT_ADVERTISEMENT 微信广告,ADD_SCENE_OTHERS 其他
|
||||
private String subscribe_scene; |
||||
//二维码扫码场景(开发者自定义)
|
||||
private Integer qr_scene; |
||||
//二维码扫码场景描述(开发者自定义)
|
||||
private String qr_scene_str; |
||||
//用户被打上的标签ID列表
|
||||
private List<Integer> tagid_list; |
||||
} |
||||
@ -0,0 +1,10 @@ |
||||
package com.ynxbd.push.entity.xbd.wx; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class AccessToken { |
||||
private Integer code; |
||||
private String data; |
||||
private String message; |
||||
} |
||||
@ -0,0 +1,82 @@ |
||||
package com.ynxbd.push.entity.xbd.wx; |
||||
|
||||
public class IDCardInfo { |
||||
private String cardNo; |
||||
private String name; |
||||
private String nation; |
||||
private String sex; |
||||
private String birth; |
||||
private String address; |
||||
|
||||
public IDCardInfo() { |
||||
} |
||||
|
||||
public IDCardInfo(String cardNo, String name, String nation, String sex, String birth, String address) { |
||||
this.cardNo = cardNo; |
||||
this.name = name; |
||||
this.nation = nation; |
||||
this.sex = sex; |
||||
this.birth = birth; |
||||
this.address = address; |
||||
} |
||||
|
||||
public String getCardNo() { |
||||
return cardNo; |
||||
} |
||||
|
||||
public void setCardNo(String cardNo) { |
||||
this.cardNo = cardNo; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
|
||||
public String getNation() { |
||||
return nation; |
||||
} |
||||
|
||||
public void setNation(String nation) { |
||||
this.nation = nation; |
||||
} |
||||
|
||||
public String getSex() { |
||||
return sex; |
||||
} |
||||
|
||||
public void setSex(String sex) { |
||||
this.sex = sex; |
||||
} |
||||
|
||||
public String getBirth() { |
||||
return birth; |
||||
} |
||||
|
||||
public void setBirth(String birth) { |
||||
this.birth = birth; |
||||
} |
||||
|
||||
public String getAddress() { |
||||
return address; |
||||
} |
||||
|
||||
public void setAddress(String address) { |
||||
this.address = address; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return "IDCardInfo{" + |
||||
"cardNo='" + cardNo + '\'' + |
||||
", name='" + name + '\'' + |
||||
", nation='" + nation + '\'' + |
||||
", sex='" + sex + '\'' + |
||||
", birth='" + birth + '\'' + |
||||
", address='" + address + '\'' + |
||||
'}'; |
||||
} |
||||
} |
||||
@ -0,0 +1,40 @@ |
||||
package com.ynxbd.push.entity.xbd.wx; |
||||
|
||||
public class SmsCode { |
||||
// 手机号码
|
||||
private String phone; |
||||
// 验证码
|
||||
private String code; |
||||
// 倒计时
|
||||
private Long countDown; |
||||
|
||||
public SmsCode(String phone, String code, Long countDown) { |
||||
this.phone = phone; |
||||
this.code = code; |
||||
this.countDown = countDown; |
||||
} |
||||
|
||||
public String getPhone() { |
||||
return phone; |
||||
} |
||||
|
||||
public void setPhone(String phone) { |
||||
this.phone = phone; |
||||
} |
||||
|
||||
public String getCode() { |
||||
return code; |
||||
} |
||||
|
||||
public void setCode(String code) { |
||||
this.code = code; |
||||
} |
||||
|
||||
public Long getCountDown() { |
||||
return countDown; |
||||
} |
||||
|
||||
public void setCountDown(Long countDown) { |
||||
this.countDown = countDown; |
||||
} |
||||
} |
||||
@ -0,0 +1,33 @@ |
||||
package com.ynxbd.push.helper; |
||||
|
||||
import java.util.Random; |
||||
import java.util.UUID; |
||||
|
||||
/** |
||||
* 随机码的生成 |
||||
* |
||||
* @author 李进才 |
||||
*/ |
||||
public class CodeHelper { |
||||
private CodeHelper(){ } |
||||
/** |
||||
* 生成数字验证码 |
||||
* |
||||
* @param num 生成验证码的长度 |
||||
* @return 验证码 |
||||
*/ |
||||
public static String generateRandomDigits(int num) { |
||||
int m = (int) Math.pow(10, num - 1.0); |
||||
return String.valueOf(m + new Random().nextInt(9 * m)); |
||||
} |
||||
|
||||
/** |
||||
* 生成随机token |
||||
* |
||||
* @return token |
||||
*/ |
||||
public static String getToken() { |
||||
return UUID.randomUUID().toString().replace("-", ""); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,75 @@ |
||||
/* |
||||
* * |
||||
* * @Project HM OA |
||||
* * @Name DesEncrypt |
||||
* * @Author 张剑峰 |
||||
* * @Date 18-4-15 下午11:02 |
||||
* * @Version v1.0.0 |
||||
* * @Copyright @ 2017 云南道睿科技有限公司 All rights reserved. |
||||
* |
||||
*/ |
||||
package com.ynxbd.push.helper; |
||||
|
||||
/** |
||||
* @author Administrator |
||||
* @version v1.0.0 |
||||
* @date Oct 10, 2009 11:24:26 AM |
||||
*/ |
||||
public class DesEncryptHelper { |
||||
private static final String KEY = "2018ynhm8321"; |
||||
|
||||
/** |
||||
* 加密 |
||||
* |
||||
* @param s 加密的字符串 |
||||
* @return 加密后的字符 |
||||
*/ |
||||
public static String enCode(String s) { |
||||
return new DesHelper().stringEnc(s, KEY); |
||||
} |
||||
|
||||
/** |
||||
* 解密 |
||||
* |
||||
* @param s 需要解密的字符串 |
||||
* @return 解密后的内容 |
||||
*/ |
||||
public static String deCode(String s) { |
||||
return new DesHelper().stringDec(s, KEY); |
||||
} |
||||
|
||||
/** |
||||
* 自定义key的加密 |
||||
* |
||||
* @param s |
||||
* @param strKey 自定义的key |
||||
* @return |
||||
*/ |
||||
public static String enCode(String s, String strKey) { |
||||
return new DesHelper().stringEnc(s, strKey); |
||||
} |
||||
|
||||
/** |
||||
* 自定义key的解密 |
||||
* |
||||
* @param s |
||||
* @param strKey 自定义的key |
||||
* @return |
||||
*/ |
||||
public static String deCode(String s, String strKey) { |
||||
return new DesHelper().stringDec(s, strKey); |
||||
} |
||||
|
||||
public static char[] enCodeChar(String s, String strKey) { |
||||
return new DesHelper().charEnc(s, strKey); |
||||
} |
||||
|
||||
public static char[] deCodeChar(String s, String strKey) { |
||||
return new DesHelper().charDec(s, strKey); |
||||
} |
||||
|
||||
public static void main(String[] args) { |
||||
System.out.println(DesEncryptHelper.enCode("oeso-t5DIu2qpb0LJaKeJ06TRgzw", KEY)); |
||||
System.out.println(DesEncryptHelper.deCode("19B20D16C09C4064DF385EDB1863A99B0C05CB8D5DA99C08B4C7AC6B6FAE028D89C90AAE3F5F397CDD177F25230726672B9441E369871608D74A40FD40F7EA3C967D1FBFC1ECCBA872A968C523FCB190A9B959AC822536151A508AA491ECF92B109C96E7B304C84284A45A61C476BA9BC833E2D178ADF27E4984AE325A602F6C08070D47695540349CB5F03072B586FB98009E083E8A20A4542BF29EA0BD120B", KEY)); |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,48 @@ |
||||
package com.ynxbd.push.helper; |
||||
|
||||
import org.apache.http.client.config.RequestConfig; |
||||
import org.apache.http.impl.nio.client.CloseableHttpAsyncClient; |
||||
import org.apache.http.impl.nio.client.HttpAsyncClients; |
||||
import org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager; |
||||
import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor; |
||||
import org.apache.http.impl.nio.reactor.IOReactorConfig; |
||||
import org.apache.http.nio.reactor.ConnectingIOReactor; |
||||
import org.apache.http.nio.reactor.IOReactorException; |
||||
|
||||
/** |
||||
* http异步线程池 |
||||
* |
||||
* @author 李进才 |
||||
*/ |
||||
public class HttpAsyncClientHelper { |
||||
private HttpAsyncClientHelper(){} |
||||
public static CloseableHttpAsyncClient getHttpAsyncClient() { |
||||
RequestConfig requestConfig = RequestConfig.custom() |
||||
// 连接对象服务器超时时间(发起)
|
||||
.setConnectTimeout(50000) |
||||
//跟对象服务器交互超时时间(握手)
|
||||
.setSocketTimeout(50000) |
||||
// 从连接池获取连接超时时间
|
||||
.setConnectionRequestTimeout(50000) |
||||
.build(); |
||||
//配置io线程
|
||||
IOReactorConfig ioReactorConfig = IOReactorConfig.custom(). |
||||
setIoThreadCount(15) |
||||
.setSoKeepAlive(true) |
||||
.build(); |
||||
//设置连接池大小
|
||||
ConnectingIOReactor ioReactor = null; |
||||
try { |
||||
ioReactor = new DefaultConnectingIOReactor(ioReactorConfig); |
||||
} catch (IOReactorException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
PoolingNHttpClientConnectionManager connManager = new PoolingNHttpClientConnectionManager(ioReactor); |
||||
connManager.setMaxTotal(2000); |
||||
connManager.setDefaultMaxPerRoute(2000); |
||||
return HttpAsyncClients.custom(). |
||||
setConnectionManager(connManager) |
||||
.setDefaultRequestConfig(requestConfig) |
||||
.build(); |
||||
} |
||||
} |
||||
@ -0,0 +1,43 @@ |
||||
package com.ynxbd.push.helper; |
||||
|
||||
import java.net.Inet4Address; |
||||
import java.net.InetAddress; |
||||
import java.net.NetworkInterface; |
||||
import java.util.Enumeration; |
||||
|
||||
/** |
||||
* 获取本机ip地址 |
||||
* |
||||
* @author 李进才 |
||||
*/ |
||||
public class IPHelper { |
||||
private IPHelper() { |
||||
} |
||||
|
||||
|
||||
|
||||
public synchronized static String getIp() throws NullPointerException { |
||||
Enumeration<NetworkInterface> allNetInterfaces; // networkInterfaces
|
||||
InetAddress ip; |
||||
|
||||
try { |
||||
allNetInterfaces = NetworkInterface.getNetworkInterfaces(); |
||||
while (allNetInterfaces.hasMoreElements()) { |
||||
NetworkInterface netInterface = allNetInterfaces.nextElement(); |
||||
Enumeration<InetAddress> addresses = netInterface.getInetAddresses(); |
||||
while (addresses.hasMoreElements()) { |
||||
ip = addresses.nextElement(); |
||||
if (ip instanceof Inet4Address) { |
||||
if (ip.getHostAddress().equals("127.0.0.1")) { |
||||
continue; |
||||
} |
||||
return ip.getHostAddress(); |
||||
} |
||||
} |
||||
} |
||||
} catch (java.net.SocketException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
@ -0,0 +1,34 @@ |
||||
package com.ynxbd.push.helper; |
||||
|
||||
import java.util.*; |
||||
|
||||
/** |
||||
* List的相关帮助类 |
||||
* |
||||
* @author 李进才 |
||||
*/ |
||||
public class ListHelper { |
||||
private ListHelper(){} |
||||
/** |
||||
* 找到list重复的地方 |
||||
* |
||||
* @param data |
||||
* @param <T> |
||||
* @return |
||||
*/ |
||||
public static <T> List<T> findRepeat(Collection<T> data) { |
||||
if (data instanceof Set) { |
||||
return new ArrayList<>(); |
||||
} |
||||
HashSet<T> set = new HashSet<>(); |
||||
List<T> repeatElves = new ArrayList<>(); |
||||
for (T t : data) { |
||||
if (set.contains(t)) { |
||||
repeatElves.add(t); |
||||
} else { |
||||
set.add(t); |
||||
} |
||||
} |
||||
return repeatElves; |
||||
} |
||||
} |
||||
@ -0,0 +1,408 @@ |
||||
package com.ynxbd.push.helper; |
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException; |
||||
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
import com.ynxbd.push.config.IniConfig; |
||||
import com.ynxbd.push.entity.*; |
||||
import com.ynxbd.push.entity.tencent.*; |
||||
import com.ynxbd.push.httpRequest.xbd.wx.WxCacheRequest; |
||||
import com.ynxbd.push.thread.ThreadConfig; |
||||
import lombok.SneakyThrows; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.http.Header; |
||||
import org.apache.http.HttpResponse; |
||||
import org.apache.http.client.methods.HttpUriRequest; |
||||
import org.apache.http.client.methods.RequestBuilder; |
||||
import org.apache.http.concurrent.FutureCallback; |
||||
import org.apache.http.entity.StringEntity; |
||||
import org.apache.http.impl.nio.client.CloseableHttpAsyncClient; |
||||
import org.springframework.beans.BeanUtils; |
||||
import weixin.popular.api.API; |
||||
import weixin.popular.api.MessageAPI; |
||||
import weixin.popular.api.UserAPI; |
||||
import weixin.popular.bean.message.MessageSendResult; |
||||
import weixin.popular.bean.message.massmessage.Filter; |
||||
import weixin.popular.bean.message.massmessage.MassTextMessage; |
||||
import weixin.popular.bean.user.Group; |
||||
import weixin.popular.client.LocalHttpClient; |
||||
|
||||
import java.io.IOException; |
||||
import java.nio.charset.StandardCharsets; |
||||
import java.util.*; |
||||
import java.util.concurrent.CountDownLatch; |
||||
import java.util.concurrent.ThreadPoolExecutor; |
||||
|
||||
|
||||
/** |
||||
* 所有消息发送的工厂类 |
||||
* |
||||
* @Project WebApi |
||||
* @Name MessageApiHelper |
||||
* @Author 李进才 |
||||
* @Date 2020/5/25 |
||||
* @Version v1.0.0 |
||||
* @Copyright @ 2017 云南新八达科技有限公司 All rights reserved. |
||||
*/ |
||||
@Slf4j |
||||
public class MessageApiHelper { |
||||
|
||||
protected static Header jsonHeader; |
||||
|
||||
public static final Integer EVERY_OPENID_COUNT = 10000; |
||||
|
||||
public static final String CODE_INVALIDATION = "40001"; |
||||
public static final String CODE_EXPIRED = "42001"; |
||||
public static final String MESSAGE_RESULT_ERROR_CODE = "4002"; |
||||
|
||||
/** |
||||
* 三层调用,第一层,传输SendMessageTemplate对象(减少controller代码量) |
||||
* |
||||
* @param template |
||||
* @return |
||||
*/ |
||||
public static MessageSendResult templateMessageSend(SendMessageTemplate template) { |
||||
MessageSendResult messageSendResult = templateMessage(template); |
||||
log.info("TenCent Return Message" + messageSendResult.getErrcode()); |
||||
return messageSendResult; |
||||
} |
||||
|
||||
/** |
||||
* 三层调用第二层,转换实体对象为json对象 |
||||
* |
||||
* @param sendMessageTemplate 模版数据 |
||||
* @return 请求接口返回的状态码等信息 |
||||
*/ |
||||
public static MessageSendResult templateMessage(SendMessageTemplate sendMessageTemplate) { |
||||
try { |
||||
String jsonMessage = TemplateSelectHelper.select(sendMessageTemplate); |
||||
log.info("SendTenCentJson:{}", jsonMessage); |
||||
return templateMessageSend(jsonMessage); |
||||
} catch (Exception e) { |
||||
MessageSendResult messageSendResult = new MessageSendResult(); |
||||
messageSendResult.setErrcode(MESSAGE_RESULT_ERROR_CODE); |
||||
return messageSendResult; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 三层调用最后一层,调起http发送模版消息 |
||||
* |
||||
* @param messageJson json字符串 |
||||
*/ |
||||
private static MessageSendResult templateMessageSend(String messageJson) { |
||||
HttpUriRequest httpUriRequest = RequestBuilder.post().setHeader(jsonHeader).setUri("https://api.weixin.qq.com/cgi-bin/message/template/send").addParameter("access_token", API.accessToken(WxCacheRequest.getAccessToken())).setEntity(new StringEntity(messageJson, StandardCharsets.UTF_8)).build(); |
||||
MessageSendResult result = LocalHttpClient.executeJsonResult(httpUriRequest, MessageSendResult.class); |
||||
|
||||
String errCode = result.getErrcode(); |
||||
if (CODE_INVALIDATION.equals(errCode) || CODE_EXPIRED.equals(errCode)) { |
||||
String errMsg = result.getErrmsg(); |
||||
log.error("[推送]请求失败 errCode={}, errMsg={}", errCode, errMsg); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 群发消息给用户 |
||||
* |
||||
* @param content 发送消息的内容 |
||||
* @return 请求接口返回的状态码等信息 |
||||
*/ |
||||
public static MessageSendResult group(String content) { |
||||
try { |
||||
String accessToken = WxCacheRequest.getAccessToken(); |
||||
Group group = UserAPI.groupsGet(accessToken); |
||||
String gid = group.getGroups().get(0).getId(); |
||||
MassTextMessage textMessage = new MassTextMessage(content); |
||||
textMessage.setFilter(new Filter(false, gid)); |
||||
return MessageAPI.messageMassSendall(accessToken, textMessage); |
||||
} catch (Exception e) { |
||||
log.info(e.getMessage()); |
||||
MessageSendResult messageSendResult = new MessageSendResult(); |
||||
messageSendResult.setErrcode(MESSAGE_RESULT_ERROR_CODE); |
||||
return messageSendResult; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 根据openid用客服接口发送信息,最多每次发送二十条,每当用户回复自己可以再发送二十条 |
||||
* |
||||
* @param openid 用户在该微信公众号的唯一id,也就是需要发送给哪个用户 |
||||
* @param content 需要发送给用户的内容 |
||||
* @return 请求接口返回的状态码等信息 |
||||
*/ |
||||
public static MessageSendResult sendTextForOpenId(String openid, String content) { |
||||
try { |
||||
TestMessage testMessage = new TestMessage(); |
||||
testMessage.setMsgtype("text"); |
||||
testMessage.setTouser(openid); |
||||
Map<String, Object> map = new HashMap<>(); |
||||
map.put("content", content); |
||||
testMessage.setText(map); |
||||
|
||||
String jsonTestMessage = new ObjectMapper().writeValueAsString(testMessage); |
||||
return messageMassSend(jsonTestMessage); |
||||
} catch (Exception e) { |
||||
MessageSendResult messageSendResult = new MessageSendResult(); |
||||
messageSendResult.setErrcode(MESSAGE_RESULT_ERROR_CODE); |
||||
return messageSendResult; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 通过客服的方式发送链接信息给用户 |
||||
* |
||||
* @param openid 用户在该微信公众号的唯一id,也就是需要发送给哪个用户 |
||||
* @param title 标题内容 |
||||
* @param description 描述 |
||||
* @param url 跳转链接 |
||||
* @param thumb_url 图片链接 |
||||
* @return 请求接口返回的状态码等信息 |
||||
*/ |
||||
public static MessageSendResult sendLinkForOpenId(String openid, String title, String description, String url, String thumb_url) { |
||||
try { |
||||
LinkMessage linkMessage = new LinkMessage(); |
||||
linkMessage.setMsgtype("link"); |
||||
linkMessage.setTouser(openid); |
||||
Map<String, Object> map = new HashMap<>(); |
||||
map.put("title", title); |
||||
map.put("description", description); |
||||
map.put("url", url); |
||||
map.put("thumb_url", thumb_url); |
||||
linkMessage.setLink(map); |
||||
String jsonTestMessage = new ObjectMapper().writeValueAsString(linkMessage); |
||||
return messageMassSend(jsonTestMessage); |
||||
} catch (Exception e) { |
||||
MessageSendResult messageSendResult = new MessageSendResult(); |
||||
messageSendResult.setErrcode(MESSAGE_RESULT_ERROR_CODE); |
||||
return messageSendResult; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 一次性订阅消息发送,因为每家都一样全部都在一个类封装好了,不像模版消息调了好多层解偶 |
||||
* |
||||
* @param subscribe |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
public static MessageSendResult subscribeMessage(Subscribe subscribe) throws JsonProcessingException { |
||||
Map<String, Object> miniProgram = new HashMap<>(); |
||||
miniProgram.put("appid", subscribe.getAppid()); |
||||
miniProgram.put("pagepath", subscribe.getPagepath()); |
||||
|
||||
Map<String, Object> data = new HashMap<>(); |
||||
data.put("content", TemplateJsonValue.builder().value(subscribe.getContent()).color("#173177").build()); |
||||
TemplateJson templateJson = TemplateJson.builder() |
||||
.template_id(subscribe.getTemplate_id()) |
||||
.miniprogram(miniProgram) |
||||
.url(subscribe.getUrl()) |
||||
.scene(subscribe.getScene()) |
||||
.title(subscribe.getTitle()) |
||||
.data(data) |
||||
.touser(subscribe.getTouser()) |
||||
.build(); |
||||
ObjectMapper objectMapper = new ObjectMapper(); |
||||
String messageJson = objectMapper.writeValueAsString(templateJson); |
||||
HttpUriRequest httpUriRequest = RequestBuilder.post().setHeader(jsonHeader).setUri("https://api.weixin.qq.com/cgi-bin/message/template/subscribe").addParameter("access_token", API.accessToken(WxCacheRequest.getAccessToken())).setEntity(new StringEntity(messageJson, StandardCharsets.UTF_8)).build(); |
||||
return LocalHttpClient.executeJsonResult(httpUriRequest, MessageSendResult.class); |
||||
} |
||||
|
||||
/** |
||||
* 发送文本消息 |
||||
* |
||||
* @param messageJson messageJson |
||||
* @return MessageSendResult |
||||
*/ |
||||
private static MessageSendResult messageMassSend(String messageJson) { |
||||
HttpUriRequest httpUriRequest = RequestBuilder.post().setHeader(jsonHeader).setUri("https://api.weixin.qq.com/cgi-bin/message/custom/send").addParameter("access_token", API.accessToken(WxCacheRequest.getAccessToken())).setEntity(new StringEntity(messageJson, StandardCharsets.UTF_8)).build(); |
||||
return LocalHttpClient.executeJsonResult(httpUriRequest, MessageSendResult.class); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取该公众号下所有用户的openId |
||||
* |
||||
* @param next_openid next_openid |
||||
* @return |
||||
*/ |
||||
public static AllUser getAllUser(String next_openid) { |
||||
try { |
||||
HttpUriRequest httpUriRequest = RequestBuilder.get().setHeader(jsonHeader).setUri("https://api.weixin.qq.com/cgi-bin/user/get").addParameter("access_token", API.accessToken(WxCacheRequest.getAccessToken())).addParameter("next_openid", next_openid).build(); |
||||
AllUser messageSendResult = LocalHttpClient.executeJsonResult(httpUriRequest, AllUser.class); |
||||
messageSendResult.setErrcode("0"); |
||||
return messageSendResult; |
||||
} catch (Exception e) { |
||||
AllUser allUser = new AllUser(); |
||||
allUser.setErrcode(MESSAGE_RESULT_ERROR_CODE); |
||||
return allUser; |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 群发模版消息入口(包括多线程组装) |
||||
* |
||||
* @param sendMessageTemplate |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
public static CompleteThreadCount groupTemplateSend(SendMessageTemplate sendMessageTemplate) throws IOException, InterruptedException { |
||||
final CompleteThreadCount completeThreadCount = CompleteThreadCount.builder().completed(0).failed(0).cancelled(0).build(); |
||||
final OpenIdList openIdList = getAllUserList(); |
||||
ThreadPoolExecutor threadPoolExecutor = ThreadConfig.getExecutor(15, 20); |
||||
log.info("所有用户总数:" + openIdList.getCount()); |
||||
|
||||
final CloseableHttpAsyncClient httpClient = HttpAsyncClientHelper.getHttpAsyncClient(); |
||||
final CountDownLatch latch = new CountDownLatch(openIdList.getCount()); |
||||
httpClient.start(); |
||||
for (List<String> openIds : openIdList.getOpenIds()) { |
||||
try { |
||||
threadPoolExecutor.execute(() -> groupSendTemplateMessage(httpClient, openIds, sendMessageTemplate, completeThreadCount, latch)); |
||||
} catch (Exception e) { |
||||
log.error("主线程循环过程中出现错误:{}", e.getMessage()); |
||||
} |
||||
} |
||||
log.info("---执行完成-线程未停止!----完成数:{}, 失败数{}", completeThreadCount.getCompleted(), completeThreadCount.getFailed() + "取消数:" + completeThreadCount.getCancelled()); |
||||
latch.await(); |
||||
httpClient.close(); |
||||
|
||||
List<Runnable> notStopRunnable = threadPoolExecutor.shutdownNow(); |
||||
for (Runnable runnable : notStopRunnable) { |
||||
log.error("未停止任务:{}", runnable.toString()); |
||||
} |
||||
log.info("线程是否结束:{}, 异步是否结束:{}", threadPoolExecutor.isShutdown(), httpClient.isRunning()); |
||||
log.info("---执行完成-线程已停止!!---完成数:{}, 失败数:{}", completeThreadCount.getCompleted(), completeThreadCount.getFailed() + "取消数:" + completeThreadCount.getCancelled()); |
||||
return completeThreadCount; |
||||
} |
||||
|
||||
/** |
||||
* 发送一组openid的模版消息(任务分包,将openid分散然后由异步发送) |
||||
* |
||||
* @param completeThreadCount |
||||
* @param openIds |
||||
* @throws Exception |
||||
*/ |
||||
private static void groupSendTemplateMessage(CloseableHttpAsyncClient httpClient, List<String> openIds, SendMessageTemplate sendMessageTemplate, CompleteThreadCount completeThreadCount, CountDownLatch latch) { |
||||
//将一万条请求任务逐次加入线程
|
||||
for (String openId : openIds) { |
||||
try { |
||||
SendMessageTemplate singleSendMessageTemplate = SendMessageTemplate.builder().build(); |
||||
BeanUtils.copyProperties(sendMessageTemplate, singleSendMessageTemplate); |
||||
singleSendMessageTemplate.setOpenId(openId); |
||||
Thread.sleep(Integer.parseInt(IniConfig.getInstance("speed"))); |
||||
asyncTemplateMessageSend(httpClient, completeThreadCount, RequestBuilder |
||||
.post() |
||||
.setHeader(jsonHeader) |
||||
.setUri("https://api.weixin.qq.com/cgi-bin/message/template/send") |
||||
.addParameter("access_token", API.accessToken(Objects.requireNonNull(WxCacheRequest.getAccessToken()))) |
||||
.addParameter("time_stamp", String.valueOf(System.currentTimeMillis())) |
||||
.setEntity(new StringEntity(TemplateSelectHelper.select(singleSendMessageTemplate), StandardCharsets.UTF_8)) |
||||
.build(), latch); |
||||
} catch (Exception e) { |
||||
log.error("httpClient异步线程执行中出现错误:{}", e.toString()); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 异步发送网络请求(实际调起http的地方,异步调用) |
||||
* |
||||
* @param httpclient |
||||
* @param request |
||||
*/ |
||||
private static void asyncTemplateMessageSend(final CloseableHttpAsyncClient httpclient, final CompleteThreadCount completeThreadCount, final HttpUriRequest request, final CountDownLatch latch) throws IOException { |
||||
httpclient.execute(request, new FutureCallback<HttpResponse>() { |
||||
@SneakyThrows |
||||
@Override |
||||
public void completed(HttpResponse response) { |
||||
completeThreadCount.setCompleted(completeThreadCount.getCompleted() + 1); |
||||
latch.countDown(); |
||||
} |
||||
|
||||
@SneakyThrows |
||||
@Override |
||||
public void failed(Exception ex) { |
||||
log.error("回调过程中出现错误:" + ex.toString()); |
||||
completeThreadCount.setFailed(completeThreadCount.getFailed() + 1); |
||||
latch.countDown(); |
||||
} |
||||
|
||||
@SneakyThrows |
||||
@Override |
||||
public void cancelled() { |
||||
completeThreadCount.setCancelled(completeThreadCount.getCancelled() + 1); |
||||
latch.countDown(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 获取所有用户列表的集合(1W个用户为一组) |
||||
* |
||||
* @return |
||||
*/ |
||||
private static OpenIdList getAllUserList() { |
||||
List<List<String>> openIds = new ArrayList<>(); |
||||
List<String> nextOpenIds = new ArrayList<>(); |
||||
AllUser userList = getAllUser(null); |
||||
String nextOpenId = userList.getNext_openid(); |
||||
nextOpenIds.add(nextOpenId); |
||||
|
||||
|
||||
Integer count = ((List<String>) userList.getData().get("openid")).size(); |
||||
openIds.add((List<String>) userList.getData().get("openid")); |
||||
for (int i = 0; i < Math.floor(userList.getTotal() / EVERY_OPENID_COUNT); i++) { |
||||
try { |
||||
if (nextOpenId == null || nextOpenId.isEmpty()) { |
||||
break; |
||||
} |
||||
userList = getAllUser(nextOpenId); |
||||
if (userList.getData().get("openid") == null) { |
||||
break; |
||||
} |
||||
nextOpenId = userList.getNext_openid(); |
||||
nextOpenIds.add(nextOpenId); |
||||
count += ((List<String>) userList.getData().get("openid")).size(); |
||||
openIds.add((List<String>) userList.getData().get("openid")); |
||||
} catch (Exception e) { |
||||
log.error("请求列表过程中出现错误:next_openid:" + nextOpenId + "错误:" + e.toString()); |
||||
} |
||||
} |
||||
return OpenIdList.builder().openIds(openIds).count(count).build(); |
||||
} |
||||
|
||||
//
|
||||
// /**
|
||||
// * 将所有openId组装成SendMessageTemplate集合
|
||||
// * @param openIdList
|
||||
// * @param sendMessageTemplate
|
||||
// * @return
|
||||
// */
|
||||
// private List<List<SendMessageTemplate>> GetAllSendMessageTemplate(OpenIdList openIdList, SendMessageTemplate sendMessageTemplate){
|
||||
// List<List<SendMessageTemplate>> allSendMessageTemplate = new ArrayList<>();
|
||||
// for (List<String> openList : openIdList.getOpenIds()) {
|
||||
// allSendMessageTemplate.add(GetGroupSendMessageTemplate(openList,sendMessageTemplate));
|
||||
// }
|
||||
// return allSendMessageTemplate;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 单组openId组装成SendMessageTemplate哈希集合,防止重复
|
||||
// * @param groupOpenId
|
||||
// * @param sendMessageTemplate
|
||||
// * @return
|
||||
// */
|
||||
// private List<SendMessageTemplate> GetGroupSendMessageTemplate(List<String> groupOpenId, SendMessageTemplate sendMessageTemplate){
|
||||
// List<SendMessageTemplate> groupSendMessageTemplate = new ArrayList<>();
|
||||
// for(String openId: groupOpenId){
|
||||
// SendMessageTemplate newSendMessageTemplate =SendMessageTemplate.builder().build();
|
||||
// BeanUtils.copyProperties(sendMessageTemplate,newSendMessageTemplate);
|
||||
// newSendMessageTemplate.setOpenId(openId);
|
||||
// groupSendMessageTemplate.add(newSendMessageTemplate);
|
||||
// }
|
||||
// return groupSendMessageTemplate;
|
||||
// }
|
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,97 @@ |
||||
package com.ynxbd.push.helper; |
||||
/* |
||||
* Copyright (c) 2022 |
||||
* User:Administrator |
||||
* File:ProperHelper.java |
||||
* Date:2022/06/13 14:56:13 |
||||
*/ |
||||
|
||||
import java.io.IOException; |
||||
import java.io.InputStream; |
||||
import java.util.Properties; |
||||
|
||||
public class ProperHelper { |
||||
|
||||
private Properties properties; |
||||
|
||||
/** |
||||
* 读取properties配置文件...\project\web\WEB-INF\classes\xx.properties |
||||
* |
||||
* @param fileName 文件名 |
||||
* @return Properties对象,通过getProperty()获取值 |
||||
*/ |
||||
public ProperHelper read(String fileName) { |
||||
properties = new Properties(); |
||||
try (InputStream in = ProperHelper.class.getClassLoader().getResourceAsStream(fileName)) { |
||||
properties.load(in); |
||||
} catch (IOException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* 获取配置文件String值 |
||||
* |
||||
* @param rootNode 节点名 |
||||
* @return String |
||||
*/ |
||||
public String getString(String rootNode) { |
||||
try { |
||||
String val = properties.getProperty(rootNode); |
||||
return val == null ? null : val.trim(); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取配置文件Boolean值,可设默认值 |
||||
* |
||||
* @param rootNode 节点名 |
||||
* @return Boolean |
||||
*/ |
||||
public Boolean getBoolean(String rootNode, Boolean defaultVal) { |
||||
try { |
||||
String val = properties.getProperty(rootNode); |
||||
return val == null ? defaultVal : Boolean.parseBoolean(val.trim()); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return defaultVal; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取配置文件Boolean值 |
||||
* |
||||
* @param rootNode 节点名 |
||||
* @return Boolean |
||||
*/ |
||||
public Boolean getBoolean(String rootNode) { |
||||
try { |
||||
String val = properties.getProperty(rootNode); |
||||
return val == null ? null : Boolean.parseBoolean(val.trim()); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取配置文件Integer值 |
||||
* |
||||
* @param rootNode 节点名 |
||||
* @return Integer |
||||
*/ |
||||
public Integer getInteger(String rootNode) { |
||||
try { |
||||
String val = properties.getProperty(rootNode); |
||||
return val == null ? null : Integer.parseInt(val.trim()); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,151 @@ |
||||
package com.ynxbd.push.helper; |
||||
|
||||
import org.apache.commons.codec.binary.Base64; |
||||
|
||||
import javax.crypto.Cipher; |
||||
import java.nio.charset.StandardCharsets; |
||||
import java.security.KeyFactory; |
||||
import java.security.KeyPair; |
||||
import java.security.KeyPairGenerator; |
||||
import java.security.SecureRandom; |
||||
import java.security.interfaces.RSAPrivateKey; |
||||
import java.security.interfaces.RSAPublicKey; |
||||
import java.security.spec.PKCS8EncodedKeySpec; |
||||
import java.security.spec.X509EncodedKeySpec; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @Author wsq |
||||
* @Date 2021/07/28 11:01:28 |
||||
* @Copyright @ 2020 云南新八达科技有限公司 All rights reserved. |
||||
*/ |
||||
public class RSAHelper { |
||||
private static final int KEY_LENGTH = 1024; |
||||
private static final Map<Integer, String> keyMap = new HashMap<>(); // 用于封装随机产生的公钥与私钥
|
||||
|
||||
static { |
||||
init(); |
||||
} |
||||
|
||||
/** |
||||
* 初始化生成 |
||||
*/ |
||||
private static void init() { |
||||
try { |
||||
// KeyPairGenerator类用于生成公钥和私钥对,基于RSA算法生成对象
|
||||
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA"); |
||||
// 初始化密钥对生成器,密钥大小为96-1024位
|
||||
keyPairGen.initialize(KEY_LENGTH, new SecureRandom()); |
||||
// 生成一个密钥对,保存在keyPair中
|
||||
KeyPair keyPair = keyPairGen.generateKeyPair(); |
||||
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); // 得到私钥
|
||||
RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); // 得到公钥
|
||||
String publicKeyStr = new String(Base64.encodeBase64(publicKey.getEncoded())); |
||||
// 得到私钥字符串
|
||||
String privateKeyStr = new String(Base64.encodeBase64((privateKey.getEncoded()))); |
||||
// 将公钥和私钥保存到Map
|
||||
keyMap.put(0, publicKeyStr); // 0表示公钥
|
||||
keyMap.put(1, privateKeyStr); // 1表示私钥
|
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取公钥 |
||||
* |
||||
* @return 公钥 |
||||
*/ |
||||
public static String getPublicKey() { |
||||
return keyMap.get(0); |
||||
} |
||||
|
||||
/** |
||||
* 获取私钥 |
||||
* |
||||
* @return 私钥 |
||||
*/ |
||||
public static String getPrivateKey() { |
||||
return keyMap.get(1); |
||||
} |
||||
|
||||
/** |
||||
* RSA公钥加密 |
||||
* |
||||
* @param encryptData 加密数据 |
||||
* @return 密文 |
||||
*/ |
||||
public static String encrypt(String encryptData) { |
||||
return encrypt(encryptData, getPublicKey()); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* RSA公钥加密 |
||||
* |
||||
* @param encryptData 加密数据 |
||||
* @return 密文 |
||||
*/ |
||||
public static String encrypt(String encryptData, String publicKey) { |
||||
try { |
||||
// Base64编码的公钥
|
||||
byte[] decoded = Base64.decodeBase64(publicKey); |
||||
RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded)); |
||||
// RSA加密
|
||||
Cipher cipher = Cipher.getInstance("RSA"); |
||||
cipher.init(Cipher.ENCRYPT_MODE, pubKey); |
||||
return Base64.encodeBase64String(cipher.doFinal(encryptData.getBytes(StandardCharsets.UTF_8))); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* RSA私钥解密 |
||||
* |
||||
* @param decryptData 加密数据 |
||||
* @return 明文 |
||||
*/ |
||||
public static String decrypt(String decryptData) { |
||||
return decrypt(decryptData, getPrivateKey()); |
||||
} |
||||
|
||||
/** |
||||
* RSA私钥解密 |
||||
* |
||||
* @param decryptData 加密数据 |
||||
* @return 明文 |
||||
*/ |
||||
public static String decrypt(String decryptData, String privateKey) { |
||||
if (decryptData == null || "".equals(decryptData)) { |
||||
return null; |
||||
} |
||||
try { |
||||
// 64位解码加密后的字符串
|
||||
byte[] inputByte = Base64.decodeBase64(decryptData.getBytes(StandardCharsets.UTF_8)); |
||||
// base64编码的私钥
|
||||
byte[] decoded = Base64.decodeBase64(privateKey); |
||||
RSAPrivateKey priKey = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded)); |
||||
// RSA解密
|
||||
Cipher cipher = Cipher.getInstance("RSA"); |
||||
cipher.init(Cipher.DECRYPT_MODE, priKey); |
||||
return new String(cipher.doFinal(inputByte)); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
public static void main(String[] args) throws Exception { |
||||
//加密字符串
|
||||
String message = "oeso-t62kkoRwLVVkSkwmmjPfUXk"; |
||||
System.out.println("随机生成的公钥为:" + keyMap.get(0)); |
||||
System.out.println("随机生成的私钥为:" + keyMap.get(1)); |
||||
String messageEn = encrypt(message); |
||||
System.out.println(message + "\t加密后的字符串为:" + messageEn); |
||||
String messageDe = decrypt(messageEn); |
||||
System.out.println("还原后的字符串为:" + messageDe); |
||||
} |
||||
} |
||||
@ -0,0 +1,130 @@ |
||||
/* |
||||
* Copyright (c) 2021 |
||||
* User:王绍全 |
||||
* File:RequestHelper.java |
||||
* Date:2021/07/23 12:02:23 |
||||
*/ |
||||
|
||||
package com.ynxbd.push.helper; |
||||
|
||||
import com.alibaba.fastjson.JSON; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.http.conn.ssl.NoopHostnameVerifier; |
||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory; |
||||
import org.apache.http.conn.ssl.TrustStrategy; |
||||
import org.apache.http.impl.client.CloseableHttpClient; |
||||
import org.apache.http.impl.client.HttpClients; |
||||
import org.apache.http.ssl.SSLContextBuilder; |
||||
import org.springframework.http.HttpEntity; |
||||
import org.springframework.http.HttpHeaders; |
||||
import org.springframework.http.ResponseEntity; |
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; |
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory; |
||||
import org.springframework.util.MultiValueMap; |
||||
import org.springframework.web.client.RestTemplate; |
||||
|
||||
import javax.net.ssl.SSLContext; |
||||
import java.security.KeyManagementException; |
||||
import java.security.KeyStoreException; |
||||
import java.security.NoSuchAlgorithmException; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Slf4j |
||||
public class RequestHelper extends SimpleClientHttpRequestFactory { |
||||
|
||||
|
||||
public static RestTemplate getRestTemplate() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException { |
||||
SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, (TrustStrategy) (arg0, arg1) -> true).build(); |
||||
|
||||
SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext, |
||||
new String[]{"TLSv1.2", "TLSv1.1"}, |
||||
null, |
||||
NoopHostnameVerifier.INSTANCE); |
||||
|
||||
CloseableHttpClient httpClient = HttpClients.custom() |
||||
.setSSLSocketFactory(csf) |
||||
.build(); |
||||
|
||||
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); |
||||
requestFactory.setHttpClient(httpClient); |
||||
return new RestTemplate(requestFactory); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 向目的URL发送post请求 |
||||
* |
||||
* @param url 目的url |
||||
* @param params 发送的参数 |
||||
* @return ResultVO |
||||
*/ |
||||
public static <T> T post(String url, MultiValueMap<String, Object> params, Class<T> clazz) throws Exception { |
||||
HttpHeaders headers = new HttpHeaders(); |
||||
headers.add("Content-Type", "application/x-www-form-urlencoded"); |
||||
HttpEntity<MultiValueMap<String, Object>> request = new HttpEntity<>(params, headers); |
||||
return getRestTemplate().postForObject(url, request, clazz); |
||||
} |
||||
|
||||
/** |
||||
* 向目的URL发送get请求 |
||||
* |
||||
* @param url 请求地址 |
||||
* @param params 请求参数 |
||||
* @return ResultVO |
||||
*/ |
||||
public static <T> T get(String url, Map<String, String> params, Class<T> clazz) { |
||||
RestTemplate client = new RestTemplate(); |
||||
HttpHeaders headers = new HttpHeaders(); |
||||
headers.add("Content-Type", "application/x-www-form-urlencoded"); |
||||
HttpEntity<Map<String,String>> request = new HttpEntity<>(params,headers); |
||||
ResponseEntity<String> responseEntity = client.getForEntity(url, String.class, request); |
||||
String data = responseEntity.getBody(); |
||||
return JSON.parseObject(data, clazz); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取post流中的参数 |
||||
* |
||||
* @param name 参数名称 |
||||
* @param paramsMap 请求参数 |
||||
* @param clazz 集合类型 |
||||
* @return list |
||||
*/ |
||||
public static <T> List<T> getBodyList(Map<String, Object> paramsMap, String name, Class<T> clazz) { |
||||
Object param = paramsMap.get(name); |
||||
if (param == null) { |
||||
return null; |
||||
} |
||||
String json = JSON.toJSONString(param); |
||||
if ("".equals(json)) { |
||||
return null; |
||||
} |
||||
return JSON.parseArray(json, clazz); |
||||
} |
||||
|
||||
/** |
||||
* 获取post流中的参数 |
||||
* |
||||
* @param name 参数名称 |
||||
* @param paramsMap 请求参数 |
||||
* @return list |
||||
*/ |
||||
public static String getBodyString(Map<String, Object> paramsMap, String name) { |
||||
Object param = paramsMap.get(name); |
||||
if (param == null) { |
||||
return null; |
||||
} |
||||
String paramStr = String.valueOf(param); |
||||
if (!"null".equals(paramStr)) { |
||||
return paramStr; |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
|
||||
public static void main(String[] args) { |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,51 @@ |
||||
package com.ynxbd.push.helper;//package com.ynxbd.push.helper;
|
||||
//
|
||||
//import org.apache.shiro.SecurityUtils;
|
||||
//import org.apache.shiro.authc.AuthenticationException;
|
||||
//import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
//import org.apache.shiro.config.IniSecurityManagerFactory;
|
||||
//import org.apache.shiro.subject.Subject;
|
||||
//import org.junit.Assert;
|
||||
//
|
||||
///**
|
||||
// * @Project WebApi
|
||||
// * @Name ShiroHelper shiro的一些方法
|
||||
// * @Author 李进才
|
||||
// * @Date 2020/5/25
|
||||
// * @Version v1.0.0
|
||||
// * @Copyright @ 2017 云南新八达科技有限公司 All rights reserved.
|
||||
// */
|
||||
//
|
||||
//public class ShiroHelper {
|
||||
//
|
||||
// /**
|
||||
// * 用户权限验证的方法,可以访问的用户在shiro.ini里面添加,查看示例样式,不在shiro.ini的用户返回false
|
||||
// *
|
||||
// * @param userName 用户名
|
||||
// * @param passWord 密码
|
||||
// * @return 返回是否具有权限
|
||||
// */
|
||||
// public static Boolean UserAuthentication(String userName, String passWord) {
|
||||
// IniSecurityManagerFactory factory = new IniSecurityManagerFactory("classpath:/META-INF/shiro/shiro-jdbc-realm.ini");
|
||||
// //2、得到SecurityManager实例 并绑定给SecurityUtils
|
||||
// SecurityManager securityManager = (SecurityManager) factory.getInstance();
|
||||
// //2、得到SecurityManager实例 并绑定给SecurityUtils org.apache.shiro.mgt.SecurityManager securityManager = factory.getInstance();
|
||||
// SecurityUtils.setSecurityManager((SecurityManager) securityManager);
|
||||
// //3、得到Subject及创建用户名/密码身份验证Token(即用户身份/凭证)
|
||||
// Subject subject = SecurityUtils.getSubject();
|
||||
// UsernamePasswordToken token = new UsernamePasswordToken(userName, passWord);
|
||||
// try {
|
||||
// //4、登录,即身份验证
|
||||
// subject.login(token);
|
||||
// Assert.assertEquals(true, subject.isAuthenticated()); //断言用户已经登录
|
||||
// //6、退出
|
||||
// subject.logout();
|
||||
// return true;
|
||||
// } catch (AuthenticationException e) {
|
||||
// //5、身份S验证失败
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
@ -0,0 +1,177 @@ |
||||
package com.ynxbd.push.helper; |
||||
|
||||
/** |
||||
* Implementation of the Tiny Encryption Algorithm (TEA). |
||||
* The Tiny Encryption Algorithm is one of the fastest and most efficient |
||||
* cryptographic algorithms in existence. It was developed by David Wheeler and |
||||
* Roger Needham at the Computer Laboratory of Cambridge University. |
||||
* <p> |
||||
* See http://www.cl.cam.ac.uk/ftp/users/djw3/tea.ps
|
||||
* <p> |
||||
* This software was written to provide simple encryption for J2ME. |
||||
* The homepage for this software is http://winterwell.com/software/TEA.php
|
||||
* <p> |
||||
* (c) 2008 Joe Halliwell <joe.halliwell@gmail.com> |
||||
* <p> |
||||
* This program is free software: you can redistribute it and/or modify it |
||||
* under the terms of the GNU Lesser General Public License as published by the |
||||
* Free Software Foundation, either version 3 of the License, or (at your |
||||
* option) any later version. |
||||
* <p> |
||||
* This program is distributed in the hope that it will be useful, but WITHOUT |
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License |
||||
* for more details. |
||||
* <p> |
||||
* You should have received a copy of the GNU Lesser General Public License |
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/ |
||||
|
||||
public class TeaHelper { |
||||
private final static int SUGAR = 0x9E3779B9; |
||||
private final static int CUPS = 32; |
||||
private final static int UNSUGAR = 0xC6EF3720; |
||||
|
||||
private int[] S = new int[4]; |
||||
|
||||
/** |
||||
* Initialize the cipher for encryption or decryption. |
||||
* |
||||
* @param key a 16 byte (128-bit) key |
||||
*/ |
||||
public TeaHelper(byte[] key) { |
||||
if (key == null) |
||||
throw new RuntimeException("Invalid key: Key was null"); |
||||
if (key.length < 16) |
||||
throw new RuntimeException("Invalid key: Length was less than 16 bytes"); |
||||
for (int off = 0, i = 0; i < 4; i++) { |
||||
S[i] = ((key[off++] & 0xff)) | |
||||
((key[off++] & 0xff) << 8) | |
||||
((key[off++] & 0xff) << 16) | |
||||
((key[off++] & 0xff) << 24); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Encrypt an array of bytes. |
||||
* |
||||
* @param clear the cleartext to encrypt |
||||
* @return the encrypted text |
||||
*/ |
||||
public byte[] encrypt(byte[] clear) { |
||||
int paddedSize = ((clear.length / 8) + (((clear.length % 8) == 0) ? 0 : 1)) * 2; |
||||
int[] buffer = new int[paddedSize + 1]; |
||||
buffer[0] = clear.length; |
||||
pack(clear, buffer, 1); |
||||
brew(buffer); |
||||
return unpack(buffer, 0, buffer.length * 4); |
||||
} |
||||
|
||||
/** |
||||
* Decrypt an array of bytes. |
||||
* |
||||
* @param crypt the cipher text to decrypt |
||||
* @return the decrypted text |
||||
*/ |
||||
public byte[] decrypt(byte[] crypt) { |
||||
assert crypt.length % 4 == 0; |
||||
assert (crypt.length / 4) % 2 == 1; |
||||
int[] buffer = new int[crypt.length / 4]; |
||||
pack(crypt, buffer, 0); |
||||
unbrew(buffer); |
||||
return unpack(buffer, 1, buffer[0]); |
||||
} |
||||
|
||||
void brew(int[] buf) { |
||||
assert buf.length % 2 == 1; |
||||
int i, v0, v1, sum, n; |
||||
i = 1; |
||||
while (i < buf.length) { |
||||
n = CUPS; |
||||
v0 = buf[i]; |
||||
v1 = buf[i + 1]; |
||||
sum = 0; |
||||
while (n-- > 0) { |
||||
sum += SUGAR; |
||||
v0 += ((v1 << 4) + S[0] ^ v1) + (sum ^ (v1 >>> 5)) + S[1]; |
||||
v1 += ((v0 << 4) + S[2] ^ v0) + (sum ^ (v0 >>> 5)) + S[3]; |
||||
} |
||||
buf[i] = v0; |
||||
buf[i + 1] = v1; |
||||
i += 2; |
||||
} |
||||
} |
||||
|
||||
void unbrew(int[] buf) { |
||||
assert buf.length % 2 == 1; |
||||
int i, v0, v1, sum, n; |
||||
i = 1; |
||||
while (i < buf.length) { |
||||
n = CUPS; |
||||
v0 = buf[i]; |
||||
v1 = buf[i + 1]; |
||||
sum = UNSUGAR; |
||||
while (n-- > 0) { |
||||
v1 -= ((v0 << 4) + S[2] ^ v0) + (sum ^ (v0 >>> 5)) + S[3]; |
||||
v0 -= ((v1 << 4) + S[0] ^ v1) + (sum ^ (v1 >>> 5)) + S[1]; |
||||
sum -= SUGAR; |
||||
} |
||||
buf[i] = v0; |
||||
buf[i + 1] = v1; |
||||
i += 2; |
||||
} |
||||
} |
||||
|
||||
void pack(byte[] src, int[] dest, int destOffset) { |
||||
assert destOffset + (src.length / 4) <= dest.length; |
||||
int i = 0, shift = 24; |
||||
int j = destOffset; |
||||
dest[j] = 0; |
||||
while (i < src.length) { |
||||
dest[j] |= ((src[i] & 0xff) << shift); |
||||
if (shift == 0) { |
||||
shift = 24; |
||||
j++; |
||||
if (j < dest.length) dest[j] = 0; |
||||
} else { |
||||
shift -= 8; |
||||
} |
||||
i++; |
||||
} |
||||
} |
||||
|
||||
byte[] unpack(int[] src, int srcOffset, int destLength) { |
||||
assert destLength <= (src.length - srcOffset) * 4; |
||||
byte[] dest = new byte[destLength]; |
||||
int i = srcOffset; |
||||
int count = 0; |
||||
for (int j = 0; j < destLength; j++) { |
||||
dest[j] = (byte) ((src[i] >> (24 - (8 * count))) & 0xff); |
||||
count++; |
||||
if (count == 4) { |
||||
count = 0; |
||||
i++; |
||||
} |
||||
} |
||||
return dest; |
||||
} |
||||
|
||||
/* Simple usage example */ |
||||
public static String quote = "Now rise, and show your strength. Be eloquent, and deep, and tender; see, with a clear eye, into Nature, and into life: spread your white wings of quivering thought, and soar, a god-like spirit, over the whirling world beneath you, up through long lanes of flaming stars to the gates of eternity!"; |
||||
|
||||
public static void main(String[] args) { |
||||
/* Create a cipher using the first 16 bytes of the passphrase */ |
||||
TeaHelper tea = new TeaHelper("And is there honey still for tea?".getBytes()); |
||||
|
||||
byte[] original = quote.getBytes(); |
||||
|
||||
/* Run it through the cipher... and back */ |
||||
byte[] crypt = tea.encrypt(original); |
||||
byte[] result = tea.decrypt(crypt); |
||||
|
||||
/* Ensure that all went well */ |
||||
String test = new String(result); |
||||
if (!test.equals(quote)) |
||||
throw new RuntimeException("Fail"); |
||||
} |
||||
} |
||||
@ -0,0 +1,146 @@ |
||||
package com.ynxbd.push.helper; |
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException; |
||||
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
import com.ynxbd.push.entity.tencent.TemplateJson; |
||||
import com.ynxbd.push.entity.tencent.TemplateJsonValue; |
||||
import com.ynxbd.push.entity.tencent.TemplateRemark; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 组装请求的json内容 |
||||
* @author 李进才 |
||||
*/ |
||||
public class TemplateAllKeyWordJson { |
||||
|
||||
/** |
||||
* 模板请求 拼接data 没有小程序跳转 |
||||
* |
||||
* @param templateId 模板id |
||||
* @param openId openid |
||||
* @param url 跳转链接 |
||||
* @param first first |
||||
* @param remark 备注 |
||||
* @param keywords 按关键字填写 |
||||
*/ |
||||
public static String getTemplateJsonData(String templateId, String openId, String url, TemplateRemark first, TemplateRemark remark, |
||||
TemplateJsonValue... keywords) throws JsonProcessingException { |
||||
Map<String, Object> data = new HashMap<>(); |
||||
data.put("first", first); |
||||
data.put("remark", remark); |
||||
|
||||
if (keywords != null && keywords.length > 0) { |
||||
Map<String, Object> itemMap; |
||||
TemplateJsonValue item; |
||||
for (int i = 0; i < keywords.length; i++) { |
||||
itemMap = new HashMap<>(); |
||||
item = keywords[i]; |
||||
if (item == null) { |
||||
data.put(("keyword" + (i + 1)), null); |
||||
continue; |
||||
} |
||||
String color = item.getColor(); |
||||
if (color != null) { |
||||
itemMap.put("color", color); |
||||
} |
||||
itemMap.put("value", item.getValue()); |
||||
data.put(("keyword" + (i + 1)), itemMap); |
||||
} |
||||
} |
||||
|
||||
return getTemplateJson(templateId, openId, url, data); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 模板请求 拼接data 有小程序跳转 |
||||
* |
||||
* @param templateId 模板id |
||||
* @param openId openid |
||||
* @param url 跳转链接 |
||||
* @param first first |
||||
* @param remark 备注 |
||||
* @param keywords 按关键字填写 |
||||
*/ |
||||
public static String getTemplateJsonData(String templateId, String openId, String url, String appId, String pagePath, TemplateRemark first, TemplateRemark remark, |
||||
TemplateJsonValue... keywords) throws JsonProcessingException { |
||||
Map<String, Object> data = new HashMap<>(); |
||||
data.put("first", first); |
||||
data.put("remark", remark); |
||||
|
||||
if (keywords != null && keywords.length > 0) { |
||||
Map<String, Object> itemMap; |
||||
TemplateJsonValue item; |
||||
for (int i = 0; i < keywords.length; i++) { |
||||
itemMap = new HashMap<>(); |
||||
item = keywords[i]; |
||||
if (item == null) { |
||||
data.put(("keyword" + (i + 1)), null); |
||||
continue; |
||||
} |
||||
String color = item.getColor(); |
||||
if (color != null) { |
||||
itemMap.put("color", color); |
||||
} |
||||
itemMap.put("value", item.getValue()); |
||||
data.put(("keyword" + (i + 1)), itemMap); |
||||
} |
||||
} |
||||
|
||||
if(StringUtils.isNotBlank(appId)&&StringUtils.isNotBlank(pagePath)){ |
||||
return getTemplateJson(templateId, openId, url, data); |
||||
} |
||||
return getTemplateJson(templateId, openId, url, data, appId, pagePath); |
||||
} |
||||
|
||||
/** |
||||
* 最终json组合,上面的内容是组装date,有小程序内容跳转 |
||||
* |
||||
* @param templateId |
||||
* @param openId |
||||
* @param url |
||||
* @param data |
||||
* @param appId |
||||
* @param pagePath |
||||
* @return |
||||
* @throws JsonProcessingException |
||||
*/ |
||||
private static String getTemplateJson(String templateId, String openId, String url, Map<String, Object> data, String appId, String pagePath) throws JsonProcessingException { |
||||
Map<String, Object> miniProgram = new HashMap<>(); |
||||
miniProgram.put("appid", appId); |
||||
miniProgram.put("pagepath", pagePath); |
||||
TemplateJson templateJson = TemplateJson.builder() |
||||
.template_id(templateId) |
||||
.miniprogram(miniProgram) |
||||
.touser(openId) |
||||
.url(url) |
||||
.data(data) |
||||
.build(); |
||||
|
||||
return new ObjectMapper().writeValueAsString(templateJson); |
||||
} |
||||
|
||||
/** |
||||
* 最终组合,上面的是组装date,没有小程序跳转 |
||||
* |
||||
* @param templateId |
||||
* @param openId |
||||
* @param url |
||||
* @param data |
||||
* @return |
||||
* @throws JsonProcessingException |
||||
*/ |
||||
private static String getTemplateJson(String templateId, String openId, String url, Map<String, Object> data) throws JsonProcessingException { |
||||
TemplateJson templateJson = TemplateJson.builder() |
||||
.template_id(templateId) |
||||
.touser(openId) |
||||
.url(url) |
||||
.data(data) |
||||
.build(); |
||||
|
||||
return new ObjectMapper().writeValueAsString(templateJson); |
||||
} |
||||
} |
||||
@ -0,0 +1,385 @@ |
||||
package com.ynxbd.push.helper; |
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException; |
||||
import com.ynxbd.push.entity.tencent.SendMessageTemplate; |
||||
import com.ynxbd.push.entity.tencent.TemplateJsonValue; |
||||
import com.ynxbd.push.entity.tencent.TemplateRemark; |
||||
|
||||
|
||||
/** |
||||
* 模版消息发送第二步的流水线 |
||||
* |
||||
* @Project WebApi |
||||
* @Name TemplateMessageDataHelper 得到json字符串的方法 |
||||
* @Author 李进才 |
||||
* @Date 2020/5/25 |
||||
* @Version v1.0.0 |
||||
* @Copyright @ 2017 云南新八达科技有限公司 All rights reserved. |
||||
* Get1 排队叫号提醒 OPENTM417349950 |
||||
* Get2 检验结果通知 OPENTM414005941 |
||||
* Get3 预约挂号失败通知 OPENTM416881028 |
||||
* Get4 缴费成功通知 OPENTM411327952 |
||||
* Get5 住院押金不足提醒 OPENTM417724268 |
||||
* Get6 挂号成功通知 OPENTM413793502 |
||||
* Get7 缴费失败通知 OPENTM411721506 |
||||
* Get8 退费通知 OPENTM207453484 |
||||
* Get9 取消预约通知 OPENTM402119642 |
||||
* Get10 预约医生停诊通知 OPENTM401974562 |
||||
* Get11 挂号失败通知 OPENTM406437214 |
||||
* Get12 预约挂号成功通知 TM00103 |
||||
* Get13 检查报告提醒 OPENTM202187595 |
||||
* Get14 信息完善提醒 OPENTM409876442 |
||||
* Get15 健康卡成功升级通知 OPENTM417520543 |
||||
*/ |
||||
|
||||
|
||||
public class TemplateJsonStringHelper { |
||||
|
||||
/** |
||||
* 模版1 排队叫号提醒 已测试 |
||||
* |
||||
* @param key openId 用户id |
||||
* url 跳转链接 |
||||
* department:科室 |
||||
* doctor:医生 |
||||
* first:标题 |
||||
* currentNumber:当前号码 |
||||
* selfNumber:本人号码 |
||||
* waitNumber:等待人数 |
||||
* remark:备注 |
||||
* template_id 模版id |
||||
* @return |
||||
*/ |
||||
public static String get1(SendMessageTemplate key) throws JsonProcessingException { |
||||
// return "{\"data\":{\"keyword1\":{\"color\":\"#173177\",\"value\":\""+key.getDepartment()+"\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\""+key.getDoctor()+"\"},\"first\":{\"color\":\"#173177\",\"value\":\""+key.getFirst()+"\"},\"keyword3\":{\"color\":\"#173177\",\"value\":\""+key.getCurrentNumber()+"\"},\"keyword4\":{\"color\":\"#173177\",\"value\":\""+key.getSelfNumber()+"\"},\"keyword5\":{\"color\":\"#173177\",\"value\":\""+key.getWaitNumber()+"\"},\"remark\":{\"color\":\"#173177\",\"value\":\""+key.getRemark()+"\"}},\"template_id\":\""+key.getTemplate_id()+"\",\"touser\":\""+key.getOpenId()+"\",\"url\":\""+key.getUrl()+"\"}";
|
||||
return TemplateAllKeyWordJson.getTemplateJsonData(key.getTemplate_id(), |
||||
key.getOpenId(), |
||||
key.getUrl(), |
||||
TemplateRemark.builder().value(key.getFirst()).color("#173177").build(), |
||||
TemplateRemark.builder().value(key.getRemark()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getDepartment()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getDoctor()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getCurrentNumber()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getSelfNumber()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getWaitNumber()).color("#173177").build()); |
||||
} |
||||
|
||||
/** |
||||
* 模版2 检验结果通知 已测试 |
||||
* |
||||
* @param key |
||||
* @return openId 用户id |
||||
* url 跳转链接 |
||||
* item 就诊项目 |
||||
* patientName 病人姓名 |
||||
* first 标题 |
||||
* time 检验时间 |
||||
* remark 备注 |
||||
* template_id 模版id |
||||
*/ |
||||
|
||||
public static String get2(SendMessageTemplate key) throws JsonProcessingException { |
||||
// return "{\"data\":{\"keyword1\":{\"color\":\"#173177\",\"value\":\""+key.getItem()+"\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\""+key.getPatientName()+"\"},\"first\":{\"color\":\"#173177\",\"value\":\""+key.getFirst()+"\"},\"keyword3\":{\"color\":\"#173177\",\"value\":\""+key.getTime()+"\"},\"remark\":{\"color\":\"#173177\",\"value\":\""+key.getRemark()+"\"}},\"template_id\":\""+key.getTemplate_id()+"\",\"touser\":\""+key.getOpenId()+"\",\"url\":\""+key.getUrl()+"\"}";
|
||||
return TemplateAllKeyWordJson.getTemplateJsonData(key.getTemplate_id(), |
||||
key.getOpenId(), |
||||
key.getUrl(), |
||||
TemplateRemark.builder().value(key.getFirst()).color("#173177").build(), |
||||
TemplateRemark.builder().value(key.getRemark()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getItem()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getPatientName()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getTime()).color("#173177").build()); |
||||
} |
||||
|
||||
/** |
||||
* 模版3 预约挂号失败通知 已测试 |
||||
* |
||||
* @param key |
||||
* @return template_id 模版id |
||||
* openId 用户id |
||||
* url 跳转链接 |
||||
* first 标题 |
||||
* remark 备注 |
||||
* department 科室 |
||||
* doctor 医生 |
||||
* patientName 病人 |
||||
* time 预约时间 |
||||
*/ |
||||
|
||||
public static String get3(SendMessageTemplate key) throws JsonProcessingException { |
||||
// return "{\"data\":{\"keyword1\":{\"color\":\"#173177\",\"value\":\""+key.getDepartment()+"\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\""+key.getDoctor()+"\"},\"first\":{\"color\":\"#173177\",\"value\":\""+key.getFirst()+"\"},\"keyword3\":{\"color\":\"#173177\",\"value\":\""+key.getPatientName()+"\"},\"keyword4\":{\"color\":\"#173177\",\"value\":\""+key.getTime()+"\"},\"remark\":{\"color\":\"#173177\",\"value\":\""+key.getRemark()+"\"}},\"template_id\":\""+key.getTemplate_id()+"\",\"touser\":\""+key.getOpenId()+"\",\"url\":\""+key.getUrl()+"\"}";
|
||||
return TemplateAllKeyWordJson.getTemplateJsonData(key.getTemplate_id(), |
||||
key.getOpenId(), |
||||
key.getUrl(), |
||||
TemplateRemark.builder().value(key.getFirst()).color("#173177").build(), |
||||
TemplateRemark.builder().value(key.getRemark()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getDepartment()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getDoctor()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getPatientName()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getTime()).color("#173177").build()); |
||||
} |
||||
|
||||
/** |
||||
* 模版4 缴费成功通知 已测试 |
||||
* template_id 模版id |
||||
* openId 用户id |
||||
* url 跳转链接 |
||||
* first 标题 |
||||
* remark 备注 |
||||
* patientName 缴费人姓名 |
||||
* department 科室 |
||||
* doctor 医生 |
||||
* money 总金额 |
||||
* time 缴费时间 |
||||
* |
||||
* @param key |
||||
* @return |
||||
*/ |
||||
public static String get4(SendMessageTemplate key) throws JsonProcessingException { |
||||
// return "{\"data\":{\"keyword1\":{\"color\":\"#173177\",\"value\":\""+key.getPatientName()+"\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\""+key.getDepartment()+"\"},\"first\":{\"color\":\"#173177\",\"value\":\""+key.getFirst()+"\"},\"keyword3\":{\"color\":\"#173177\",\"value\":\""+key.getDoctor()+"\"},\"keyword4\":{\"color\":\"#173177\",\"value\":\""+key.getMoney()+"\"},\"keyword5\":{\"color\":\"#173177\",\"value\":\""+key.getTime()+"\"},\"remark\":{\"color\":\"#173177\",\"value\":\""+key.getRemark()+"\"}},\"template_id\":\""+key.getTemplate_id()+"\",\"touser\":\""+key.getOpenId()+"\",\"url\":\""+key.getUrl()+"\"}";
|
||||
return TemplateAllKeyWordJson.getTemplateJsonData(key.getTemplate_id(), |
||||
key.getOpenId(), |
||||
key.getUrl(), |
||||
TemplateRemark.builder().value(key.getFirst()).color("#173177").build(), |
||||
TemplateRemark.builder().value(key.getRemark()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getPatientName()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getDepartment()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getDoctor()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getMoney()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getTime()).color("#173177").build()); |
||||
} |
||||
|
||||
/** |
||||
* 模版5 住院押金不足提醒 已测试 |
||||
* template_id 模版id |
||||
* openId 用户id |
||||
* url 跳转链接 |
||||
* first 标题 |
||||
* remark 备注 |
||||
* patientName 就诊人 |
||||
* seq 住院号 |
||||
* bedNumber 床位号 |
||||
* department 科室 |
||||
* money 押金余额 |
||||
* |
||||
* @param key |
||||
* @return |
||||
*/ |
||||
public static String get5(SendMessageTemplate key) { |
||||
return "{\"data\":{\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + key.getPatientName() + "\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + key.getSeq() + "\"},\"first\":{\"color\":\"#173177\",\"value\":\"" + key.getFirst() + "\"},\"keyword3\":{\"color\":\"#173177\",\"value\":\"" + key.getBedNumber() + "\"},\"keyword4\":{\"color\":\"#173177\",\"value\":\"" + key.getDepartment() + "\"},\"keyword5\":{\"color\":\"#173177\",\"value\":\"" + key.getMoney() + "\"},\"remark\":{\"color\":\"#173177\",\"value\":\"" + key.getRemark() + "\"}},\"template_id\":\"" + key.getTemplate_id() + "\",\"touser\":\"" + key.getOpenId() + "\",\"url\":\"" + key.getUrl() + "\"}"; |
||||
} |
||||
|
||||
/** |
||||
* 模版6 挂号成功通知 已测试 |
||||
* template_id 模版id |
||||
* openId 用户id |
||||
* url 跳转链接 |
||||
* first 标题 |
||||
* remark 备注 |
||||
* patientName 就诊人 |
||||
* hospitalName 医院名称 |
||||
* department 科室 |
||||
* doctor 医生 |
||||
* time 就诊时间 |
||||
* |
||||
* @param key |
||||
* @return |
||||
*/ |
||||
public static String get6(SendMessageTemplate key) { |
||||
return "{\"data\":{\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + key.getPatientName() + "\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + key.getHospitalName() + "\"},\"first\":{\"color\":\"#173177\",\"value\":\"" + key.getFirst() + "\"},\"keyword3\":{\"color\":\"#173177\",\"value\":\"" + key.getDepartment() + "\"},\"keyword4\":{\"color\":\"#173177\",\"value\":\"" + key.getDoctor() + "\"},\"keyword5\":{\"color\":\"#173177\",\"value\":\"" + key.getTime() + "\"},\"remark\":{\"color\":\"#173177\",\"value\":\"" + key.getRemark() + "\"}},\"template_id\":\"" + key.getTemplate_id() + "\",\"touser\":\"" + key.getOpenId() + "\",\"url\":\"" + key.getUrl() + "\"}"; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 模版7 缴费失败通知 已测试 |
||||
* template_id 模版id |
||||
* openId 用户id |
||||
* url 跳转链接 |
||||
* first 标题 |
||||
* remark 备注 |
||||
* patientName 就诊人 |
||||
* seq 订单号 |
||||
* department 科室 |
||||
* doctor 医生 |
||||
* money 金额 |
||||
* |
||||
* @param key |
||||
* @return |
||||
*/ |
||||
public static String get7(SendMessageTemplate key) { |
||||
return "{\"data\":{\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + key.getPatientName() + "\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + key.getSeq() + "\"},\"first\":{\"color\":\"#173177\",\"value\":\"" + key.getFirst() + "\"},\"keyword3\":{\"color\":\"#173177\",\"value\":\"" + key.getDepartment() + "\"},\"keyword4\":{\"color\":\"#173177\",\"value\":\"" + key.getDoctor() + "\"},\"keyword5\":{\"color\":\"#173177\",\"value\":\"" + key.getMoney() + "\"},\"remark\":{\"color\":\"#173177\",\"value\":\"" + key.getRemark() + "\"}},\"template_id\":\"" + key.getTemplate_id() + "\",\"touser\":\"" + key.getOpenId() + "\",\"url\":\"" + key.getUrl() + "\"}"; |
||||
} |
||||
|
||||
/** |
||||
* 模版8 退费通知 已测试 |
||||
* template_id 模版id |
||||
* openId 用户id |
||||
* url 跳转链接 |
||||
* first 标题 |
||||
* remark 备注 |
||||
* seq 订单号 |
||||
* money 退款金额 |
||||
* time 退费时间 |
||||
* arrivalTime 到账时间 |
||||
* |
||||
* @param key |
||||
* @return |
||||
*/ |
||||
public static String get8(SendMessageTemplate key) { |
||||
return "{\"data\":{\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + key.getSeq() + "\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + key.getMoney() + "\"},\"first\":{\"color\":\"#173177\",\"value\":\"" + key.getFirst() + "\"},\"keyword3\":{\"color\":\"#173177\",\"value\":\"" + key.getTime() + "\"},\"keyword4\":{\"color\":\"#173177\",\"value\":\"" + key.getArrivalTime() + "\"},\"remark\":{\"color\":\"#173177\",\"value\":\"" + key.getRemark() + "\"}},\"template_id\":\"" + key.getTemplate_id() + "\",\"touser\":\"" + key.getOpenId() + "\",\"url\":\"" + key.getUrl() + "\"}"; |
||||
} |
||||
|
||||
/** |
||||
* 模版9 取消预约通知 已测试 |
||||
* template_id 模版id |
||||
* openId 用户id |
||||
* url 跳转链接 |
||||
* first 标题 |
||||
* remark 备注 |
||||
* hospitalName 医院名称 |
||||
* department 科室 |
||||
* doctor 医生 |
||||
* time 就诊时间 |
||||
* |
||||
* @param key |
||||
* @return |
||||
*/ |
||||
public static String get9(SendMessageTemplate key) { |
||||
return "{\"data\":{\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + key.getHospitalName() + "\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + key.getDepartment() + "\"},\"first\":{\"color\":\"#173177\",\"value\":\"" + key.getFirst() + "\"},\"keyword3\":{\"color\":\"#173177\",\"value\":\"" + key.getDoctor() + "\"},\"keyword4\":{\"color\":\"#173177\",\"value\":\"" + key.getTime() + "\"},\"remark\":{\"color\":\"#173177\",\"value\":\"" + key.getRemark() + "\"}},\"template_id\":\"" + key.getTemplate_id() + "\",\"touser\":\"" + key.getOpenId() + "\",\"url\":\"" + key.getUrl() + "\"}"; |
||||
} |
||||
|
||||
/** |
||||
* 模版10 预约医生停诊通知 已测试 |
||||
* template_id 模版id |
||||
* openId 用户id |
||||
* url 跳转链接 |
||||
* first 标题 |
||||
* remark 备注 |
||||
* patientName 就诊人 |
||||
* hospitalName 医院名称 |
||||
* department 科室 |
||||
* doctor 医生 |
||||
* time 原定时间 |
||||
* |
||||
* @param key |
||||
* @return |
||||
*/ |
||||
public static String get10(SendMessageTemplate key) { |
||||
return "{\"data\":{\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + key.getPatientName() + "\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + key.getHospitalName() + "\"},\"first\":{\"color\":\"#173177\",\"value\":\"" + key.getFirst() + "\"},\"keyword3\":{\"color\":\"#173177\",\"value\":\"" + key.getDepartment() + "\"},\"keyword4\":{\"color\":\"#173177\",\"value\":\"" + key.getDoctor() + "\"},\"keyword5\":{\"color\":\"#173177\",\"value\":\"" + key.getTime() + "\"},\"remark\":{\"color\":\"#173177\",\"value\":\"" + key.getRemark() + "\"}},\"template_id\":\"" + key.getTemplate_id() + "\",\"touser\":\"" + key.getOpenId() + "\",\"url\":\"" + key.getUrl() + "\"}"; |
||||
} |
||||
|
||||
/** |
||||
* 模版11 挂号失败通知 已测试 |
||||
* template_id 模版id |
||||
* openId 用户id |
||||
* url 跳转链接 |
||||
* first 标题 |
||||
* remark 备注 |
||||
* hospitalName 医院名称 |
||||
* department 科室 |
||||
* doctor 医生 |
||||
* time 就诊时间 |
||||
* |
||||
* @param key |
||||
* @return |
||||
*/ |
||||
public static String get11(SendMessageTemplate key) { |
||||
return "{\"data\":{\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + key.getHospitalName() + "\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + key.getDepartment() + "\"},\"first\":{\"color\":\"#173177\",\"value\":\"" + key.getFirst() + "\"},\"keyword3\":{\"color\":\"#173177\",\"value\":\"" + key.getDoctor() + "\"},\"keyword4\":{\"color\":\"#173177\",\"value\":\"" + key.getTime() + "\"},\"remark\":{\"color\":\"#173177\",\"value\":\"" + key.getRemark() + "\"}},\"template_id\":\"" + key.getTemplate_id() + "\",\"touser\":\"" + key.getOpenId() + "\",\"url\":\"" + key.getUrl() + "\"}"; |
||||
} |
||||
|
||||
/** |
||||
* 模版12 预约挂号成功通知 已测试(非keyword) |
||||
* |
||||
* @param key |
||||
* @return template_id 模版id |
||||
* openId 用户id |
||||
* url 跳转链接 |
||||
* first 标题 |
||||
* patientName 病人姓名 |
||||
* patientSex 病人性别 |
||||
* hospitalName 医院名称 |
||||
* department 科室 |
||||
* doctor 医生 |
||||
* seq 流水号 |
||||
* remark 备注 |
||||
*/ |
||||
public static String get12(SendMessageTemplate key) { |
||||
return "{\"data\":{\"department\":{\"color\":\"#173177\",\"value\":\"" + key.getDepartment() + "\"},\"doctor\":{\"color\":\"#173177\",\"value\":\"" + key.getDoctor() + "\"},\"first\":{\"color\":\"#173177\",\"value\":\"" + key.getFirst() + "\"},\"hospitalName\":{\"color\":\"#173177\",\"value\":\"" + key.getHospitalName() + "\"},\"patientName\":{\"color\":\"#173177\",\"value\":\"" + key.getPatientName() + "\"},\"patientSex\":{\"color\":\"#173177\",\"value\":\"" + key.getPatientSex() + "\"},\"remark\":{\"color\":\""+key.getRemarkColor()+"\",\"value\":\"" + key.getRemark() + "\"},\"seq\":{\"color\":\"#173177\",\"value\":\"" + key.getSeq() + "\"}},\"template_id\":\"" + key.getTemplate_id() + "\",\"touser\":\"" + key.getOpenId() + "\",\"url\":\"" + key.getUrl() + "\"}"; |
||||
} |
||||
|
||||
/** |
||||
* 模版13 检查报告提醒 已测试 |
||||
* |
||||
* @param key |
||||
* @return openId 用户id |
||||
* url 跳转链接 |
||||
* item 就诊项目 |
||||
* patientName 病人姓名 |
||||
* first 标题 |
||||
* time 检验时间 |
||||
* remark 备注 |
||||
* template_id 模版id |
||||
*/ |
||||
|
||||
public static String get13(SendMessageTemplate key) { |
||||
return "{\"data\":{\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + key.getItem() + "\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + key.getPatientName() + "\"},\"first\":{\"color\":\"#173177\",\"value\":\"" + key.getFirst() + "\"},\"keyword3\":{\"color\":\"#173177\",\"value\":\"" + key.getTime() + "\"},\"remark\":{\"color\":\"#173177\",\"value\":\"" + key.getRemark() + "\"}},\"template_id\":\"" + key.getTemplate_id() + "\",\"touser\":\"" + key.getOpenId() + "\",\"url\":\"" + key.getUrl() + "\"}"; |
||||
} |
||||
|
||||
/** |
||||
* 模版14 信息完善提醒 已测试 |
||||
* |
||||
* @param key |
||||
* @return openId 用户id |
||||
* url 跳转链接 |
||||
* messageType 信息类型 |
||||
* hospitalName 医院 |
||||
* first 标题 |
||||
* time 检验时间 |
||||
* remark 备注 |
||||
* template_id 模版id |
||||
*/ |
||||
public static String get14(SendMessageTemplate key) { |
||||
if (key.getUrl().isEmpty()) { |
||||
//健康卡链接
|
||||
key.setUrl("https://mp.weixin.qq.com/insurance/card/creditjump?cityid=999999&from=1HPEm43YG0j6674z7Usu8Q.%3D#wechat_redirect"); |
||||
} |
||||
return "{\"data\":{\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + key.getMessageType() + "\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + key.getHospitalName() + "\"},\"first\":{\"color\":\"#173177\",\"value\":\"" + key.getFirst() + "\"},\"remark\":{\"color\":\"#173177\",\"value\":\"" + key.getRemark() + "\"}},\"template_id\":\"" + key.getTemplate_id() + "\",\"touser\":\"" + key.getOpenId() + "\",\"url\":\"" + key.getUrl() + "\"}"; |
||||
} |
||||
|
||||
/** |
||||
* 模版15 健康卡成功升级通知 已测试 |
||||
* |
||||
* @param key |
||||
* @return openId 用户id |
||||
* url 跳转链接 |
||||
* time 升级时间 |
||||
* updateDescription 升级说明 |
||||
* first 标题 |
||||
* time 检验时间 |
||||
* remark 备注 |
||||
* template_id 模版id |
||||
*/ |
||||
public static String get15(SendMessageTemplate key) { |
||||
return "{\"data\":{\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + key.getTime() + "\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + key.getUpdateDescription() + "\"},\"first\":{\"color\":\"#173177\",\"value\":\"" + key.getFirst() + "\"},\"remark\":{\"color\":\"#173177\",\"value\":\"" + key.getRemark() + "\"}},\"template_id\":\"" + key.getTemplate_id() + "\",\"touser\":\"" + key.getOpenId() + "\",\"url\":\"" + key.getUrl() + "\"}"; |
||||
} |
||||
|
||||
public static String get16(SendMessageTemplate key) { |
||||
return "{\"data\":{\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + key.getDoctor() + "\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + key.getPatientName() + "\"},\"keyword3\":{\"color\":\"#173177\",\"value\":\"" + key.getFollowUpStaff() + "\"},\"first\":{\"color\":\"#173177\",\"value\":\"" + key.getFirst() + "\"},\"remark\":{\"color\":\"#173177\",\"value\":\"" + key.getRemark() + "\"}},\"template_id\":\"" + key.getTemplate_id() + "\",\"touser\":\"" + key.getOpenId() + "\",\"url\":\"" + key.getUrl() + "\"}"; |
||||
} |
||||
|
||||
|
||||
|
||||
public static String get(SendMessageTemplate key) throws JsonProcessingException { |
||||
return TemplateAllKeyWordJson.getTemplateJsonData(key.getTemplate_id(), |
||||
key.getOpenId(), |
||||
key.getUrl(), |
||||
key.getAppId(), |
||||
key.getPagePath(), |
||||
TemplateRemark.builder().value(key.getFirst()).color("#173177").build(), |
||||
TemplateRemark.builder().value(key.getRemark()).color("#173177").build(), |
||||
TemplateJsonValue.builder().value(key.getKeyword1()).color(key.getKeyword1Color()).build(), |
||||
TemplateJsonValue.builder().value(key.getKeyword2()).color(key.getKeyword2Color()).build(), |
||||
TemplateJsonValue.builder().value(key.getKeyword3()).color(key.getKeyword3Color()).build(), |
||||
TemplateJsonValue.builder().value(key.getKeyword4()).color(key.getKeyword4Color()).build(), |
||||
TemplateJsonValue.builder().value(key.getKeyword5()).color(key.getKeyword5Color()).build()); |
||||
} |
||||
} |
||||
@ -0,0 +1,66 @@ |
||||
package com.ynxbd.push.helper; |
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException; |
||||
import com.ynxbd.push.entity.tencent.SendMessageTemplate; |
||||
|
||||
/** |
||||
* @author 真正组装json的地方,模版消息发送第二步真正的工作车间 |
||||
*/ |
||||
public class TemplateSelectHelper { |
||||
public static String select(SendMessageTemplate sendMessageTemplate) throws JsonProcessingException { |
||||
String jsonString = null; |
||||
switch (sendMessageTemplate.getCode()) { |
||||
case 1: |
||||
jsonString = TemplateJsonStringHelper.get1(sendMessageTemplate); |
||||
break; |
||||
case 2: |
||||
jsonString = TemplateJsonStringHelper.get2(sendMessageTemplate); |
||||
break; |
||||
case 3: |
||||
jsonString = TemplateJsonStringHelper.get3(sendMessageTemplate); |
||||
break; |
||||
case 4: |
||||
jsonString = TemplateJsonStringHelper.get4(sendMessageTemplate); |
||||
break; |
||||
case 5: |
||||
jsonString = TemplateJsonStringHelper.get5(sendMessageTemplate); |
||||
break; |
||||
case 6: |
||||
jsonString = TemplateJsonStringHelper.get6(sendMessageTemplate); |
||||
break; |
||||
case 7: |
||||
jsonString = TemplateJsonStringHelper.get7(sendMessageTemplate); |
||||
break; |
||||
case 8: |
||||
jsonString = TemplateJsonStringHelper.get8(sendMessageTemplate); |
||||
break; |
||||
case 9: |
||||
jsonString = TemplateJsonStringHelper.get9(sendMessageTemplate); |
||||
break; |
||||
case 10: |
||||
jsonString = TemplateJsonStringHelper.get10(sendMessageTemplate); |
||||
break; |
||||
case 11: |
||||
jsonString = TemplateJsonStringHelper.get11(sendMessageTemplate); |
||||
break; |
||||
case 12: |
||||
jsonString = TemplateJsonStringHelper.get12(sendMessageTemplate); |
||||
break; |
||||
case 13: |
||||
jsonString = TemplateJsonStringHelper.get13(sendMessageTemplate); |
||||
break; |
||||
case 14: |
||||
jsonString = TemplateJsonStringHelper.get14(sendMessageTemplate); |
||||
break; |
||||
case 15: |
||||
jsonString = TemplateJsonStringHelper.get15(sendMessageTemplate); |
||||
break; |
||||
case 16: |
||||
jsonString = TemplateJsonStringHelper.get16(sendMessageTemplate); |
||||
break; |
||||
default: |
||||
jsonString = TemplateJsonStringHelper.get(sendMessageTemplate); |
||||
} |
||||
return jsonString; |
||||
} |
||||
} |
||||
@ -0,0 +1,188 @@ |
||||
package com.ynxbd.push.helper; |
||||
|
||||
import com.alibaba.fastjson.JSON; |
||||
import com.alibaba.fastjson.JSONArray; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
import lombok.ToString; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
@Slf4j |
||||
public class TestResult { |
||||
|
||||
@Data |
||||
@NoArgsConstructor |
||||
@ToString |
||||
public static class TestDoctor { |
||||
private String docCode; |
||||
private String docName; |
||||
} |
||||
|
||||
|
||||
public static void main(String[] args) { |
||||
String json = "{\n" + |
||||
" \"Code\": \"200\",\n" + |
||||
" \"Msg\": \"SUCCESS\",\n" + |
||||
" \"Data\": [\n" + |
||||
" {\n" + |
||||
" \"docCode\": \"0002\",\n" + |
||||
" \"docName\": \"李卫\"\n" + |
||||
" },\n" + |
||||
" {\n" + |
||||
" \"docCode\": \"0003\",\n" + |
||||
" \"docName\": \"杨淑\"\n" + |
||||
" },\n" + |
||||
" {\n" + |
||||
" \"docCode\": \"0005\",\n" + |
||||
" \"docName\": \"马晓琳\"\n" + |
||||
" },\n" + |
||||
" {\n" + |
||||
" \"docCode\": \"0010\",\n" + |
||||
" \"docName\": \"张永云\"\n" + |
||||
" },\n" + |
||||
" {\n" + |
||||
" \"docCode\": \"0011\",\n" + |
||||
" \"docName\": \"蔡连勇\"\n" + |
||||
" },\n" + |
||||
" {\n" + |
||||
" \"docCode\": \"0012\",\n" + |
||||
" \"docName\": \"罗琳辉\"\n" + |
||||
" },\n" + |
||||
" {\n" + |
||||
" \"docCode\": \"0013\",\n" + |
||||
" \"docName\": \"屈继波\"\n" + |
||||
" },\n" + |
||||
" {\n" + |
||||
" \"docCode\": \"0015\",\n" + |
||||
" \"docName\": \"李瀛\"\n" + |
||||
" },\n" + |
||||
" {\n" + |
||||
" \"docCode\": \"0016\",\n" + |
||||
" \"docName\": \"杨阳\"\n" + |
||||
" },\n" + |
||||
" {\n" + |
||||
" \"docCode\": \"0017\",\n" + |
||||
" \"docName\": \"江为民\"\n" + |
||||
" }\n" + |
||||
" ],\n" + |
||||
" \"Note\": {\n" + |
||||
" \"funcName\": \"DeanSearch_wechatDataPush\",\n" + |
||||
" \"funcNote\": \"微信推送数据\",\n" + |
||||
" \"connTime\": 30,\n" + |
||||
" \"inParams\": {},\n" + |
||||
" \"isListOutParams\": true,\n" + |
||||
" \"outParams\": {\n" + |
||||
" \"docCode\": \"医生code\",\n" + |
||||
" \"docName\": \"医生name\"\n" + |
||||
" }\n" + |
||||
" }\n" + |
||||
"}"; |
||||
|
||||
String respData = getRespData(json); |
||||
System.out.println(respData); |
||||
List<TestDoctor> testDoctors = jsonToList(respData, TestDoctor.class); |
||||
System.out.println(testDoctors); |
||||
|
||||
List<String> doctCodeList = jsonToList(respData, "docCode"); |
||||
System.out.println(doctCodeList); |
||||
} |
||||
|
||||
/** |
||||
* 获取请求中的数据 |
||||
*/ |
||||
public static String getRespData(String respData) { |
||||
if (respData == null) { |
||||
return null; |
||||
} |
||||
JSONObject jsonResp = JSON.parseObject(respData); |
||||
String code = jsonResp.getString("Code"); |
||||
String message = jsonResp.getString("Msg"); |
||||
if ("200".equals(code) && "SUCCESS".equals(message)) { |
||||
String data = jsonResp.getString("Data"); |
||||
return "".equals(data) ? null : data; |
||||
} |
||||
log.info("[请求失败]code={}, message={}", code, message); |
||||
return null; |
||||
} |
||||
|
||||
public static <T> List<T> jsonToList(String data, Class<T> clazz) { |
||||
if (data == null) { |
||||
return new ArrayList<>(); |
||||
} |
||||
String jsonStr = JSON.toJSONString(data); |
||||
if ("".equals(jsonStr)) { |
||||
return new ArrayList<>(); |
||||
} |
||||
try { |
||||
return JSON.parseArray(data, clazz); |
||||
} catch (Exception e) { |
||||
log.error(e.getMessage()); |
||||
return new ArrayList<>(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取对象数组中某个名称的值,加入集合 |
||||
* |
||||
* @param data json数据 |
||||
* @param name 属性名称 |
||||
* @return 属性List |
||||
*/ |
||||
public static List<String> jsonToList(String data, String name) { |
||||
List<String> resultList = new ArrayList<>(); |
||||
if (data == null) { |
||||
return resultList; |
||||
} |
||||
String jsonStr = JSON.toJSONString(data); |
||||
if ("".equals(jsonStr)) { |
||||
return resultList; |
||||
} |
||||
|
||||
try { |
||||
JSONArray jsonArr = JSON.parseArray(data); |
||||
JSONObject itemObj; |
||||
String val; |
||||
for (int i = 0; i < jsonArr.size(); i++) { |
||||
itemObj = jsonArr.getJSONObject(i); |
||||
if (itemObj == null) { |
||||
continue; |
||||
} |
||||
val = itemObj.getString(name); |
||||
if (val != null && !"".equals(val)) { |
||||
resultList.add(val); |
||||
} |
||||
} |
||||
return resultList; |
||||
} catch (Exception e) { |
||||
log.error(e.getMessage()); |
||||
} |
||||
return resultList; |
||||
} |
||||
|
||||
/** |
||||
* json转实体类 |
||||
* @param data 数据 |
||||
* @param clazz 类型 |
||||
* @return 对象 |
||||
*/ |
||||
public static <T> T jsonToBean(String data, Class<T> clazz) { |
||||
if (data == null) { |
||||
return null; |
||||
} |
||||
String jsonStr = JSON.toJSONString(data); |
||||
if ("".equals(jsonStr)) { |
||||
return null; |
||||
} |
||||
try { |
||||
return JSON.parseObject(data, clazz); |
||||
} catch (Exception e) { |
||||
log.error(e.getMessage()); |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,50 @@ |
||||
package com.ynxbd.push.httpRequest.tencent; |
||||
|
||||
|
||||
import com.ynxbd.push.entity.tencent.TemplateList; |
||||
import com.ynxbd.push.entity.tencent.WeChatResponse; |
||||
import com.ynxbd.push.entity.tencent.WeChatUserInfo; |
||||
import com.ynxbd.push.helper.RequestHelper; |
||||
import com.ynxbd.push.httpRequest.xbd.wx.WxCacheRequest; |
||||
import org.apache.http.Header; |
||||
import org.apache.http.client.methods.HttpUriRequest; |
||||
import org.apache.http.client.methods.RequestBuilder; |
||||
import weixin.popular.api.API; |
||||
import weixin.popular.client.LocalHttpClient; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
import java.util.stream.Collectors; |
||||
|
||||
|
||||
/** |
||||
* 获取微信用户信息接口 |
||||
* |
||||
* @author 李进才 |
||||
*/ |
||||
public class WeChatDataRequest { |
||||
private WeChatDataRequest() { |
||||
} |
||||
|
||||
protected static Header jsonHeader; |
||||
|
||||
public static WeChatUserInfo userInfo(String openId) { |
||||
HttpUriRequest httpUriRequest = RequestBuilder.get().setHeader(jsonHeader).setUri("https://api.weixin.qq.com/cgi-bin/user/info").addParameter("access_token", API.accessToken(WxCacheRequest.getAccessToken())).addParameter("openid", openId).addParameter("lang", "zh_CN").build(); |
||||
return LocalHttpClient.executeJsonResult(httpUriRequest, WeChatUserInfo.class); |
||||
} |
||||
|
||||
public static WeChatResponse getOpenIdForDoctorCode(String doctorCode) { |
||||
Map<String, String> params = new HashMap<>(); |
||||
params.put("doctCode",doctorCode); |
||||
return RequestHelper.get("http://127.0.0.1/micro/msg_push/doctor", params, WeChatResponse.class); |
||||
} |
||||
|
||||
private static TemplateList getTemplateList() { |
||||
HttpUriRequest httpUriRequest = RequestBuilder.get().setHeader(jsonHeader).setUri("https://api.weixin.qq.com/cgi-bin/template/get_all_private_template").addParameter("access_token", API.accessToken(WxCacheRequest.getAccessToken())).addParameter("lang", "zh_CN").build(); |
||||
return LocalHttpClient.executeJsonResult(httpUriRequest, TemplateList.class); |
||||
} |
||||
|
||||
public static String getTemplateId(String title) { |
||||
return getTemplateList().getTemplate_list().stream().filter(p -> p.getTitle().equals(title)).collect(Collectors.toList()).get(0).getTemplate_id(); |
||||
} |
||||
} |
||||
@ -0,0 +1,28 @@ |
||||
package com.ynxbd.push.httpRequest.xbd.his; |
||||
|
||||
import com.ynxbd.push.entity.tencent.WeChatResponse; |
||||
import com.ynxbd.push.helper.RequestHelper; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author 李进才 |
||||
* @ClassName WorkLoadRequest |
||||
* @Description description |
||||
* @date 2022/7/22 11:32 |
||||
*/ |
||||
public class HisRequest { |
||||
|
||||
private HisRequest() { |
||||
|
||||
} |
||||
|
||||
|
||||
public static WeChatResponse getWorkLoad(String doctorCode) { |
||||
Map<String, String> params = new HashMap<>(); |
||||
params.put("methodName","DeanSearch_wechatDataPush"); |
||||
params.put("paramsStr","{}"); |
||||
return RequestHelper.get("http://10.20.10.41:8082/api/SqlContext/ExecMethodByName", params, WeChatResponse.class); |
||||
} |
||||
} |
||||
@ -0,0 +1,81 @@ |
||||
package com.ynxbd.push.httpRequest.xbd.wx; |
||||
|
||||
import com.ynxbd.push.config.EhCacheConfig; |
||||
import com.ynxbd.push.config.IniConfig; |
||||
import com.ynxbd.push.entity.xbd.wx.AccessToken; |
||||
import com.ynxbd.push.helper.DesEncryptHelper; |
||||
import com.ynxbd.push.helper.RequestHelper; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.ehcache.Cache; |
||||
|
||||
@Slf4j |
||||
public class WxCacheRequest { |
||||
private static final String SERVICE_URL = "http://127.0.0.1:8080/wx/api/getWxAccessToken.do"; |
||||
private static final String LOCALHOST_URL = "http://wx.mzsrmyy.net/wx/api/getWxAccessToken.do"; |
||||
private static Integer RETRY_INDEX = 0; |
||||
private static final Integer MAX_RETRY = 3; |
||||
|
||||
|
||||
static { |
||||
createAccessTokenCache(); |
||||
} |
||||
|
||||
// 缓存
|
||||
|
||||
private static Cache<String, String> ACCESS_TOKEN_CACHE; |
||||
|
||||
|
||||
private synchronized static void createAccessTokenCache() { |
||||
if (ACCESS_TOKEN_CACHE == null) { |
||||
// 一个半小时
|
||||
ACCESS_TOKEN_CACHE = EhCacheConfig.createCacheTTL(String.class, String.class, "wx_access_token_cache", (7100L)); |
||||
} |
||||
} |
||||
|
||||
public static String getAccessToken() { |
||||
if (ACCESS_TOKEN_CACHE == null) { |
||||
createAccessTokenCache(); |
||||
} |
||||
RETRY_INDEX = 0; |
||||
String cacheName = "access_token"; |
||||
String accessToken = ACCESS_TOKEN_CACHE.get(cacheName); |
||||
if (accessToken == null) { |
||||
accessToken = getWxAccessToken(ACCESS_TOKEN_CACHE, cacheName); |
||||
if (accessToken != null) { |
||||
ACCESS_TOKEN_CACHE.put(cacheName, accessToken); |
||||
} |
||||
} |
||||
return accessToken; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取微信token |
||||
*/ |
||||
public synchronized static String getWxAccessToken(Cache<String, String> cache, String cacheName) { |
||||
try { |
||||
String accessToken = cache.get(cacheName); |
||||
if (accessToken != null) { |
||||
return accessToken; |
||||
} |
||||
log.info("启动医院为:{}", IniConfig.getInstance("name")); |
||||
AccessToken messageSendResult = RequestHelper.get(SERVICE_URL, null, AccessToken.class); |
||||
log.info("access_code:{}", messageSendResult.getCode()); |
||||
String token = DesEncryptHelper.deCode(messageSendResult.getData()); |
||||
log.info("access_token:" + token); |
||||
|
||||
return token; |
||||
} catch (Exception e) { |
||||
RETRY_INDEX++; |
||||
log.error("请求微信获取Token错误:{}", e.getMessage()); |
||||
if(RETRY_INDEX > MAX_RETRY){ |
||||
log.error("多次请求后未获取到正确token,抛出异常"); |
||||
return null; |
||||
} |
||||
log.error("重试请求第{}次",RETRY_INDEX); |
||||
getWxAccessToken(ACCESS_TOKEN_CACHE, cacheName); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,51 @@ |
||||
package com.ynxbd.push.quartz.job; |
||||
|
||||
|
||||
import com.ynxbd.push.config.IniConfig; |
||||
import com.ynxbd.push.entity.tencent.SendMessageTemplate; |
||||
import com.ynxbd.push.helper.MessageApiHelper; |
||||
import lombok.SneakyThrows; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.quartz.Job; |
||||
import org.quartz.JobExecutionContext; |
||||
|
||||
import java.text.SimpleDateFormat; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* 任务调度-定时推送每日工作量表 |
||||
* @author 李进才 |
||||
*/ |
||||
@Slf4j |
||||
public class TimePushJob implements Job { |
||||
|
||||
|
||||
@SneakyThrows |
||||
@Override |
||||
public void execute(JobExecutionContext jobExecutionContext) { |
||||
|
||||
if(IniConfig.getInstance("lisTemplateId")==null){ |
||||
return; |
||||
} |
||||
SimpleDateFormat sdf = new SimpleDateFormat(); |
||||
sdf.applyPattern("yyyy-MM-dd HH:mm:ss a"); |
||||
Date date = new Date(); |
||||
SendMessageTemplate sendMessageTemplate = SendMessageTemplate.builder() |
||||
.template_id(IniConfig.getInstance("lisTemplateId")) |
||||
.keyword1("医学检验科") |
||||
.keyword2("检验日报") |
||||
.keyword3(sdf.format(date)) |
||||
.keyword4("点击查看详情") |
||||
.remark(new StringBuilder().append(sdf.format(date)).append("工作日报").toString()) |
||||
.url(IniConfig.getInstance("lisUrl")) |
||||
.build(); |
||||
|
||||
String lisPeoples = IniConfig.getInstance("lisPeople"); |
||||
for (String lisPeople: lisPeoples.split(";")) { |
||||
sendMessageTemplate.setOpenId(lisPeople); |
||||
log.info("定时任务推送每日工作量表:openId={}, ErrCode={}, ", |
||||
sendMessageTemplate.getOpenId(), |
||||
MessageApiHelper.templateMessageSend(sendMessageTemplate).getMsg_status()); // 推送
|
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,23 @@ |
||||
package com.ynxbd.push.quartz.job; |
||||
|
||||
import lombok.SneakyThrows; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.quartz.Job; |
||||
import org.quartz.JobExecutionContext; |
||||
import org.quartz.JobExecutionException; |
||||
|
||||
/** |
||||
* @author 李进才 |
||||
* @ClassName WorkLoadJob |
||||
* @Description description |
||||
* @date 2022/7/22 11:01 |
||||
*/ |
||||
@Slf4j |
||||
public class WorkLoadJob implements Job { |
||||
|
||||
@SneakyThrows |
||||
@Override |
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { |
||||
|
||||
} |
||||
} |
||||
@ -0,0 +1,49 @@ |
||||
package com.ynxbd.push.quartz.listener; |
||||
|
||||
import com.ynxbd.push.quartz.scheduler.AppQuartzScheduler; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.quartz.Scheduler; |
||||
import org.quartz.SchedulerException; |
||||
import org.quartz.SchedulerFactory; |
||||
import org.quartz.impl.StdSchedulerFactory; |
||||
import org.springframework.context.ApplicationListener; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.context.event.ContextRefreshedEvent; |
||||
|
||||
import javax.annotation.Resource; |
||||
|
||||
/** |
||||
* 任务监听器 |
||||
* @author 李进才 |
||||
*/ |
||||
|
||||
@Slf4j |
||||
@Configuration |
||||
public class AppStartQuartzJobListener implements ApplicationListener<ContextRefreshedEvent> { |
||||
@Resource |
||||
private AppQuartzScheduler quartzScheduler; |
||||
|
||||
/** |
||||
* 初始启动quartz |
||||
*/ |
||||
@Override |
||||
public void onApplicationEvent(ContextRefreshedEvent event) { |
||||
try { |
||||
log.info("[<QUZRTZ DISPATCH>]Starting Quartz task ..."); |
||||
quartzScheduler.startCrontabJob(); |
||||
} catch (SchedulerException e) { |
||||
log.error("[<QUZRTZ DISPATCH>]ERROR: ", e); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 初始注入scheduler |
||||
*/ |
||||
@Bean |
||||
public Scheduler scheduler() throws SchedulerException { |
||||
SchedulerFactory schedulerFactoryBean = new StdSchedulerFactory(); |
||||
return schedulerFactoryBean.getScheduler(); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,133 @@ |
||||
package com.ynxbd.push.quartz.scheduler; |
||||
|
||||
|
||||
import com.ynxbd.push.quartz.job.TimePushJob; |
||||
import org.quartz.*; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* 任务启动的以及相关的调度器 |
||||
* |
||||
* @author 李进才 |
||||
*/ |
||||
@Component |
||||
public class AppQuartzScheduler { |
||||
|
||||
@Resource |
||||
private Scheduler scheduler; |
||||
|
||||
/** |
||||
* 开始执行所有任务 |
||||
*/ |
||||
public void startNormalJob() throws SchedulerException { |
||||
startNormalJob(scheduler); |
||||
scheduler.start(); |
||||
} |
||||
|
||||
public void startCrontabJob() throws SchedulerException { |
||||
startCrontabJob(scheduler); |
||||
scheduler.start(); |
||||
} |
||||
|
||||
/** |
||||
* 获取Job信息 |
||||
*/ |
||||
public String getJobInfo(String name, String group) throws SchedulerException { |
||||
TriggerKey triggerKey = new TriggerKey(name, group); |
||||
CronTrigger cronTrigger = (CronTrigger) scheduler.getTrigger(triggerKey); |
||||
return String.format("time:%s,state:%s", cronTrigger.getCronExpression(), |
||||
scheduler.getTriggerState(triggerKey).name()); |
||||
} |
||||
|
||||
/** |
||||
* 修改某个任务的执行时间 |
||||
*/ |
||||
public boolean modifyJob(String name, String group, String time) throws SchedulerException { |
||||
Date date = null; |
||||
TriggerKey triggerKey = new TriggerKey(name, group); |
||||
CronTrigger cronTrigger = (CronTrigger) scheduler.getTrigger(triggerKey); |
||||
String oldTime = cronTrigger.getCronExpression(); |
||||
if (!oldTime.equalsIgnoreCase(time)) { |
||||
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(time); |
||||
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(name, group) |
||||
.withSchedule(cronScheduleBuilder).build(); |
||||
date = scheduler.rescheduleJob(triggerKey, trigger); |
||||
} |
||||
return date != null; |
||||
} |
||||
|
||||
/** |
||||
* 暂停所有任务 |
||||
*/ |
||||
public void pauseAllJob() throws SchedulerException { |
||||
scheduler.pauseAll(); |
||||
} |
||||
|
||||
/** |
||||
* 暂停某个任务 |
||||
*/ |
||||
public void pauseJob(String name, String group) throws SchedulerException { |
||||
JobKey jobKey = new JobKey(name, group); |
||||
JobDetail jobDetail = scheduler.getJobDetail(jobKey); |
||||
if (jobDetail == null) { |
||||
return; |
||||
} |
||||
scheduler.pauseJob(jobKey); |
||||
} |
||||
|
||||
/** |
||||
* 恢复所有任务 |
||||
*/ |
||||
public void resumeAllJob() throws SchedulerException { |
||||
scheduler.resumeAll(); |
||||
} |
||||
|
||||
/** |
||||
* 恢复某个任务 |
||||
*/ |
||||
public void resumeJob(String name, String group) throws SchedulerException { |
||||
JobKey jobKey = new JobKey(name, group); |
||||
JobDetail jobDetail = scheduler.getJobDetail(jobKey); |
||||
if (jobDetail == null) { |
||||
return; |
||||
} |
||||
scheduler.resumeJob(jobKey); |
||||
} |
||||
|
||||
/** |
||||
* 删除某个任务 |
||||
*/ |
||||
public void deleteJob(String name, String group) throws SchedulerException { |
||||
JobKey jobKey = new JobKey(name, group); |
||||
JobDetail jobDetail = scheduler.getJobDetail(jobKey); |
||||
if (jobDetail == null) { |
||||
return; |
||||
} |
||||
scheduler.deleteJob(jobKey); |
||||
} |
||||
|
||||
/** |
||||
* 简单调取器 |
||||
*/ |
||||
private void startNormalJob(Scheduler scheduler) throws SchedulerException { |
||||
JobDetail jobDetail = JobBuilder.newJob(TimePushJob.class).withIdentity("TimePush", "WorkLog").build(); |
||||
SimpleScheduleBuilder simpleScheduleBuilder = SimpleScheduleBuilder.repeatMinutelyForever(); |
||||
simpleScheduleBuilder.withIntervalInSeconds(10); |
||||
SimpleTrigger simpleTrigger = TriggerBuilder.newTrigger().withIdentity("TimePush", "WorkLog").withSchedule(simpleScheduleBuilder).build(); |
||||
scheduler.scheduleJob(jobDetail, simpleTrigger); |
||||
} |
||||
|
||||
/** |
||||
* 基于 Crontab 的调度器 |
||||
*/ |
||||
private void startCrontabJob(Scheduler scheduler) throws SchedulerException { |
||||
JobDetail jobDetail = JobBuilder.newJob(TimePushJob.class).withIdentity("TimePush", "WorkLog").build(); |
||||
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule("0 15 18 * * ?"); |
||||
CronTrigger cronTrigger = TriggerBuilder.newTrigger().withIdentity("TimePush", "WorkLog").withSchedule(cronScheduleBuilder).build(); |
||||
scheduler.scheduleJob(jobDetail, cronTrigger); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,30 @@ |
||||
package com.ynxbd.push.realm;//package com.ynxbd.push.realm;
|
||||
//
|
||||
//import org.apache.shiro.authc.*;
|
||||
//import org.apache.shiro.realm.Realm;
|
||||
//
|
||||
//public class UserRealm implements Realm {
|
||||
// @Override
|
||||
// public String getName() {
|
||||
// return "UserRealm";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean supports(AuthenticationToken token) {
|
||||
// return token instanceof UsernamePasswordToken;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public AuthenticationInfo getAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
|
||||
// String username = (String)token.getPrincipal(); //得到用户名
|
||||
// String password = new String((char[])token.getCredentials()); //得到密码
|
||||
// if(!"zhang".equals(username)) {
|
||||
// throw new UnknownAccountException(); //如果用户名错误
|
||||
// }
|
||||
// if(!"123".equals(password)) {
|
||||
// throw new IncorrectCredentialsException(); //如果密码错误
|
||||
// }
|
||||
// //如果身份认证验证成功,返回一个AuthenticationInfo实现;
|
||||
// return new SimpleAuthenticationInfo(username, password, getName());
|
||||
// }
|
||||
//}
|
||||
@ -0,0 +1,18 @@ |
||||
package com.ynxbd.push.thread; |
||||
|
||||
import java.util.concurrent.LinkedBlockingQueue; |
||||
import java.util.concurrent.ThreadPoolExecutor; |
||||
import java.util.concurrent.TimeUnit; |
||||
|
||||
/** |
||||
* @author 李进才 |
||||
*/ |
||||
public class ThreadConfig { |
||||
private ThreadConfig(){} |
||||
|
||||
public static final Integer MAX_QUEUE_COUNT = 10000; |
||||
public static ThreadPoolExecutor getExecutor(int corePoolSize,int maximumPoolSize) { |
||||
LinkedBlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<>(MAX_QUEUE_COUNT); |
||||
return new ThreadPoolExecutor(corePoolSize, maximumPoolSize, 1000, TimeUnit.MINUTES, workQueue); |
||||
} |
||||
} |
||||
@ -0,0 +1,25 @@ |
||||
package com.ynxbd.push.wxSend; |
||||
|
||||
/** |
||||
* @author 李进才 |
||||
* @ClassName TemplateEnum |
||||
* @Description description |
||||
* @date 2022/7/14 11:46 |
||||
*/ |
||||
public enum TemplateEnum { |
||||
/** |
||||
* 模版推送 绑定通知 |
||||
*/ |
||||
BING_NOTICE("绑定通知"); |
||||
|
||||
private final String value; |
||||
|
||||
|
||||
TemplateEnum(String value) { |
||||
this.value = value; |
||||
} |
||||
|
||||
public String value() { |
||||
return value; |
||||
} |
||||
} |
||||
@ -0,0 +1 @@ |
||||
|
||||
@ -0,0 +1,20 @@ |
||||
server: |
||||
port: 8123 # 设置端口,仅对内置tomcat有效 |
||||
servlet: |
||||
context-path: "/MessagePlatform" |
||||
tomcat: |
||||
max-http-form-post-size: 10485760 # 10M |
||||
|
||||
|
||||
spring: |
||||
jackson: |
||||
# 时间格式化 |
||||
date-format: yyyy/MM/dd HH:mm:ss |
||||
time-zone: GMT+8 |
||||
|
||||
logging: |
||||
level: |
||||
com: |
||||
ynxbd: |
||||
push: |
||||
mapper: info |
||||
@ -0,0 +1,28 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<config xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' |
||||
xmlns='http://www.ehcache.org/v3' |
||||
xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core.xsd"> |
||||
|
||||
<!-- 硬盘缓存路径--> |
||||
<persistence directory="../wx-push-cache/wx-push-cache-data"/> |
||||
|
||||
<cache-template name="cache-template"> |
||||
<key-type>java.lang.String</key-type> |
||||
<value-type>java.lang.String</value-type> |
||||
<expiry> |
||||
<!--最大存活时间 60s--> |
||||
<ttl unit="seconds">60</ttl> |
||||
</expiry> |
||||
<resources> |
||||
<!--注意金字塔配置--> |
||||
<!--堆内缓存 50M--> |
||||
<heap unit="MB">20</heap> |
||||
<!--堆外缓存 100M--> |
||||
<offheap unit="MB">50</offheap> |
||||
<!--硬盘缓存 persistent=“true” 下次重启从磁盘读取数据--> |
||||
<disk persistent="true" unit="MB">100</disk> |
||||
</resources> |
||||
</cache-template> |
||||
|
||||
<cache alias="default_cache" uses-template="cache-template"/> |
||||
</config> |
||||
@ -0,0 +1,154 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<configuration> |
||||
<!-- 日志存放路径 --> |
||||
<property name="log.path" value="../logs"/> |
||||
<!--日志最大保存天数 100年--> |
||||
<property name="log.days" value="36500"/> |
||||
<!-- 日志输出格式 --> |
||||
<property name="log.pattern" |
||||
value="[%d{HH:mm:ss.SSS}][%class - %method - %line] %msg%n"/> |
||||
|
||||
<!-- 控制台输出 --> |
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> |
||||
<encoder> |
||||
<pattern>${log.pattern}</pattern> |
||||
</encoder> |
||||
</appender> |
||||
|
||||
<appender name="debug_file" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<file>${log.path}/debug.log</file> |
||||
<!-- 循环政策:基于时间创建日志文件 --> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<!-- 日志文件名格式 --> |
||||
<fileNamePattern>${log.path}/debug/debug-%d{yyyy-MM-dd}.log</fileNamePattern> |
||||
<!-- 日志最大的历史/天 --> |
||||
<maxHistory>${log.days}</maxHistory> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern>${log.pattern}</pattern> |
||||
</encoder> |
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
<!-- 过滤的级别 --> |
||||
<level>DEBUG</level> |
||||
<!-- 匹配时的操作:接收(记录)--> |
||||
<onMatch>ACCEPT</onMatch> |
||||
<!-- 不匹配时的操作:拒绝(不记录)--> |
||||
<onMismatch>DENY</onMismatch> |
||||
</filter> |
||||
</appender> |
||||
|
||||
<appender name="warn_file" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<file>${log.path}/warn.log</file> |
||||
<!-- 循环政策:基于时间创建日志文件 --> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<!-- 日志文件名格式 --> |
||||
<fileNamePattern>${log.path}/warn/warn-%d{yyyy-MM-dd}.log</fileNamePattern> |
||||
<!-- 日志最大的历史/天 --> |
||||
<maxHistory>${log.days}</maxHistory> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern>${log.pattern}</pattern> |
||||
</encoder> |
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
<!-- 过滤的级别 --> |
||||
<level>WARN</level> |
||||
<!-- 匹配时的操作:接收(记录)--> |
||||
<onMatch>ACCEPT</onMatch> |
||||
<!-- 不匹配时的操作:拒绝(不记录)--> |
||||
<onMismatch>DENY</onMismatch> |
||||
</filter> |
||||
</appender> |
||||
|
||||
<!-- 系统日志输出 --> |
||||
<appender name="info_file" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<file>${log.path}/info.log</file> |
||||
<!-- 循环政策:基于时间创建日志文件 --> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<!-- 日志文件名格式 --> |
||||
<fileNamePattern>${log.path}/info/info-%d{yyyy-MM-dd}.log</fileNamePattern> |
||||
<!-- 日志最大的历史/天 --> |
||||
<maxHistory>${log.days}</maxHistory> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern>${log.pattern}</pattern> |
||||
</encoder> |
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
<!-- 过滤的级别 --> |
||||
<level>INFO</level> |
||||
<!-- 匹配时的操作:接收(记录) --> |
||||
<onMatch>ACCEPT</onMatch> |
||||
<!-- 不匹配时的操作:拒绝(不记录) --> |
||||
<onMismatch>DENY</onMismatch> |
||||
</filter> |
||||
</appender> |
||||
|
||||
<appender name="error_file" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<file>${log.path}/error.log</file> |
||||
<!-- 循环政策:基于时间创建日志文件 --> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<!-- 日志文件名格式 --> |
||||
<fileNamePattern>${log.path}/error/error-%d{yyyy-MM-dd}.log</fileNamePattern> |
||||
<!-- 日志最大的历史/天--> |
||||
<maxHistory>${log.days}</maxHistory> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern>${log.pattern}</pattern> |
||||
</encoder> |
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
<!-- 过滤的级别 --> |
||||
<level>ERROR</level> |
||||
<!-- 匹配时的操作:接收(记录) --> |
||||
<onMatch>ACCEPT</onMatch> |
||||
<!-- 不匹配时的操作:拒绝(不记录) --> |
||||
<onMismatch>DENY</onMismatch> |
||||
</filter> |
||||
</appender> |
||||
|
||||
<!-- 异步输出 --> |
||||
<appender name="async_info" class="ch.qos.logback.classic.AsyncAppender"> |
||||
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 --> |
||||
<discardingThreshold>0</discardingThreshold> |
||||
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 --> |
||||
<queueSize>256</queueSize> |
||||
<!-- 添加附加的appender,最多只能添加一个 --> |
||||
<appender-ref ref="info_file"/> |
||||
</appender> |
||||
|
||||
<appender name="async_error" class="ch.qos.logback.classic.AsyncAppender"> |
||||
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 --> |
||||
<discardingThreshold>0</discardingThreshold> |
||||
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 --> |
||||
<queueSize>256</queueSize> |
||||
<!-- 添加附加的appender,最多只能添加一个 --> |
||||
<appender-ref ref="error_file"/> |
||||
</appender> |
||||
|
||||
|
||||
<!-- 系统模块日志级别控制 --> |
||||
<logger name="com.loop" level="info"/> |
||||
|
||||
<!--关闭指定包的日志输出--> |
||||
<logger name="org.apache.struts2" level="OFF"/> |
||||
<logger name="com.opensymphony.xwork2" level="OFF"/> |
||||
<logger name="com.mchange.v2.c3p0" level="OFF"/> |
||||
<logger name="org.apache.commons.beanutils" level="OFF"/> |
||||
<logger name="org.apache.http" level="OFF"/> |
||||
<logger name="org.ehcache" level="OFF"/> |
||||
|
||||
<!--屏蔽org.springframework.*输出的WARN以下的信息--> |
||||
<logger name="org.springframework" level="OFF"/> |
||||
<!--屏蔽swaggerWARN以下的信息--> |
||||
<logger name="springfox.documentation" level="OFF"/> |
||||
<logger name="com.baomidou.mybatisplus" level="OFF"/> |
||||
<logger name="org.mybatis.logging.Logger" level="OFF"/> |
||||
<logger name="org.apache.ibatis" level="OFF"/> |
||||
|
||||
<!--系统操作日志--> |
||||
<root level="info"> |
||||
<appender-ref ref="console"/> |
||||
<appender-ref ref="debug_file"/> |
||||
<appender-ref ref="warn_file"/> |
||||
<appender-ref ref="info_file"/> |
||||
<appender-ref ref="error_file"/> |
||||
</root> |
||||
</configuration> |
||||
@ -0,0 +1,13 @@ |
||||
package com.ynxbd.push; |
||||
|
||||
import org.junit.jupiter.api.Test; |
||||
import org.springframework.boot.test.context.SpringBootTest; |
||||
|
||||
@SpringBootTest |
||||
class AppApplicationTests { |
||||
|
||||
@Test |
||||
void contextLoads() { |
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue