浏览代码

添加续费时间判断

wangyu 6 年之前
父节点
当前提交
4e19db54da
共有 1 个文件被更改,包括 8 次插入5 次删除
  1. 8 5
      diagbotman-service/src/main/java/com/diagbot/facade/OpenedProductsFacade.java

+ 8 - 5
diagbotman-service/src/main/java/com/diagbot/facade/OpenedProductsFacade.java

@@ -227,12 +227,15 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
         map.put("userId",modifyOpeningTimeVO.getUserId());
         map.put("productId",modifyOpeningTimeVO.getProductId());
         List<OpenedProducts> opendList = openedProductsFacade.selectOpenedProducts(map);
+        List<Long> renewalsList = userRenewalsFacade.selectProductIdByUserId(map);
+        if(!renewalsList.contains(modifyOpeningTimeVO.getProductId())){
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, "续费单单不存在,请刷新重试");
+        }
         for (OpenedProducts openedProducts1 :opendList) {
-            if(beforeTime(openedProducts1.getStartTime(),modifyOpeningTimeVO.getEndTime())){
+            if(beforeTime(openedProducts1.getEndTime(),modifyOpeningTimeVO.getEndTime())){
                 throw new CommonException(CommonErrorCode.NOT_EXISTS, "输入有误,续费时间需大于到期时间");
             }
         }
-
         openedProducts.setEndTime(DateUtil.parseDate(modifyOpeningTimeVO.getEndTime()));
         openedProducts.setCreator(UserUtils.getCurrentPrincipleID());
         openedProducts.setGmtCreate(DateUtil.now());
@@ -281,11 +284,11 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
         //比较两个日期
         int result = fomatDate2.compareTo(startTime);
         //如果日期相等返回0
-        if (result == 0 || result > 0) {
-            //大于0,参数startTime小于endTime
+        if (result == 0 || result < 0) {
+            //小于0,参数startTime大于endTime
             return true;
         }
-            //小于0,参数startTime大于endTime
+            //大于0,参数startTime小于endTime
         return false;
     }
 }