Commit d5fe99c817fa39e2eb2d562990ba64d16928b749

Authored by 王彪总
1 parent 50b6254e

feat(garden): 优化养护计划时间段计算逻辑并调整接口权限控制

- 在 InspectionPlanSaveReqVO 和 MaintainPlanSaveReqVO 中新增 rateValue 字段长度限制(最大6位)
- 替换原有时间段计算方法 calculate 为 calculateNew,提升周期拆分准确性
- 重写 TimeIntervalFrequencyUtil 工具类中的 calculateNew 方法,支持更灵活的时间段划分
- 新增 convertToDaysNew 方法用于将不同周期单位转换为固定天数
- 注释掉 RoadStreetController 中所有接口的权限校验注解,临时放开访问控制
- 更新测试用例,使用新的 calculateNew 方法进行验证
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/util/timeinterval/TimeIntervalFrequencyUtil.java
... ... @@ -87,7 +87,7 @@ public class TimeIntervalFrequencyUtil {
87 87 long daysInSegment = ChronoUnit.DAYS.between(segmentStart, segmentEnd) + 1;
88 88  
89 89 // 计算当前时间段的执行次数:(实际天数/周期天数) * 每周期次数,向上取整
90   - double proportion = (double) daysInSegment / daysPerPeriod;
  90 + double proportion = (double) daysInSegment / totalPeriodDays;
91 91 int executionCount = (int) Math.ceil(proportion * timesPerPeriod);
92 92  
93 93 // 添加当前时间段结果
... ... @@ -230,7 +230,7 @@ public class TimeIntervalFrequencyUtil {
230 230 // ====================== 测试用例 ======================
231 231 public static void main(String[] args) {
232 232  
233   - List<PeriodResult> r2 = calculateNew("2026-01-01", "2026-02-15", "7/1", 2);
  233 + List<PeriodResult> r2 = calculateNew("2026-01-01", "2026-01-26", "9/2", 2);
234 234 r2.forEach(System.out::println);
235 235  
236 236 // //1:日/次;2:周/次;3:月/次;4:年/次
... ...