Sfoglia il codice sorgente

:art: 优化部分代码,移除校验

Binary Wang 2 anni fa
parent
commit
521ea08ba9

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

@@ -1,11 +1,9 @@
 package me.chanjar.weixin.cp.api;
 
-import lombok.NonNull;
 import me.chanjar.weixin.common.error.WxErrorException;
 import me.chanjar.weixin.cp.bean.living.WxCpLivingResult;
 import me.chanjar.weixin.cp.bean.school.*;
 
-import javax.validation.constraints.NotNull;
 import java.util.List;
 
 /**
@@ -30,7 +28,7 @@ public interface WxCpSchoolService {
    * @return teacher customize health info
    * @throws WxErrorException the wx error exception
    */
-  WxCpCustomizeHealthInfo getTeacherCustomizeHealthInfo(@NotNull String date, String nextKey, Integer limit) throws WxErrorException;
+  WxCpCustomizeHealthInfo getTeacherCustomizeHealthInfo(String date, String nextKey, Integer limit) throws WxErrorException;
 
   /**
    * 获取学生健康信息
@@ -43,7 +41,7 @@ public interface WxCpSchoolService {
    * @return student customize health info
    * @throws WxErrorException the wx error exception
    */
-  WxCpCustomizeHealthInfo getStudentCustomizeHealthInfo(@NotNull String date, String nextKey, Integer limit) throws WxErrorException;
+  WxCpCustomizeHealthInfo getStudentCustomizeHealthInfo(String date, String nextKey, Integer limit) throws WxErrorException;
 
   /**
    * 获取师生健康码
@@ -55,7 +53,7 @@ public interface WxCpSchoolService {
    * @return health qr code
    * @throws WxErrorException the wx error exception
    */
-  WxCpResultList getHealthQrCode(@NotNull List<String> userIds, @NotNull Integer type) throws WxErrorException;
+  WxCpResultList getHealthQrCode(List<String> userIds, Integer type) throws WxErrorException;
 
   /**
    * 获取学生付款结果
@@ -66,7 +64,7 @@ public interface WxCpSchoolService {
    * @return payment result
    * @throws WxErrorException the wx error exception
    */
-  WxCpPaymentResult getPaymentResult(@NotNull String paymentId) throws WxErrorException;
+  WxCpPaymentResult getPaymentResult(String paymentId) throws WxErrorException;
 
   /**
    * 获取订单详情
@@ -78,7 +76,7 @@ public interface WxCpSchoolService {
    * @return trade
    * @throws WxErrorException the wx error exception
    */
-  WxCpTrade getTrade(@NotNull String paymentId, @NotNull String tradeNo) throws WxErrorException;
+  WxCpTrade getTrade(String paymentId, String tradeNo) throws WxErrorException;
 
   /**
    * 获取直播详情
@@ -90,7 +88,7 @@ public interface WxCpSchoolService {
    * @return living info
    * @throws WxErrorException the wx error exception
    */
-  WxCpSchoolLivingInfo getLivingInfo(@NotNull String livingId) throws WxErrorException;
+  WxCpSchoolLivingInfo getLivingInfo(String livingId) throws WxErrorException;
 
   /**
    * 获取老师直播ID列表
@@ -105,7 +103,7 @@ public interface WxCpSchoolService {
    * @return user all living id
    * @throws WxErrorException the wx error exception
    */
-  WxCpLivingResult.LivingIdResult getUserAllLivingId(@NonNull String userId, String cursor, Integer limit) throws WxErrorException;
+  WxCpLivingResult.LivingIdResult getUserAllLivingId(String userId, String cursor, Integer limit) throws WxErrorException;
 
   /**
    * 获取观看直播统计
@@ -119,7 +117,7 @@ public interface WxCpSchoolService {
    * @return watch stat
    * @throws WxErrorException the wx error exception
    */
-  WxCpSchoolWatchStat getWatchStat(@NonNull String livingId, String nextKey) throws WxErrorException;
+  WxCpSchoolWatchStat getWatchStat(String livingId, String nextKey) throws WxErrorException;
 
   /**
    * 获取未观看直播统计
@@ -133,7 +131,7 @@ public interface WxCpSchoolService {
    * @return unwatch stat
    * @throws WxErrorException the wx error exception
    */
