Commit c590e968a477c7e55bf655c68e82176fbf57fafc
1 parent
13ef8729
道路回填公司+部门
Showing
11 changed files
with
174 additions
and
44 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/InspectionPlanController.java
| ... | ... | @@ -49,7 +49,7 @@ public class InspectionPlanController { |
| 49 | 49 | @PreAuthorize("@ss.hasPermission('garden:inspection-plan:create')") |
| 50 | 50 | public CommonResult<Integer> createInspectionPlan(@Valid @RequestBody InspectionPlanSaveReqVO createReqVO) { |
| 51 | 51 | if(!createReqVO.verify()){ |
| 52 | - log.warn("次数值范围:1-20或者分数格式:1/3, rateValue={}", createReqVO.getRateValue()); | |
| 52 | + log.warn("次数值范围:1-10或者分数格式:1/3, rateValue={}", createReqVO.getRateValue()); | |
| 53 | 53 | return error(PLAN_RATE_VALUE_ERROR); |
| 54 | 54 | } |
| 55 | 55 | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/PlanRateController.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.planrate; |
| 2 | 2 | |
| 3 | +import com.zteits.urbanops.module.garden.util.StringValidateUtil; | |
| 3 | 4 | import jakarta.validation.constraints.NotBlank; |
| 4 | 5 | import org.springframework.web.bind.annotation.*; |
| 5 | 6 | import jakarta.annotation.Resource; |
| ... | ... | @@ -27,6 +28,7 @@ import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; |
| 27 | 28 | import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; |
| 28 | 29 | import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; |
| 29 | 30 | import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.PLAN_RATE_LEVEL_ID_DUPLICATE; |
| 31 | +import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.PLAN_RATE_VALUE_ERROR; | |
| 30 | 32 | |
| 31 | 33 | import com.zteits.urbanops.module.garden.controller.admin.planrate.vo.*; |
| 32 | 34 | import com.zteits.urbanops.module.garden.dal.dataobject.planrate.PlanRateDO; |
| ... | ... | @@ -45,6 +47,14 @@ public class PlanRateController { |
| 45 | 47 | @Operation(summary = "创建计划频次") |
| 46 | 48 | @PreAuthorize("@ss.hasPermission('garden:plan-rate:create')") |
| 47 | 49 | public CommonResult<Long> createPlanRate(@Valid @RequestBody PlanRateSaveReqVO createReqVO) { |
| 50 | + //校验 | |
| 51 | + for (PlanRateDetailSaveReqVO detail : createReqVO.getDetails()) { | |
| 52 | + if(!StringValidateUtil.validate(detail.getRate())){ | |
| 53 | + String str = "频次值["+detail.getRate()+"]错误,只能是1-10数字或者分数如1/3"; | |
| 54 | + return error(PLAN_RATE_VALUE_ERROR.getCode(), str); | |
| 55 | + } | |
| 56 | + } | |
| 57 | + | |
| 48 | 58 | return success(planRateService.createPlanRate(createReqVO)); |
| 49 | 59 | } |
| 50 | 60 | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/vo/PlanRateSaveReqVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.planrate.vo; |
| 2 | 2 | |
| 3 | +import com.zteits.urbanops.framework.common.exception.ServerException; | |
| 4 | +import com.zteits.urbanops.module.garden.util.StringValidateUtil; | |
| 3 | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 6 | import jakarta.validation.Valid; |
| 5 | 7 | import lombok.*; |
| 6 | 8 | import java.util.*; |
| 7 | 9 | import jakarta.validation.constraints.*; |
| 8 | 10 | |
| 11 | +import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.PLAN_RATE_VALUE_ERROR; | |
| 12 | + | |
| 9 | 13 | @Schema(description = "管理后台 - 计划频次新增/修改 Request VO") |
| 10 | 14 | @Data |
| 11 | 15 | public class PlanRateSaveReqVO { |
| ... | ... | @@ -32,4 +36,9 @@ public class PlanRateSaveReqVO { |
| 32 | 36 | @Valid |
| 33 | 37 | private List<PlanRateDetailSaveReqVO> details; |
| 34 | 38 | |
| 39 | + public String verify(){ | |
| 40 | + | |
| 41 | + return null; | |
| 42 | + } | |
| 43 | + | |
| 35 | 44 | } |
| 36 | 45 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/RoadController.java
| ... | ... | @@ -83,8 +83,8 @@ public class RoadController { |
| 83 | 83 | @Operation(summary = "获得道路管理分页") |
| 84 | 84 | @PreAuthorize("@ss.hasPermission('garden:road:query')") |
| 85 | 85 | public CommonResult<PageResult<RoadRespVO>> getRoadPage(@Valid RoadPageReqVO pageReqVO) { |
| 86 | - PageResult<RoadDO> pageResult = roadService.getRoadPage(pageReqVO); | |
| 87 | - return success(BeanUtils.toBean(pageResult, RoadRespVO.class)); | |
| 86 | + PageResult<RoadRespVO> pageResult = roadService.getRoadPage(pageReqVO); | |
| 87 | + return success(pageResult); | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | @PostMapping("/list") |
| ... | ... | @@ -103,7 +103,7 @@ public class RoadController { |
| 103 | 103 | public void exportRoadExcel(@Valid RoadPageReqVO pageReqVO, |
| 104 | 104 | HttpServletResponse response) throws IOException { |
| 105 | 105 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| 106 | - List<RoadDO> list = roadService.getRoadPage(pageReqVO).getList(); | |
| 106 | + List<RoadRespVO> list = roadService.getRoadPage(pageReqVO).getList(); | |
| 107 | 107 | // 导出 Excel |
| 108 | 108 | ExcelUtils.write(response, "道路管理.xls", "数据", RoadRespVO.class, |
| 109 | 109 | BeanUtils.toBean(list, RoadRespVO.class)); | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/vo/RoadListReqVO.java
| ... | ... | @@ -2,6 +2,7 @@ package com.zteits.urbanops.module.garden.controller.admin.road.vo; |
| 2 | 2 | |
| 3 | 3 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 4 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | +import jakarta.validation.constraints.NotEmpty; | |
| 5 | 6 | import jakarta.validation.constraints.NotNull; |
| 6 | 7 | import lombok.Data; |
| 7 | 8 | import org.springframework.format.annotation.DateTimeFormat; |
| ... | ... | @@ -25,4 +26,8 @@ public class RoadListReqVO { |
| 25 | 26 | @NotNull(message = "归属(一级部门id)不能为空") |
| 26 | 27 | private Long companyId; |
| 27 | 28 | |
| 29 | + @Schema(description = "业务看", example = "yl") | |
| 30 | + @NotEmpty(message = "创建者不能为空") | |
| 31 | + private String busiLine; | |
| 32 | + | |
| 28 | 33 | } |
| 29 | 34 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/vo/RoadRespVO.java
| ... | ... | @@ -108,4 +108,12 @@ public class RoadRespVO { |
| 108 | 108 | @ExcelProperty("更新者") |
| 109 | 109 | private String updaterName; |
| 110 | 110 | |
| 111 | + @Schema(description = "公司名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "20800") | |
| 112 | + @ExcelProperty("归属(一级部门id)") | |
| 113 | + private String companyName; | |
| 114 | + | |
| 115 | + @Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "20800") | |
| 116 | + @ExcelProperty("部门(道路负责部门)") | |
| 117 | + private String deptName; | |
| 118 | + | |
| 111 | 119 | } |
| 112 | 120 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/ErrorCodeConstants.java
| ... | ... | @@ -96,7 +96,7 @@ public interface ErrorCodeConstants { |
| 96 | 96 | ErrorCode PLAN_RATE_LEVEL_ID_DUPLICATE = new ErrorCode(1-100-007-002, "养护等级重复"); |
| 97 | 97 | ErrorCode PLAN_RATE_NOT_EXISTS = new ErrorCode(1-100-007-002, "未配置计划频次"); |
| 98 | 98 | ErrorCode PLAN_RATE_DETAIL_EXISTS = new ErrorCode(1-100-007-003, "计划频次已存在"); |
| 99 | - ErrorCode PLAN_RATE_VALUE_ERROR = new ErrorCode(1-100-007-004, "次数值范围:1-20或者分数格式:1/3"); | |
| 99 | + ErrorCode PLAN_RATE_VALUE_ERROR = new ErrorCode(1-100-007-004, "次数值范围:1-10或者分数格式:1/3"); | |
| 100 | 100 | |
| 101 | 101 | ErrorCode MATERIAL_TYPE_NOT_EXISTS = new ErrorCode(1-100-004-001, "物料类型不存在"); |
| 102 | 102 | ErrorCode MATERIAL_TYPE_MANAGER_NOT_EXISTS = new ErrorCode(1-100-004-002, "耗材类别管理不存在"); | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/road/RoadService.java
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/road/RoadServiceImpl.java
| ... | ... | @@ -2,14 +2,22 @@ package com.zteits.urbanops.module.garden.service.road; |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 4 | 4 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; |
| 5 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanRespVO; | |
| 6 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanRoleDO; | |
| 5 | 7 | import com.zteits.urbanops.module.garden.dal.mysql.road.RoadInterceptMapper; |
| 8 | +import com.zteits.urbanops.module.system.api.dept.DeptApi; | |
| 9 | +import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO; | |
| 10 | +import com.zteits.urbanops.module.system.dal.dataobject.permission.RoleDO; | |
| 6 | 11 | import org.apache.commons.lang3.StringUtils; |
| 7 | 12 | import org.springframework.stereotype.Service; |
| 8 | 13 | import jakarta.annotation.Resource; |
| 14 | +import org.springframework.util.CollectionUtils; | |
| 9 | 15 | import org.springframework.validation.annotation.Validated; |
| 10 | 16 | |
| 11 | 17 | import java.time.LocalDateTime; |
| 12 | 18 | import java.util.*; |
| 19 | +import java.util.stream.Collectors; | |
| 20 | + | |
| 13 | 21 | import com.zteits.urbanops.module.garden.controller.admin.road.vo.*; |
| 14 | 22 | import com.zteits.urbanops.module.garden.dal.dataobject.road.RoadDO; |
| 15 | 23 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| ... | ... | @@ -17,6 +25,8 @@ import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 17 | 25 | |
| 18 | 26 | import com.zteits.urbanops.module.garden.dal.mysql.road.RoadMapper; |
| 19 | 27 | |
| 28 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 29 | + | |
| 20 | 30 | |
| 21 | 31 | /** |
| 22 | 32 | * 道路管理 Service 实现类 |
| ... | ... | @@ -33,6 +43,10 @@ public class RoadServiceImpl implements RoadService { |
| 33 | 43 | @Resource |
| 34 | 44 | private RoadInterceptMapper roadInterceptMapper; |
| 35 | 45 | |
| 46 | + @Resource | |
| 47 | + private DeptApi deptApi; | |
| 48 | + | |
| 49 | + | |
| 36 | 50 | @Override |
| 37 | 51 | public Long createRoad(RoadSaveReqVO createReqVO) { |
| 38 | 52 | LocalDateTime now = LocalDateTime.now(); |
| ... | ... | @@ -88,8 +102,40 @@ public class RoadServiceImpl implements RoadService { |
| 88 | 102 | } |
| 89 | 103 | |
| 90 | 104 | @Override |
| 91 | - public PageResult<RoadDO> getRoadPage(RoadPageReqVO pageReqVO) { | |
| 92 | - return roadInterceptMapper.selectPage(pageReqVO); | |
| 105 | + public PageResult<RoadRespVO> getRoadPage(RoadPageReqVO pageReqVO) { | |
| 106 | + PageResult<RoadDO> pageResult = roadInterceptMapper.selectPage(pageReqVO); | |
| 107 | + PageResult<RoadRespVO> page = BeanUtils.toBean(pageResult, RoadRespVO.class); | |
| 108 | + addDataInspectionPlan(page.getList()); | |
| 109 | + return page; | |
| 110 | + } | |
| 111 | + | |
| 112 | + /** | |
| 113 | + * 回填部门/公司/角色 | |
| 114 | + * @param list 分页对象 | |
| 115 | + */ | |
| 116 | + private void addDataInspectionPlan(List<RoadRespVO> list ){ | |
| 117 | + if(CollectionUtils.isEmpty(list)){ | |
| 118 | + return ; | |
| 119 | + } | |
| 120 | + //公司 | |
| 121 | + Set<Long> companyIds = list.stream().map(RoadRespVO::getCompanyId).collect(Collectors.toSet()); | |
| 122 | + //部门 | |
| 123 | + Set<Long> deptIds = list.stream().map(RoadRespVO::getDeptId).collect(Collectors.toSet()); | |
| 124 | + deptIds.addAll(companyIds); | |
| 125 | + /*1.获取部门*/ | |
| 126 | + Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(deptIds); | |
| 127 | + | |
| 128 | + list.forEach(plan -> { | |
| 129 | + DeptRespDTO dept = deptMap.get(plan.getDeptId()); | |
| 130 | + if (dept != null) { | |
| 131 | + plan.setDeptName(dept.getName()); | |
| 132 | + | |
| 133 | + } | |
| 134 | + DeptRespDTO company = deptMap.get(plan.getCompanyId()); | |
| 135 | + if(company != null){ | |
| 136 | + plan.setCompanyName(company.getName()); | |
| 137 | + } | |
| 138 | + }); | |
| 93 | 139 | } |
| 94 | 140 | |
| 95 | 141 | @Override |
| ... | ... | @@ -99,6 +145,7 @@ public class RoadServiceImpl implements RoadService { |
| 99 | 145 | |
| 100 | 146 | sql.lambda().eq(RoadDO::getCompanyId, reqVO.getCompanyId()) |
| 101 | 147 | .eq(RoadDO::getLevelId, reqVO.getLevelId()) |
| 148 | + .eq(RoadDO::getBusiLine, reqVO.getBusiLine()) | |
| 102 | 149 | .likeRight(StringUtils.isNotEmpty(reqVO.getRoadName()), RoadDO::getRoadName, reqVO.getRoadName()); |
| 103 | 150 | return roadMapper.selectList(sql); |
| 104 | 151 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/util/StringValidateUtil.java
| ... | ... | @@ -6,58 +6,109 @@ import java.util.regex.Pattern; |
| 6 | 6 | * 字符串校验工具:校验是否为1-20的整数或合法分数(如1/3) |
| 7 | 7 | */ |
| 8 | 8 | public class StringValidateUtil { |
| 9 | - // 正则1:匹配1-20的整数(无前置0,如"05"非法) | |
| 10 | - private static final Pattern INTEGER_PATTERN = Pattern.compile("^(1|[1-9]\\d?|20)$"); | |
| 11 | - // 正则2:匹配分数格式(分子/分母均为正整数,无空格、无空值) | |
| 12 | - private static final Pattern FRACTION_PATTERN = Pattern.compile("^[1-9]\\d*/[1-9]\\d*$"); | |
| 9 | + | |
| 10 | + // 正则表达式:匹配1-10的数字 或 分子/分母(分子、分母均为1-10的数字) | |
| 11 | + private static final Pattern PATTERN = Pattern.compile( | |
| 12 | + "^(?:[1-9]|10)$|^(?:[1-9]|10)/(?:[1-9]|10)$" | |
| 13 | + ); | |
| 13 | 14 | |
| 14 | 15 | /** |
| 15 | - * 核心校验方法 | |
| 16 | - * @param input 待校验的字符串 | |
| 17 | - * @return true=合法,false=非法 | |
| 16 | + * 校验字符是否符合规则(正则表达式方式) | |
| 17 | + * @param input 待校验的字符 | |
| 18 | + * @return true-符合,false-不符合 | |
| 18 | 19 | */ |
| 19 | 20 | public static boolean validate(String input) { |
| 20 | - // 空值/空字符串直接非法 | |
| 21 | 21 | if (input == null || input.trim().isEmpty()) { |
| 22 | 22 | return false; |
| 23 | 23 | } |
| 24 | - String trimInput = input.trim(); // 去除首尾空格(若允许空格可省略) | |
| 24 | + return PATTERN.matcher(input.trim()).matches(); | |
| 25 | + } | |
| 25 | 26 | |
| 26 | - // 先校验是否为1-20的整数 | |
| 27 | - if (INTEGER_PATTERN.matcher(trimInput).matches()) { | |
| 28 | - return true; | |
| 27 | + /** | |
| 28 | + * 校验字符是否符合规则(逻辑校验方式,便于理解和调试) | |
| 29 | + * @param input 待校验的字符 | |
| 30 | + * @return true-符合,false-不符合 | |
| 31 | + */ | |
| 32 | + public static boolean validateByLogic(String input) { | |
| 33 | + if (input == null || input.trim().isEmpty()) { | |
| 34 | + return false; | |
| 35 | + } | |
| 36 | + input = input.trim(); | |
| 37 | + | |
| 38 | + // 检查是否为纯数字 | |
| 39 | + if (isNumber(input)) { | |
| 40 | + int num = Integer.parseInt(input); | |
| 41 | + return num >= 1 && num <= 10; | |
| 29 | 42 | } |
| 30 | 43 | |
| 31 | - // 再校验是否为合法分数格式 | |
| 32 | - if (FRACTION_PATTERN.matcher(trimInput).matches()) { | |
| 33 | - // 可选:若需要限制分子/分母范围(如1-20),可添加以下逻辑 | |
| 34 | - String[] parts = trimInput.split("/"); | |
| 35 | - int numerator = Integer.parseInt(parts[0]); // 分子 | |
| 36 | - int denominator = Integer.parseInt(parts[1]); // 分母 | |
| 37 | - // 示例:限制分子、分母均为1-20 | |
| 38 | - return numerator >= 1 && numerator <= 20 && denominator >= 1 && denominator <= 20; | |
| 44 | + // 检查是否为分数格式 | |
| 45 | + if (input.contains("/")) { | |
| 46 | + String[] parts = input.split("/"); | |
| 47 | + if (parts.length != 2) { | |
| 48 | + return false; // 分数必须是分子/分母两部分 | |
| 49 | + } | |
| 50 | + // 校验分子 | |
| 51 | + if (!isNumber(parts[0])) { | |
| 52 | + return false; | |
| 53 | + } | |
| 54 | + int numerator = Integer.parseInt(parts[0]); | |
| 55 | + if (numerator < 1 || numerator > 10) { | |
| 56 | + return false; | |
| 57 | + } | |
| 58 | + // 校验分母 | |
| 59 | + if (!isNumber(parts[1])) { | |
| 60 | + return false; | |
| 61 | + } | |
| 62 | + int denominator = Integer.parseInt(parts[1]); | |
| 63 | + return denominator >= 1 && denominator <= 10; | |
| 39 | 64 | } |
| 40 | 65 | |
| 41 | - // 既不是整数也不是分数 | |
| 66 | + // 既不是数字也不是分数 | |
| 42 | 67 | return false; |
| 43 | 68 | } |
| 44 | 69 | |
| 70 | + /** | |
| 71 | + * 判断字符串是否为整数 | |
| 72 | + * @param str 字符串 | |
| 73 | + * @return true-是整数,false-不是 | |
| 74 | + */ | |
| 75 | + private static boolean isNumber(String str) { | |
| 76 | + if (str == null || str.isEmpty()) { | |
| 77 | + return false; | |
| 78 | + } | |
| 79 | + for (char c : str.toCharArray()) { | |
| 80 | + if (!Character.isDigit(c)) { | |
| 81 | + return false; | |
| 82 | + } | |
| 83 | + } | |
| 84 | + // 处理数字以0开头的情况(如01、05,不符合1-10的规则) | |
| 85 | + if (str.length() > 1 && str.startsWith("0")) { | |
| 86 | + return false; | |
| 87 | + } | |
| 88 | + return true; | |
| 89 | + } | |
| 90 | + | |
| 45 | 91 | // 测试用例 |
| 46 | 92 | public static void main(String[] args) { |
| 47 | - // 合法用例 | |
| 48 | - System.out.println(validate("5")); // true(1-20整数) | |
| 49 | - System.out.println(validate("20")); // true(1-20整数) | |
| 50 | - System.out.println(validate("1/3")); // true(分数,分子分母1-20) | |
| 51 | - System.out.println(validate("10/20")); // true(分数,分子分母1-20) | |
| 93 | + // 测试符合规则的情况 | |
| 94 | + System.out.println(validate("1")); // true | |
| 95 | + System.out.println(validate("10")); // true | |
| 96 | + System.out.println(validate("1/3")); // true | |
| 97 | + System.out.println(validate("5/1")); // true | |
| 98 | + System.out.println(validate("10/10")); // true | |
| 52 | 99 | |
| 53 | - // 非法用例 | |
| 100 | + // 测试不符合规则的情况 | |
| 54 | 101 | System.out.println(validate("0")); // false(小于1) |
| 55 | - System.out.println(validate("21")); // false(大于20) | |
| 56 | - System.out.println(validate("1.5")); // false(小数,非整数/分数) | |
| 57 | - System.out.println(validate("1/0")); // false(分母为0) | |
| 58 | - System.out.println(validate(" 1/3")); // false(首尾空格,trim后合法,若保留空格则false) | |
| 59 | - System.out.println(validate("1//3")); // false(格式错误) | |
| 60 | - System.out.println(validate("21/5")); // false(分子超20) | |
| 102 | + System.out.println(validate("11")); // false(大于10) | |
| 103 | + System.out.println(validate("1/0")); // false(分母小于1) | |
| 104 | + System.out.println(validate("1/11")); // false(分母大于10) | |
| 105 | + System.out.println(validate("1.5")); // false(小数) | |
| 106 | + System.out.println(validate("1/3/5")); // false(多斜杠) | |
| 107 | + System.out.println(validate(" 1/3 ")); // true(trim后符合,validate方法会处理) | |
| 61 | 108 | System.out.println(validate(null)); // false(空值) |
| 109 | + | |
| 110 | + // 测试逻辑校验方式 | |
| 111 | + System.out.println(validateByLogic("2/3")); // true | |
| 112 | + System.out.println(validateByLogic("05")); // false(以0开头) | |
| 62 | 113 | } |
| 63 | 114 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/util/timeinterval/TimeIntervalFrequencyUtil.java
| ... | ... | @@ -133,11 +133,11 @@ public class TimeIntervalFrequencyUtil { |
| 133 | 133 | r1.forEach(System.out::println); |
| 134 | 134 | |
| 135 | 135 | System.out.println("\n=== 示例2:每3周一次(21天),按周 ==="); |
| 136 | - List<PeriodResult> r2 = calculate("2025-01-01", "2025-02-01", "1/3", 2); | |
| 136 | + List<PeriodResult> r2 = calculate("2025-01-01", "2025-02-08", "1/2", 2); | |
| 137 | 137 | r2.forEach(System.out::println); |
| 138 | 138 | |
| 139 | - System.out.println("\n=== 示例3:每2个月一次,按月 ==="); | |
| 140 | - List<PeriodResult> r3 = calculate("2025-01-01", "2025-12-31", "1/2", 3); | |
| 139 | + System.out.println("\n=== 示例3:每5个月一次,按月 ==="); | |
| 140 | + List<PeriodResult> r3 = calculate("2025-11-01", "2025-12-31", "5/1", 3); | |
| 141 | 141 | r3.forEach(System.out::println); |
| 142 | 142 | |
| 143 | 143 | System.out.println("\n=== 示例4:每3年一次,按年 ==="); | ... | ... |