Ver código fonte

时间过期

gaodm 6 anos atrás
pai
commit
fafc86dcdf

+ 1 - 2
diagbotman-service/src/main/java/com/diagbot/facade/ProductServiceFacade.java

@@ -54,7 +54,6 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
      */
     public ProductServiceDTO genProductService(ProductServiceSaveVO productServiceSaveVO) {
         ProductServiceDTO productServiceDTO = new ProductServiceDTO();
-        Calendar calendar = Calendar.getInstance();
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         LantoneProduct lantoneProduct = lantoneProductFacade.getById(productServiceSaveVO.getProductId());
         if (lantoneProduct == null) {
@@ -107,7 +106,7 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
         serviceToken.setStatus(StatusEnum.Enable.getKey());
         if (old_serviceToken != null && old_serviceToken.getType().equals(TokenTypeEnum.Trial.getKey())) {
             //如果试用已过期,不允许再生成
-            if (calendar.after(old_serviceToken.getExpiringDate())) {
+            if (DateUtil.after(DateUtil.now(), old_serviceToken.getExpiringDate())) {
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                         "当前试用账号已过期,不允许再生成令牌");
             }