-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
企业微信和第三方平台功能增强 #2307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
企业微信和第三方平台功能增强 #2307
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
def6be5
1. 添加企业微信 Spring boot starter,添加基础依赖 spring boot starter
cqyisbug e9eb304
还原仓库地址配置
cqyisbug aca99fe
去除basic spring boot starter中的web日志
cqyisbug faf6fab
还原 maven 插件 maven-source-plugin 相关配置
cqyisbug 91aecd3
还原WxErrorException 异常类型
cqyisbug fa35d86
将部分不合理抛出异常改为非检查异常
cqyisbug 4f9fa88
修复WxCpMessage builder部分参数未使用的问题
cqyisbug d0574e1
fix issus #2310
cqyisbug fd5f883
fix issue #2308
cqyisbug File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
spring-boot-starters/wx-java-base-spring-boot-starter/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| <?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <parent> | ||
| <artifactId>wx-java-spring-boot-starters</artifactId> | ||
| <groupId>com.github.binarywang</groupId> | ||
| <version>4.1.8.B</version> | ||
| </parent> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <name>WxJava - Spring Boot Starter for basic</name> | ||
| <artifactId>wx-java-base-spring-boot-starter</artifactId> | ||
|
|
||
| <properties> | ||
| <maven.compiler.source>8</maven.compiler.source> | ||
| <maven.compiler.target>8</maven.compiler.target> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-web</artifactId> | ||
| <exclusions> | ||
| <exclusion> | ||
| <artifactId>spring-boot-starter-tomcat</artifactId> | ||
| <groupId>org.springframework.boot</groupId> | ||
| </exclusion> | ||
| </exclusions> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.github.binarywang</groupId> | ||
| <artifactId>weixin-java-common</artifactId> | ||
| <version>${project.version}</version> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-undertow</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-aop</artifactId> | ||
| </dependency> | ||
|
|
||
| </dependencies> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-source-plugin</artifactId> | ||
| <version>2.2.1</version> | ||
| <executions> | ||
| <execution> | ||
| <id>attach-sources</id> | ||
| <goals> | ||
| <goal>jar-no-fork</goal> | ||
| </goals> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
|
|
||
| </project> |
21 changes: 21 additions & 0 deletions
21
...starter/src/main/java/com/binarywang/spring/starter/wxjava/base/annotation/WxHandler.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package com.binarywang.spring.starter.wxjava.base.annotation; | ||
|
|
||
| import org.springframework.core.annotation.AliasFor; | ||
| import org.springframework.stereotype.Component; | ||
| import org.springframework.stereotype.Indexed; | ||
|
|
||
| import java.lang.annotation.*; | ||
|
|
||
| /** | ||
| * @author caiqy | ||
| */ | ||
| @Target({ElementType.TYPE}) | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Documented | ||
| @Indexed | ||
| @Component | ||
| public @interface WxHandler { | ||
|
|
||
| @AliasFor(annotation = Component.class) | ||
| String value() default ""; | ||
| } |
34 changes: 34 additions & 0 deletions
34
...-starter/src/main/java/com/binarywang/spring/starter/wxjava/base/bean/WxCommonResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package com.binarywang.spring.starter.wxjava.base.bean; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Data; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.io.Serializable; | ||
|
|
||
| /** | ||
| * @author caiqy | ||
| * @date 2021/9/2 | ||
| */ | ||
| @Data | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor | ||
| public class WxCommonResult implements Serializable { | ||
| private static final long serialVersionUID = -1L; | ||
|
|
||
| /** | ||
| * 微信错误码 | ||
| */ | ||
| private int code; | ||
|
|
||
| /** | ||
| * 微信错误信息 | ||
| */ | ||
| private String message; | ||
|
|
||
| /** | ||
| * 是否成功 | ||
| */ | ||
| private boolean success; | ||
|
|
||
| } |
38 changes: 38 additions & 0 deletions
38
.../main/java/com/binarywang/spring/starter/wxjava/base/exception/WxExceptionTranslator.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package com.binarywang.spring.starter.wxjava.base.exception; | ||
|
|
||
| import com.binarywang.spring.starter.wxjava.base.bean.WxCommonResult; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import me.chanjar.weixin.common.error.WxErrorException; | ||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | ||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.core.Ordered; | ||
| import org.springframework.core.annotation.Order; | ||
| import org.springframework.http.HttpStatus; | ||
| import org.springframework.web.bind.annotation.ExceptionHandler; | ||
| import org.springframework.web.bind.annotation.ResponseStatus; | ||
| import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
| import org.springframework.web.servlet.DispatcherServlet; | ||
|
|
||
| import javax.servlet.Servlet; | ||
|
|
||
| /** | ||
| * @author caiqy | ||
| * @date 2021/9/2 | ||
| */ | ||
| @Slf4j | ||
| @Order(Ordered.HIGHEST_PRECEDENCE) | ||
| @Configuration | ||
| @RestControllerAdvice | ||
| @AllArgsConstructor | ||
| @ConditionalOnClass({Servlet.class, DispatcherServlet.class}) | ||
| @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) | ||
| public class WxExceptionTranslator { | ||
|
|
||
| @ExceptionHandler(WxErrorException.class) | ||
| @ResponseStatus(HttpStatus.OK) | ||
| public WxCommonResult handleCustomWxError(WxErrorException e) { | ||
| return new WxCommonResult(e.getError().getErrorCode(), e.getError().getErrorMsg(), false); | ||
| } | ||
| } |
40 changes: 40 additions & 0 deletions
40
...starter/src/main/java/com/binarywang/spring/starter/wxjava/base/util/CheckedConsumer.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| * Copyright (c) 2019-2029, Dreamlu 卢春梦 (596392912@qq.com & www.dreamlu.net). | ||
| * <p> | ||
| * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * <p> | ||
| * http://www.gnu.org/licenses/lgpl.html | ||
| * <p> | ||
| * 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. | ||
| */ | ||
|
|
||
| package com.binarywang.spring.starter.wxjava.base.util; | ||
|
|
||
| import org.springframework.lang.Nullable; | ||
|
|
||
| import java.io.Serializable; | ||
|
|
||
| /** | ||
| * 受检的 Consumer | ||
| * | ||
| * @author L.cm | ||
| */ | ||
| @FunctionalInterface | ||
| public interface CheckedConsumer<T> extends Serializable { | ||
|
|
||
| /** | ||
| * Run the Consumer | ||
| * | ||
| * @param t T | ||
| * @throws Throwable UncheckedException | ||
| */ | ||
| @Nullable | ||
| void accept(@Nullable T t) throws Throwable; | ||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.