Skip to content

Commit 521ea08

Browse files
committed
🎨 优化部分代码,移除校验
1 parent 1557894 commit 521ea08

File tree

4 files changed

+22
-30
lines changed

4 files changed

+22
-30
lines changed

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpSchoolService.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package me.chanjar.weixin.cp.api;
22

3-
import lombok.NonNull;
43
import me.chanjar.weixin.common.error.WxErrorException;
54
import me.chanjar.weixin.cp.bean.living.WxCpLivingResult;
65
import me.chanjar.weixin.cp.bean.school.*;
76

8-
import javax.validation.constraints.NotNull;
97
import java.util.List;
108

119
/**
@@ -30,7 +28,7 @@ public interface WxCpSchoolService {
3028
* @return teacher customize health info
3129
* @throws WxErrorException the wx error exception
3230
*/
33-
WxCpCustomizeHealthInfo getTeacherCustomizeHealthInfo(@NotNull String date, String nextKey, Integer limit) throws WxErrorException;
31+
WxCpCustomizeHealthInfo getTeacherCustomizeHealthInfo(String date, String nextKey, Integer limit) throws WxErrorException;
3432

3533
/**
3634
* 获取学生健康信息
@@ -43,7 +41,7 @@ public interface WxCpSchoolService {
4341
* @return student customize health info
4442
* @throws WxErrorException the wx error exception
4543
*/
46-
WxCpCustomizeHealthInfo getStudentCustomizeHealthInfo(@NotNull String date, String nextKey, Integer limit) throws WxErrorException;
44+
WxCpCustomizeHealthInfo getStudentCustomizeHealthInfo(String date, String nextKey, Integer limit) throws WxErrorException;
4745

4846
/**
4947
* 获取师生健康码
@@ -55,7 +53,7 @@ public interface WxCpSchoolService {
5553
* @return health qr code
5654
* @throws WxErrorException the wx error exception
5755
*/
58-
WxCpResultList getHealthQrCode(@NotNull List<String> userIds, @NotNull Integer type) throws WxErrorException;
56+
WxCpResultList getHealthQrCode(List<String> userIds, Integer type) throws WxErrorException;
5957

6058
/**
6159
* 获取学生付款结果
@@ -66,7 +64,7 @@ public interface WxCpSchoolService {
6664
* @return payment result
6765
* @throws WxErrorException the wx error exception
6866
*/
69-
WxCpPaymentResult getPaymentResult(@NotNull String paymentId) throws WxErrorException;
67+
WxCpPaymentResult getPaymentResult(String paymentId) throws WxErrorException;
7068

7169
/**
7270
* 获取订单详情
@@ -78,7 +76,7 @@ public interface WxCpSchoolService {
7876
* @return trade
7977
* @throws WxErrorException the wx error exception
8078
*/
81-
WxCpTrade getTrade(@NotNull String paymentId, @NotNull String tradeNo) throws WxErrorException;
79+
WxCpTrade getTrade(String paymentId, String tradeNo) throws WxErrorException;
8280

8381
/**
8482
* 获取直播详情
@@ -90,7 +88,7 @@ public interface WxCpSchoolService {
9088
* @return living info
9189
* @throws WxErrorException the wx error exception
9290
*/
93-
WxCpSchoolLivingInfo getLivingInfo(@NotNull String livingId) throws WxErrorException;
91+
WxCpSchoolLivingInfo getLivingInfo(String livingId) throws WxErrorException;
9492

9593
/**
9694
* 获取老师直播ID列表
@@ -105,7 +103,7 @@ public interface WxCpSchoolService {
105103
* @return user all living id
106104
* @throws WxErrorException the wx error exception
107105
*/
108-
WxCpLivingResult.LivingIdResult getUserAllLivingId(@NonNull String userId, String cursor, Integer limit) throws WxErrorException;
106+
WxCpLivingResult.LivingIdResult getUserAllLivingId(String userId, String cursor, Integer limit) throws WxErrorException;
109107

110108
/**
111109
* 获取观看直播统计
@@ -119,7 +117,7 @@ public interface WxCpSchoolService {
119117
* @return watch stat
120118
* @throws WxErrorException the wx error exception
121119
*/
122-
WxCpSchoolWatchStat getWatchStat(@NonNull String livingId, String nextKey) throws WxErrorException;
120+
WxCpSchoolWatchStat getWatchStat(String livingId, String nextKey) throws WxErrorException;
123121

