Commit de5fa873f0087088eb8f35c83a2ea27403d885a0
Merge remote-tracking branch 'origin/dev' into dev
Showing
9 changed files
with
52 additions
and
14 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/InspectionPlanController.java
| @@ -47,7 +47,7 @@ public class InspectionPlanController { | @@ -47,7 +47,7 @@ public class InspectionPlanController { | ||
| 47 | @PreAuthorize("@ss.hasPermission('garden:inspection-plan:create')") | 47 | @PreAuthorize("@ss.hasPermission('garden:inspection-plan:create')") |
| 48 | public CommonResult<Integer> createInspectionPlan(@Valid @RequestBody InspectionPlanSaveReqVO createReqVO) { | 48 | public CommonResult<Integer> createInspectionPlan(@Valid @RequestBody InspectionPlanSaveReqVO createReqVO) { |
| 49 | if(!createReqVO.verify()){ | 49 | if(!createReqVO.verify()){ |
| 50 | - log.warn("次数值范围:1-10或者分数格式:1/3, rateValue={}", createReqVO.getRateValue()); | 50 | + log.warn("次数值范围:1-1000或者分数格式:1/3, rateValue={}", createReqVO.getRateValue()); |
| 51 | return error(PLAN_RATE_VALUE_ERROR); | 51 | return error(PLAN_RATE_VALUE_ERROR); |
| 52 | } | 52 | } |
| 53 | // //临时计划 | 53 | // //临时计划 |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanCommitPageReqVO.java
| @@ -63,4 +63,12 @@ public class InspectionPlanCommitPageReqVO extends PageParam { | @@ -63,4 +63,12 @@ public class InspectionPlanCommitPageReqVO extends PageParam { | ||
| 63 | private String remark; | 63 | private String remark; |
| 64 | 64 | ||
| 65 | private List<String> busiLineList; | 65 | private List<String> busiLineList; |
| 66 | + | ||
| 67 | + @Schema(description = "创建开始时间") | ||
| 68 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) | ||
| 69 | + private LocalDate createTimeStart; | ||
| 70 | + | ||
| 71 | + @Schema(description = "创建结束时间") | ||
| 72 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) | ||
| 73 | + private LocalDate createTimeEnd; | ||
| 66 | } | 74 | } |
| 67 | \ No newline at end of file | 75 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/vo/MaintainPlanCommitPageReqVO.java
| @@ -60,4 +60,12 @@ public class MaintainPlanCommitPageReqVO extends PageParam { | @@ -60,4 +60,12 @@ public class MaintainPlanCommitPageReqVO extends PageParam { | ||
| 60 | @Schema(description = "提交人用户ID", example = "王五") | 60 | @Schema(description = "提交人用户ID", example = "王五") |
| 61 | private String userName; | 61 | private String userName; |
| 62 | 62 | ||
| 63 | -} | ||
| 64 | \ No newline at end of file | 63 | \ No newline at end of file |
| 64 | + @Schema(description = "创建开始时间") | ||
| 65 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) | ||
| 66 | + private LocalDate createTimeStart; | ||
| 67 | + | ||
| 68 | + @Schema(description = "创建结束时间") | ||
| 69 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) | ||
| 70 | + private LocalDate createTimeEnd; | ||
| 71 | + | ||
| 72 | +} |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/ErrorCodeConstants.java
| @@ -98,7 +98,7 @@ public interface ErrorCodeConstants { | @@ -98,7 +98,7 @@ public interface ErrorCodeConstants { | ||
| 98 | ErrorCode PLAN_RATE_DETAIL_EXISTS = new ErrorCode(1-100-007-003, "计划频次已存在"); | 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-10或者分数格式:1/3"); | 99 | ErrorCode PLAN_RATE_VALUE_ERROR = new ErrorCode(1-100-007-004, "次数值范围:1-10或者分数格式:1/3"); |
| 100 | ErrorCode PLAN_RATE_VALUE_INTEGER_ERROR = new ErrorCode(1-100-007-005, "临时计划-次数值范围:1-10的整数"); | 100 | ErrorCode PLAN_RATE_VALUE_INTEGER_ERROR = new ErrorCode(1-100-007-005, "临时计划-次数值范围:1-10的整数"); |
| 101 | - | 101 | + ErrorCode PLAN_NAME_EXISTED = new ErrorCode(1-100-007-006, "计划名称已存在"); |
| 102 | ErrorCode MATERIAL_TYPE_NOT_EXISTS = new ErrorCode(1-100-004-001, "物料类型不存在"); | 102 | ErrorCode MATERIAL_TYPE_NOT_EXISTS = new ErrorCode(1-100-004-001, "物料类型不存在"); |
| 103 | ErrorCode MATERIAL_TYPE_MANAGER_NOT_EXISTS = new ErrorCode(1-100-004-002, "耗材类别管理不存在"); | 103 | ErrorCode MATERIAL_TYPE_MANAGER_NOT_EXISTS = new ErrorCode(1-100-004-002, "耗材类别管理不存在"); |
| 104 | 104 |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java
| @@ -148,7 +148,12 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | @@ -148,7 +148,12 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | ||
| 148 | String planAttrLabel = DictFrameworkUtils.parseDictDataLabel(PlanConstants.GARDEN_PLAN_ATTR_REDIS_KEY, createReqVO.getPlanAttr()); | 148 | String planAttrLabel = DictFrameworkUtils.parseDictDataLabel(PlanConstants.GARDEN_PLAN_ATTR_REDIS_KEY, createReqVO.getPlanAttr()); |
| 149 | String planTypeIdLabel = DictFrameworkUtils.parseDictDataLabel(PlanConstants.INSPECTION_MAINTAIN_TYPE, createReqVO.getPlanTypeId()); | 149 | String planTypeIdLabel = DictFrameworkUtils.parseDictDataLabel(PlanConstants.INSPECTION_MAINTAIN_TYPE, createReqVO.getPlanTypeId()); |
| 150 | String planNameSuffix = StringUtil.isNotEmpty(createReqVO.getPlanNameSuffix()) ? createReqVO.getPlanNameSuffix() : ""; | 150 | String planNameSuffix = StringUtil.isNotEmpty(createReqVO.getPlanNameSuffix()) ? createReqVO.getPlanNameSuffix() : ""; |
| 151 | - inspectionPlan.setPlanName(roadReqVO.getRoadName() + planAttrLabel + planTypeIdLabel + planNameSuffix); | 151 | + String planName = roadReqVO.getRoadName() + planAttrLabel + planTypeIdLabel + planNameSuffix; |
| 152 | + InspectionPlanDO existInspectionPlan = inspectionPlanMapper.selectOne(new QueryWrapper<InspectionPlanDO>().lambda().eq(InspectionPlanDO::getPlanName, planName)); | ||
| 153 | + if (existInspectionPlan != null) { | ||
| 154 | + throw exception(PLAN_NAME_EXISTED, planName); | ||
| 155 | + } | ||
| 156 | + inspectionPlan.setPlanName(planName); | ||
| 152 | inspectionPlanList.add(inspectionPlan); | 157 | inspectionPlanList.add(inspectionPlan); |
| 153 | /*2.插入角色*/ | 158 | /*2.插入角色*/ |
| 154 | createReqVO.getRoleIds().forEach(roleId -> { | 159 | createReqVO.getRoleIds().forEach(roleId -> { |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanServiceImpl.java
| @@ -160,7 +160,13 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { | @@ -160,7 +160,13 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { | ||
| 160 | String planAttrLabel = DictFrameworkUtils.parseDictDataLabel(PlanConstants.GARDEN_PLAN_ATTR_REDIS_KEY, createReqVO.getPlanAttr()); | 160 | String planAttrLabel = DictFrameworkUtils.parseDictDataLabel(PlanConstants.GARDEN_PLAN_ATTR_REDIS_KEY, createReqVO.getPlanAttr()); |
| 161 | String planTypeIdLabel = DictFrameworkUtils.parseDictDataLabel(PlanConstants.MAINTAIN_TYPE, createReqVO.getPlanTypeId()); | 161 | String planTypeIdLabel = DictFrameworkUtils.parseDictDataLabel(PlanConstants.MAINTAIN_TYPE, createReqVO.getPlanTypeId()); |
| 162 | String planNameSuffix = StringUtil.isNotEmpty(createReqVO.getPlanNameSuffix()) ? createReqVO.getPlanNameSuffix() : ""; | 162 | String planNameSuffix = StringUtil.isNotEmpty(createReqVO.getPlanNameSuffix()) ? createReqVO.getPlanNameSuffix() : ""; |
| 163 | - maintainPlan.setPlanName(roadReqVO.getRoadName() + planAttrLabel + planTypeIdLabel + planNameSuffix); | 163 | + String planName = roadReqVO.getRoadName() + planAttrLabel + planTypeIdLabel + planNameSuffix; |
| 164 | + MaintainPlanDO existMaintainPlan = maintainPlanMapper.selectOne(new QueryWrapper<MaintainPlanDO>().lambda().eq(MaintainPlanDO::getPlanName, planName)); | ||
| 165 | + if (existMaintainPlan != null) { | ||
| 166 | + throw exception(PLAN_NAME_EXISTED, planName); | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + maintainPlan.setPlanName(planName); | ||
| 164 | maintainPlanList.add(maintainPlan); | 170 | maintainPlanList.add(maintainPlan); |
| 165 | /*2.插入角色*/ | 171 | /*2.插入角色*/ |
| 166 | createReqVO.getRoleIds().forEach(roleId -> { | 172 | createReqVO.getRoleIds().forEach(roleId -> { |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/util/StringValidateUtil.java
| @@ -3,13 +3,13 @@ package com.zteits.urbanops.module.garden.util; | @@ -3,13 +3,13 @@ package com.zteits.urbanops.module.garden.util; | ||
| 3 | import java.util.regex.Pattern; | 3 | import java.util.regex.Pattern; |
| 4 | 4 | ||
| 5 | /** | 5 | /** |
| 6 | - * 字符串校验工具:校验是否为1-20的整数或合法分数(如1/3) | 6 | + * 字符串校验工具:校验是否为1-1000的整数或合法分数(如1/3) |
| 7 | */ | 7 | */ |
| 8 | public class StringValidateUtil { | 8 | public class StringValidateUtil { |
| 9 | 9 | ||
| 10 | - // 正则表达式:匹配1-10的数字 或 分子/分母(分子、分母均为1-10的数字) | 10 | + // 正则表达式:匹配1-1000的数字 或 分子/分母(分子、分母均为1-100的数字) |
| 11 | private static final Pattern PATTERN = Pattern.compile( | 11 | private static final Pattern PATTERN = Pattern.compile( |
| 12 | - "^(?:[1-9]|10)$|^(?:[1-9]|10)/(?:[1-9]|10)$" | 12 | + "^(?:[1-9]|[1-9]\\d|1\\d{2}|1000)$|^(?:[1-9]|[1-9]\\d|100)/(?:[1-9]|[1-9]\\d|100)$" |
| 13 | ); | 13 | ); |
| 14 | 14 | ||
| 15 | /** | 15 | /** |
| @@ -38,7 +38,7 @@ public class StringValidateUtil { | @@ -38,7 +38,7 @@ public class StringValidateUtil { | ||
| 38 | // 检查是否为纯数字 | 38 | // 检查是否为纯数字 |
| 39 | if (isNumber(input)) { | 39 | if (isNumber(input)) { |
| 40 | int num = Integer.parseInt(input); | 40 | int num = Integer.parseInt(input); |
| 41 | - return num >= 1 && num <= 10; | 41 | + return num >= 1 && num <= 1000; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | // 检查是否为分数格式 | 44 | // 检查是否为分数格式 |
| @@ -52,7 +52,7 @@ public class StringValidateUtil { | @@ -52,7 +52,7 @@ public class StringValidateUtil { | ||
| 52 | return false; | 52 | return false; |
| 53 | } | 53 | } |
| 54 | int numerator = Integer.parseInt(parts[0]); | 54 | int numerator = Integer.parseInt(parts[0]); |
| 55 | - if (numerator < 1 || numerator > 10) { | 55 | + if (numerator < 1 || numerator > 100) { |
| 56 | return false; | 56 | return false; |
| 57 | } | 57 | } |
| 58 | // 校验分母 | 58 | // 校验分母 |
| @@ -60,7 +60,7 @@ public class StringValidateUtil { | @@ -60,7 +60,7 @@ public class StringValidateUtil { | ||
| 60 | return false; | 60 | return false; |
| 61 | } | 61 | } |
| 62 | int denominator = Integer.parseInt(parts[1]); | 62 | int denominator = Integer.parseInt(parts[1]); |
| 63 | - return denominator >= 1 && denominator <= 10; | 63 | + return denominator >= 1 && denominator <= 100; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | // 既不是数字也不是分数 | 66 | // 既不是数字也不是分数 |
| @@ -107,7 +107,7 @@ public class StringValidateUtil { | @@ -107,7 +107,7 @@ public class StringValidateUtil { | ||
| 107 | // 3. 转换为数字并校验范围 | 107 | // 3. 转换为数字并校验范围 |
| 108 | try { | 108 | try { |
| 109 | int number = Integer.parseInt(str); | 109 | int number = Integer.parseInt(str); |
| 110 | - return number >= 1 && number <= 10; | 110 | + return number >= 1 && number <= 100; |
| 111 | } catch (NumberFormatException e) { | 111 | } catch (NumberFormatException e) { |
| 112 | // 理论上不会走到这里(已通过正则校验),兜底处理 | 112 | // 理论上不会走到这里(已通过正则校验),兜底处理 |
| 113 | return false; | 113 | return false; |
urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanCommitMapper.xml
| @@ -85,7 +85,12 @@ | @@ -85,7 +85,12 @@ | ||
| 85 | <if test="req.remark != null and req.remark !=''"> | 85 | <if test="req.remark != null and req.remark !=''"> |
| 86 | AND a.remark LIKE CONCAT('%', #{req.remark} ,'%') | 86 | AND a.remark LIKE CONCAT('%', #{req.remark} ,'%') |
| 87 | </if> | 87 | </if> |
| 88 | - | 88 | + <if test="req.createTimeStart != null"> |
| 89 | + <![CDATA[AND DATE_FORMAT(a.create_time, '%Y-%m-%d') >= #{req.createTimeStart}]]> | ||
| 90 | + </if> | ||
| 91 | + <if test="req.createTimeEnd != null"> | ||
| 92 | + <![CDATA[AND DATE_FORMAT(a.create_time, '%Y-%m-%d') <= #{req.createTimeEnd}]]> | ||
| 93 | + </if> | ||
| 89 | order by a.id desc | 94 | order by a.id desc |
| 90 | </select> | 95 | </select> |
| 91 | 96 | ||
| @@ -133,4 +138,4 @@ | @@ -133,4 +138,4 @@ | ||
| 133 | </foreach> | 138 | </foreach> |
| 134 | </if> | 139 | </if> |
| 135 | </select> | 140 | </select> |
| 136 | -</mapper> | ||
| 137 | \ No newline at end of file | 141 | \ No newline at end of file |
| 142 | +</mapper> |
urbanops-module-garden/src/main/resources/mapper/maintainplan/MaintainPlanCommitMapper.xml
| @@ -76,6 +76,12 @@ | @@ -76,6 +76,12 @@ | ||
| 76 | <if test="req.finishTime != null"> | 76 | <if test="req.finishTime != null"> |
| 77 | AND DATE_FORMAT(c.finish_time, '%Y-%m-%d') = #{req.finishTime} | 77 | AND DATE_FORMAT(c.finish_time, '%Y-%m-%d') = #{req.finishTime} |
| 78 | </if> | 78 | </if> |
| 79 | + <if test="req.createTimeStart != null"> | ||
| 80 | + <![CDATA[AND DATE_FORMAT(a.create_time, '%Y-%m-%d') >= #{req.createTimeStart}]]> | ||
| 81 | + </if> | ||
| 82 | + <if test="req.createTimeEnd != null"> | ||
| 83 | + <![CDATA[AND DATE_FORMAT(a.create_time, '%Y-%m-%d') <= #{req.createTimeEnd}]]> | ||
| 84 | + </if> | ||
| 79 | </select> | 85 | </select> |
| 80 | 86 | ||
| 81 | <select id="appMaintainPlanCommitDetailPage" resultType="com.zteits.urbanops.module.garden.controller.app.maintainplan.vo.AppMaintainPlanCommitDetailPageRespVO"> | 87 | <select id="appMaintainPlanCommitDetailPage" resultType="com.zteits.urbanops.module.garden.controller.app.maintainplan.vo.AppMaintainPlanCommitDetailPageRespVO"> |