Просмотр исходного кода

处理新增费用修改了日期后 明明是在有效期内 显示失效的问题

lixiaolong 1 месяц назад
Родитель
Сommit
e6d3d940d7

+ 0 - 21
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostServiceImpl.java

@@ -366,20 +366,6 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
                 String.valueOf(costManagementVoPage.getRecords().get(0).getCostId()) : "";
     }
 
-
-    public static boolean isValid(String effectiveTime, String failureTime) {
-        if (StrUtil.isBlank(effectiveTime) || StrUtil.isBlank(failureTime)){
-            return false;
-        }
-        LocalDateTime now = LocalDateTime.now();
-        LocalDateTime start = LocalDateTime.parse(effectiveTime,
-                DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-        LocalDateTime end = LocalDateTime.parse(failureTime,
-                DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-
-        return !now.isBefore(start) && !now.isAfter(end);
-    }
-
     /**
      * 查询协议费用
      *
@@ -397,13 +383,6 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
             if(item.getRuleDescription() != null && !item.getRuleDescription().isEmpty()){
                 item.setRuleDescription(item.getRuleDescription().substring(0,item.getRuleDescription().length()-1));
             }
-            // 刷新有效状态
-            boolean valid = isValid(item.getEffectiveTime(), item.getFailureTime());
-            if(valid){
-                item.setIsValid("0");
-            }else{
-                item.setIsValid("1");
-            }
         });
         return HttpResult.ok(costManagementVoPage);
     }

+ 5 - 5
tenant/organization/src/main/resources/mapper/PtlAgreementCostMapper.xml

@@ -386,9 +386,9 @@
             pc.update_time,
             CASE
                 WHEN NOW() >= pc.effective_time
-                AND (pc.failure_time IS NULL OR NOW() &lt; pc.failure_time)
-                THEN 1
-                ELSE 0
+                AND (pc.failure_time IS NULL OR NOW() <= pc.failure_time)
+                THEN 0
+                ELSE 1
             END AS is_valid
         FROM
             ptl_agreement_cost pc
@@ -437,12 +437,12 @@
                     <!-- 有效 -->
                     <when test="costParam.validState == 0">
                         AND NOW() >= pc.effective_time
-                        AND (pc.failure_time IS NULL OR NOW() &lt; pc.failure_time)
+                        AND (pc.failure_time IS NULL OR NOW() <= pc.failure_time)
                     </when>
 
                     <!-- 无效 -->
                     <when test="costParam.validState == 1">
-                        AND ( (pc.failure_time IS NOT NULL AND NOW() >= pc.failure_time)
+                        AND ( (pc.failure_time IS NOT NULL AND NOW() > pc.failure_time)
                         )
                     </when>
                 </choose>