124122
/**
125123
* 获取未观看直播统计
@@ -133,7 +131,7 @@ public interface WxCpSchoolService {
133131
* @return unwatch stat
134132
* @throws WxErrorException the wx error exception
135133
*/
136-
WxCpSchoolUnwatchStat getUnwatchStat(@NonNull String livingId, String nextKey) throws WxErrorException;
134+
WxCpSchoolUnwatchStat getUnwatchStat(String livingId, String nextKey) throws WxErrorException;
137135

138136
/**
139137
* 删除直播回放
@@ -144,6 +142,6 @@ public interface WxCpSchoolService {
144142
* @return wx cp living result
145143
* @throws WxErrorException the wx error exception
146144
*/
147-
WxCpLivingResult deleteReplayData(@NonNull String livingId) throws WxErrorException;
145+
WxCpLivingResult deleteReplayData(String livingId) throws WxErrorException;
148146

149147
}

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpSchoolServiceImpl.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package me.chanjar.weixin.cp.api.impl;
22

33
import com.google.gson.JsonObject;
4-
import lombok.NonNull;
54
import lombok.RequiredArgsConstructor;
65
import lombok.extern.slf4j.Slf4j;
76
import me.chanjar.weixin.common.error.WxErrorException;
@@ -11,7 +10,6 @@
1110
import me.chanjar.weixin.cp.bean.school.*;
1211
import org.apache.commons.lang3.StringUtils;
1312

14-
import javax.validation.constraints.NotNull;
1513
import java.util.List;
1614
import java.util.Optional;
1715