-  WxCpSchoolUnwatchStat getUnwatchStat(@NonNull String livingId, String nextKey) throws WxErrorException;
+  WxCpSchoolUnwatchStat getUnwatchStat(String livingId, String nextKey) throws WxErrorException;
 
   /**
    * 删除直播回放
@@ -144,6 +142,6 @@ public interface WxCpSchoolService {
    * @return wx cp living result
    * @throws WxErrorException the wx error exception
    */
-  WxCpLivingResult deleteReplayData(@NonNull String livingId) throws WxErrorException;
+  WxCpLivingResult deleteReplayData(String livingId) throws WxErrorException;
 
 }

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

@@ -1,7 +1,6 @@
 package me.chanjar.weixin.cp.api.impl;
 
 import com.google.gson.JsonObject;
-import lombok.NonNull;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import me.chanjar.weixin.common.error.WxErrorException;
@@ -11,7 +10,6 @@ import me.chanjar.weixin.cp.bean.living.WxCpLivingResult;
 import me.chanjar.weixin.cp.bean.school.*;
 import org.apache.commons.lang3.StringUtils;
 
-import javax.validation.constraints.NotNull;
 import java.util.List;
 import java.util.Optional;
 
@@ -30,7 +28,7 @@ public class WxCpSchoolServiceImpl implements WxCpSchoolService {
   private final WxCpService cpService;
 
   @Override
-  public WxCpCustomizeHealthInfo getTeacherCustomizeHealthInfo(@NotNull String date, String nextKey, Integer limit) throws WxErrorException {
+  public WxCpCustomizeHealthInfo getTeacherCustomizeHealthInfo(String date, String nextKey, Integer limit) throws WxErrorException {
     String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_TEACHER_CUSTOMIZE_HEALTH_INFO);
     JsonObject jsonObject = new JsonObject();
     jsonObject.addProperty("date", date);
@@ -43,7 +41,7 @@ public class WxCpSchoolServiceImpl implements WxCpSchoolService {
   }
 
   @Override
-  public WxCpCustomizeHealthInfo getStudentCustomizeHealthInfo(@NotNull String date, String nextKey, Integer limit) throws WxErrorException {
+  public WxCpCustomizeHealthInfo getStudentCustomizeHealthInfo(String date, String nextKey, Integer limit) throws WxErrorException {
     String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_STUDENT_CUSTOMIZE_HEALTH_INFO);
     JsonObject jsonObject = new JsonObject();
     jsonObject.addProperty("date", date);
@@ -56,7 +54,7 @@ public class WxCpSchoolServiceImpl implements WxCpSchoolService {
   }
 
   @Override
-  public WxCpResultList getHealthQrCode(@NotNull List<String> userIds, @NotNull Integer type) throws WxErrorException {
+  public WxCpResultList getHealthQrCode(List<String> userIds, Integer type) throws WxErrorException {
     String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_HEALTH_QRCODE);
     JsonObject jsonObject = new JsonObject();
     jsonObject.addProperty("type", type);
@@ -66,7 +64,7 @@ public class WxCpSchoolServiceImpl implements WxCpSchoolService {
   }
 
   @Override
-  public WxCpPaymentResult getPaymentResult(@NotNull String paymentId) throws WxErrorException {
+  public WxCpPaymentResult getPaymentResult(String paymentId) throws WxErrorException {
     String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_PAYMENT_RESULT);
     JsonObject jsonObject = new JsonObject();
     jsonObject.addProperty("payment_id", paymentId);
@@ -75,7 +73,7 @@ public class WxCpSchoolServiceImpl implements WxCpSchoolService {
   }
 
   @Override
-  public WxCpTrade getTrade(@NotNull String paymentId, @NotNull String tradeNo) throws WxErrorException {
+  public WxCpTrade getTrade(String paymentId, String tradeNo) throws WxErrorException {
     String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_TRADE);
     JsonObject jsonObject = new JsonObject();
     jsonObject.addProperty("payment_id", paymentId);
@@ -85,19 +83,19 @@ public class WxCpSchoolServiceImpl implements WxCpSchoolService {
   }
 
   @Override
-  public WxCpSchoolLivingInfo getLivingInfo(@NotNull String livingId) throws WxErrorException {
+  public WxCpSchoolLivingInfo getLivingInfo(String livingId) throws WxErrorException {
     String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_LIVING_INFO) + livingId;
     String responseContent = this.cpService.get(apiUrl, null);
     return WxCpSchoolLivingInfo.fromJson(responseContent);
   }
 
   @Override
-  public WxCpLivingResult.LivingIdResult getUserAllLivingId(@NonNull String userId, String cursor, Integer limit) throws WxErrorException {
+  public WxCpLivingResult.LivingIdResult getUserAllLivingId(String userId, String cursor, Integer limit) throws WxErrorException {
     return this.cpService.getLivingService().getUserAllLivingId(userId, cursor, limit);
   }
 
   @Override
-  public WxCpSchoolWatchStat getWatchStat(@NonNull String livingId, String nextKey) throws WxErrorException {
+  public WxCpSchoolWatchStat getWatchStat(String livingId, String nextKey) throws WxErrorException {
     String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_WATCH_STAT);
     JsonObject jsonObject = new JsonObject();
     if (StringUtils.isNotBlank(nextKey)) {
@@ -109,7 +107,7 @@ public class WxCpSchoolServiceImpl implements WxCpSchoolService {
   }
 
   @Override
-  public WxCpSchoolUnwatchStat getUnwatchStat(@NonNull String livingId, String nextKey) throws WxErrorException {
+  public WxCpSchoolUnwatchStat getUnwatchStat(String livingId, String nextKey) throws WxErrorException {
     String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_UNWATCH_STAT);
     JsonObject jsonObject = new JsonObject();
     if (StringUtils.isNotBlank(nextKey)) {
@@ -121,7 +119,7 @@ public class WxCpSchoolServiceImpl implements WxCpSchoolService {
   }
 
   @Override
-  public WxCpLivingResult deleteReplayData(@NonNull String livingId) throws WxErrorException {
+  public WxCpLivingResult deleteReplayData(String livingId) throws WxErrorException {
     return cpService.getLivingService().deleteReplayData(livingId);
   }
 

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

@@ -10,8 +10,6 @@ import me.chanjar.weixin.common.util.http.RequestHttp;
 import me.chanjar.weixin.cp.bean.*;
 import me.chanjar.weixin.cp.config.WxCpTpConfigStorage;
 
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotEmpty;
 import java.util.List;
 
 /**
@@ -403,7 +401,7 @@ public interface WxCpTpService {
    * @return customized auth url
    * @throws WxErrorException the wx error exception
    */
-  WxTpCustomizedAuthUrl getCustomizedAuthUrl(@NotBlank String state, @NotEmpty List<String> templateIdList) throws WxErrorException;
+  WxTpCustomizedAuthUrl getCustomizedAuthUrl(String state, List<String> templateIdList) throws WxErrorException;
 
   /**
    * 获取服务商providerToken

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

@@ -28,8 +28,6 @@ import me.chanjar.weixin.cp.config.WxCpTpConfigStorage;
 import me.chanjar.weixin.cp.tp.service.*;
 import org.apache.commons.lang3.StringUtils;
 
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotEmpty;
 import java.io.File;
 import java.io.IOException;
 import java.net.URLEncoder;
@@ -540,7 +538,7 @@ public abstract class BaseWxCpTpServiceImpl<H, P> implements WxCpTpService, Requ
   }
 
   @Override
-  public WxTpCustomizedAuthUrl getCustomizedAuthUrl(@NotBlank String state, @NotEmpty List<String> templateIdList) throws WxErrorException {
+  public WxTpCustomizedAuthUrl getCustomizedAuthUrl(String state, List<String> templateIdList) throws WxErrorException {
     JsonObject jsonObject = new JsonObject();
     jsonObject.addProperty("state", state);
     jsonObject.add("templateid_list", WxGsonBuilder.create().toJsonTree(templateIdList).getAsJsonArray());