@@ -30,7 +28,7 @@ public class WxCpSchoolServiceImpl implements WxCpSchoolService {
3028
private final WxCpService cpService;
3129

3230
@Override
33-
public WxCpCustomizeHealthInfo getTeacherCustomizeHealthInfo(@NotNull String date, String nextKey, Integer limit) throws WxErrorException {
31+
public WxCpCustomizeHealthInfo getTeacherCustomizeHealthInfo(String date, String nextKey, Integer limit) throws WxErrorException {
3432
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_TEACHER_CUSTOMIZE_HEALTH_INFO);
3533
JsonObject jsonObject = new JsonObject();
3634
jsonObject.addProperty("date", date);
@@ -43,7 +41,7 @@ public WxCpCustomizeHealthInfo getTeacherCustomizeHealthInfo(@NotNull String dat
4341
}
4442

4543
@Override
46-
public WxCpCustomizeHealthInfo getStudentCustomizeHealthInfo(@NotNull String date, String nextKey, Integer limit) throws WxErrorException {
44+
public WxCpCustomizeHealthInfo getStudentCustomizeHealthInfo(String date, String nextKey, Integer limit) throws WxErrorException {
4745
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_STUDENT_CUSTOMIZE_HEALTH_INFO);
4846
JsonObject jsonObject = new JsonObject();
4947
jsonObject.addProperty("date", date);
@@ -56,7 +54,7 @@ public WxCpCustomizeHealthInfo getStudentCustomizeHealthInfo(@NotNull String dat
5654
}
5755

5856
@Override
59-
public WxCpResultList getHealthQrCode(@NotNull List<String> userIds, @NotNull Integer type) throws WxErrorException {
57+
public WxCpResultList getHealthQrCode(List<String> userIds, Integer type) throws WxErrorException {
6058
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_HEALTH_QRCODE);
6159
JsonObject jsonObject = new JsonObject();
6260
jsonObject.addProperty("type", type);
@@ -66,7 +64,7 @@ public WxCpResultList getHealthQrCode(@NotNull List<String> userIds, @NotNull In
6664
}
6765

6866
@Override
69-
public WxCpPaymentResult getPaymentResult(@NotNull String paymentId) throws WxErrorException {
67+
public WxCpPaymentResult getPaymentResult(String paymentId) throws WxErrorException {
7068
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_PAYMENT_RESULT);
7169
JsonObject jsonObject = new JsonObject();
7270
jsonObject.addProperty("payment_id", paymentId);
@@ -75,7 +73,7 @@ public WxCpPaymentResult getPaymentResult(@NotNull String paymentId) throws WxEr
7573
}
7674

7775
@Override
78-
public WxCpTrade getTrade(@NotNull String paymentId, @NotNull String tradeNo) throws WxErrorException {
76+
public WxCpTrade getTrade(String paymentId, String tradeNo) throws WxErrorException {
7977
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_TRADE);
8078
JsonObject jsonObject = new JsonObject();
8179
jsonObject.addProperty("payment_id", paymentId);
@@ -85,19 +83,19 @@ public WxCpTrade getTrade(@NotNull String paymentId, @NotNull String tradeNo) th
8583
}
8684

8785
@Override
88-
public WxCpSchoolLivingInfo getLivingInfo(@NotNull String livingId) throws WxErrorException {
86+
public WxCpSchoolLivingInfo getLivingInfo(String livingId) throws WxErrorException {
8987
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_LIVING_INFO) + livingId;
9088
String responseContent = this.cpService.get(apiUrl, null);
9189
return WxCpSchoolLivingInfo.fromJson(responseContent);
9290
}
9391

9492
@Override
95-
public WxCpLivingResult.LivingIdResult getUserAllLivingId(@NonNull String userId, String cursor, Integer limit) throws WxErrorException {
93+
public WxCpLivingResult.LivingIdResult getUserAllLivingId(String userId, String cursor, Integer limit) throws WxErrorException {
9694
return this.cpService.getLivingService().getUserAllLivingId(userId, cursor, limit);
9795
}
9896

9997
@Override
100-
public WxCpSchoolWatchStat getWatchStat(@NonNull String livingId, String nextKey) throws WxErrorException {
98+
public WxCpSchoolWatchStat getWatchStat(String livingId, String nextKey) throws WxErrorException {
10199
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_WATCH_STAT);
102100
JsonObject jsonObject = new JsonObject();
103101
if (StringUtils.isNotBlank(nextKey)) {
@@ -109,7 +107,7 @@ public WxCpSchoolWatchStat getWatchStat(@NonNull String livingId, String nextKey
109107
}
110108

111109
@Override
112-
public WxCpSchoolUnwatchStat getUnwatchStat(@NonNull String livingId, String nextKey) throws WxErrorException {
110+
public WxCpSchoolUnwatchStat getUnwatchStat(String livingId, String nextKey) throws WxErrorException {
113111
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_UNWATCH_STAT);
114112
JsonObject jsonObject = new JsonObject();
115113
if (StringUtils.isNotBlank(nextKey)) {
@@ -121,7 +119,7 @@ public WxCpSchoolUnwatchStat getUnwatchStat(@NonNull String livingId, String nex
121119
}
122120

123121
@Override
124-
public WxCpLivingResult deleteReplayData(@NonNull String livingId) throws WxErrorException {
122+
public WxCpLivingResult deleteReplayData(String livingId) throws WxErrorException {
125123
return cpService.getLivingService().deleteReplayData(livingId);
126124
}
127125

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/WxCpTpService.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
import me.chanjar.weixin.cp.bean.*;
1111
import me.chanjar.weixin.cp.config.WxCpTpConfigStorage;
1212

13-
import javax.validation.constraints.NotBlank;
14-
import javax.validation.constraints.NotEmpty;
1513
import java.util.List;
1614

1715
/**
@@ -403,7 +401,7 @@ public interface WxCpTpService {
403401
* @return customized auth url
404402
* @throws WxErrorException the wx error exception
405403
*/
406-
WxTpCustomizedAuthUrl getCustomizedAuthUrl(@NotBlank String state, @NotEmpty List<String> templateIdList) throws WxErrorException;
404+
WxTpCustomizedAuthUrl getCustomizedAuthUrl(String state, List<String> templateIdList) throws WxErrorException;
407405

408406
/**
409407
* 获取服务商providerToken

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/BaseWxCpTpServiceImpl.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
import me.chanjar.weixin.cp.tp.service.*;
2929
import org.apache.commons.lang3.StringUtils;
3030

31-
import javax.validation.constraints.NotBlank;
32-
import javax.validation.constraints.NotEmpty;
3331
import java.io.File;
3432
import java.io.IOException;
3533
import java.net.URLEncoder;
@@ -540,7 +538,7 @@ public WxTpLoginInfo getLoginInfo(String authCode) throws WxErrorException {
540538
}
541539

542540
@Override
543-
public WxTpCustomizedAuthUrl getCustomizedAuthUrl(@NotBlank String state, @NotEmpty List<String> templateIdList) throws WxErrorException {
541+
public WxTpCustomizedAuthUrl getCustomizedAuthUrl(String state, List<String> templateIdList) throws WxErrorException {
544542
JsonObject jsonObject = new JsonObject();
545543
jsonObject.addProperty("state", state);
546544
jsonObject.add("templateid_list", WxGsonBuilder.create().toJsonTree(templateIdList).getAsJsonArray());

0 commit comments

Comments
 (0)