Commit f41986d93f612f6f42272d0434504748b7d0a423
Merge branch 'dev'
Showing
8 changed files
with
38 additions
and
13 deletions
urbanops-framework/urbanops-common/src/main/java/com/zteits/urbanops/framework/common/util/validation/ValidationUtils.java
| @@ -18,8 +18,9 @@ import java.util.regex.Pattern; | @@ -18,8 +18,9 @@ import java.util.regex.Pattern; | ||
| 18 | */ | 18 | */ |
| 19 | public class ValidationUtils { | 19 | public class ValidationUtils { |
| 20 | 20 | ||
| 21 | - private static final Pattern PATTERN_MOBILE = Pattern.compile("^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[0,1,4-9])|(?:5[0-3,5-9])|(?:6[2,5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[0-3,5-9]))\\d{8}$"); | ||
| 22 | - | 21 | + //private static final Pattern PATTERN_MOBILE = Pattern.compile("^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[0,1,4-9])|(?:5[0-3,5-9])|(?:6[2,5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[0-3,5-9]))\\d{8}$"); |
| 22 | + //add by wq 20260327 手机号码校验覆盖全号段 | ||
| 23 | + private static final Pattern PATTERN_MOBILE = Pattern.compile("^(?:\\+86|0086)?1[3-9]\\d{9}$"); | ||
| 23 | private static final Pattern PATTERN_URL = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"); | 24 | private static final Pattern PATTERN_URL = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"); |
| 24 | 25 | ||
| 25 | private static final Pattern PATTERN_XML_NCNAME = Pattern.compile("[a-zA-Z_][\\-_.0-9_a-zA-Z$]*"); | 26 | private static final Pattern PATTERN_XML_NCNAME = Pattern.compile("[a-zA-Z_][\\-_.0-9_a-zA-Z$]*"); |
| @@ -51,5 +52,4 @@ public class ValidationUtils { | @@ -51,5 +52,4 @@ public class ValidationUtils { | ||
| 51 | throw new ConstraintViolationException(constraintViolations); | 52 | throw new ConstraintViolationException(constraintViolations); |
| 52 | } | 53 | } |
| 53 | } | 54 | } |
| 54 | - | ||
| 55 | } | 55 | } |
urbanops-module-api/urbanops-module-garden-api/src/main/java/com/zteits/urbanops/module/garden/dto/material/MaterialInventoryOutDto.java
| @@ -17,6 +17,9 @@ public class MaterialInventoryOutDto { | @@ -17,6 +17,9 @@ public class MaterialInventoryOutDto { | ||
| 17 | @Schema(description = "入库ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18713") | 17 | @Schema(description = "入库ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18713") |
| 18 | private Long id; | 18 | private Long id; |
| 19 | 19 | ||
| 20 | + @Schema(description = "库存ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "111") | ||
| 21 | + private Long inventoryId; | ||
| 22 | + | ||
| 20 | @Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14541") | 23 | @Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14541") |
| 21 | @NotNull(message = "物料ID不能为空") | 24 | @NotNull(message = "物料ID不能为空") |
| 22 | private Long materialId; | 25 | private Long materialId; |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/costfee/CostFeeServiceImpl.java
| @@ -206,6 +206,8 @@ public class CostFeeServiceImpl implements CostFeeService { | @@ -206,6 +206,8 @@ public class CostFeeServiceImpl implements CostFeeService { | ||
| 206 | log.info("数据列表为空,跳过插入操作"); | 206 | log.info("数据列表为空,跳过插入操作"); |
| 207 | return; | 207 | return; |
| 208 | } | 208 | } |
| 209 | + //总公司 | ||
| 210 | + DeptRespDTO deptRespDTO = deptApi.getDept(getCompanyId()); | ||
| 209 | //单位集合 | 211 | //单位集合 |
| 210 | List<DeptRespDTO> companyList = deptApi.getSubDeptList(); | 212 | List<DeptRespDTO> companyList = deptApi.getSubDeptList(); |
| 211 | // 1. 预加载部门映射(循环外加载,避免重复查询) | 213 | // 1. 预加载部门映射(循环外加载,避免重复查询) |
| @@ -220,7 +222,7 @@ public class CostFeeServiceImpl implements CostFeeService { | @@ -220,7 +222,7 @@ public class CostFeeServiceImpl implements CostFeeService { | ||
| 220 | )); | 222 | )); |
| 221 | 223 | ||
| 222 | 224 | ||
| 223 | - // 模板类型校验 | 225 | + // 模板类型校验 |
| 224 | Class<?> importClass = template.getImportClass(); // 从枚举获取导入类,避免switch | 226 | Class<?> importClass = template.getImportClass(); // 从枚举获取导入类,避免switch |
| 225 | // 根据不同模板类型执行不同的处理逻辑 | 227 | // 根据不同模板类型执行不同的处理逻辑 |
| 226 | if (WaterFeeImport.class.isAssignableFrom(importClass)) { | 228 | if (WaterFeeImport.class.isAssignableFrom(importClass)) { |
| @@ -239,8 +241,8 @@ public class CostFeeServiceImpl implements CostFeeService { | @@ -239,8 +241,8 @@ public class CostFeeServiceImpl implements CostFeeService { | ||
| 239 | WaterFeeDO fee = new WaterFeeDO(); | 241 | WaterFeeDO fee = new WaterFeeDO(); |
| 240 | BeanUtils.copyProperties(importObj, fee); | 242 | BeanUtils.copyProperties(importObj, fee); |
| 241 | fee.setCompanyId(String.valueOf(getCompanyId())); | 243 | fee.setCompanyId(String.valueOf(getCompanyId())); |
| 242 | - if (getCompanyId() == 100) { | ||
| 243 | - fee.setCompanyName("蓟城山水"); | 244 | + if (deptRespDTO.getParentId() == 0) { |
| 245 | + fee.setCompanyName(Objects.toString(deptRespDTO.getName(), "")); | ||
| 244 | } else { | 246 | } else { |
| 245 | // 设置单位id | 247 | // 设置单位id |
| 246 | fee.setCompanyName(String.valueOf(companyIdToNamedMap.get(getCompanyId()))); | 248 | fee.setCompanyName(String.valueOf(companyIdToNamedMap.get(getCompanyId()))); |
| @@ -612,7 +614,7 @@ public class CostFeeServiceImpl implements CostFeeService { | @@ -612,7 +614,7 @@ public class CostFeeServiceImpl implements CostFeeService { | ||
| 612 | Set<ConstraintViolation<WaterFeeImport>> violations = validator.validate(importBean); | 614 | Set<ConstraintViolation<WaterFeeImport>> violations = validator.validate(importBean); |
| 613 | if (!violations.isEmpty()) { | 615 | if (!violations.isEmpty()) { |
| 614 | // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”) | 616 | // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”) |
| 615 | - // StringBuilder errorMsg = new StringBuilder(); | 617 | + // StringBuilder errorMsg = new StringBuilder(); |
| 616 | for (ConstraintViolation<WaterFeeImport> violation : violations) { | 618 | for (ConstraintViolation<WaterFeeImport> violation : violations) { |
| 617 | //errorMsg.append(violation.getMessage()).append(";"); | 619 | //errorMsg.append(violation.getMessage()).append(";"); |
| 618 | throw exception0(BAD_REQUEST.getCode() ,String.format( | 620 | throw exception0(BAD_REQUEST.getCode() ,String.format( |
| @@ -644,13 +646,13 @@ public class CostFeeServiceImpl implements CostFeeService { | @@ -644,13 +646,13 @@ public class CostFeeServiceImpl implements CostFeeService { | ||
| 644 | // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”) | 646 | // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”) |
| 645 | //StringBuilder errorMsg = new StringBuilder(); | 647 | //StringBuilder errorMsg = new StringBuilder(); |
| 646 | for (ConstraintViolation<PersonalCostImport> violation : violations) { | 648 | for (ConstraintViolation<PersonalCostImport> violation : violations) { |
| 647 | - // errorMsg.append(violation.getMessage()).append(";"); | 649 | + // errorMsg.append(violation.getMessage()).append(";"); |
| 648 | throw exception0(BAD_REQUEST.getCode() ,String.format( | 650 | throw exception0(BAD_REQUEST.getCode() ,String.format( |
| 649 | "第[{}]条数据:"+ violation.getMessage() | 651 | "第[{}]条数据:"+ violation.getMessage() |
| 650 | ), rowNum); | 652 | ), rowNum); |
| 651 | } | 653 | } |
| 652 | // 抛出包含行号和所有错误的异常 | 654 | // 抛出包含行号和所有错误的异常 |
| 653 | - // throw exception0(BAD_REQUEST.getCode(), errorMsg.toString().trim(), violations); | 655 | + // throw exception0(BAD_REQUEST.getCode(), errorMsg.toString().trim(), violations); |
| 654 | } | 656 | } |
| 655 | Long companyId = nameToCompanyIdMap.get(importBean.getCompanyName()); | 657 | Long companyId = nameToCompanyIdMap.get(importBean.getCompanyName()); |
| 656 | //单位校验 | 658 | //单位校验 |
| @@ -766,9 +768,9 @@ public class CostFeeServiceImpl implements CostFeeService { | @@ -766,9 +768,9 @@ public class CostFeeServiceImpl implements CostFeeService { | ||
| 766 | Set<ConstraintViolation<RentalMechanicalCostImport>> violations = validator.validate(importBean); | 768 | Set<ConstraintViolation<RentalMechanicalCostImport>> violations = validator.validate(importBean); |
| 767 | if (!violations.isEmpty()) { | 769 | if (!violations.isEmpty()) { |
| 768 | // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”) | 770 | // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”) |
| 769 | - // StringBuilder errorMsg = new StringBuilder(); | 771 | + // StringBuilder errorMsg = new StringBuilder(); |
| 770 | for (ConstraintViolation<RentalMechanicalCostImport> violation : violations) { | 772 | for (ConstraintViolation<RentalMechanicalCostImport> violation : violations) { |
| 771 | - // errorMsg.append(violation.getMessage()).append(";"); | 773 | + // errorMsg.append(violation.getMessage()).append(";"); |
| 772 | throw exception0(BAD_REQUEST.getCode() ,String.format( | 774 | throw exception0(BAD_REQUEST.getCode() ,String.format( |
| 773 | "第[{}]条数据:"+violation.getMessage() | 775 | "第[{}]条数据:"+violation.getMessage() |
| 774 | ), rowNum); | 776 | ), rowNum); |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java
| @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
| 6 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 6 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 7 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 7 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| 8 | import com.baomidou.mybatisplus.core.metadata.IPage; | 8 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 9 | +import com.zteits.urbanops.framework.common.exception.ErrorCode; | ||
| 9 | import com.zteits.urbanops.framework.common.pojo.CommonResult; | 10 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 10 | import com.zteits.urbanops.framework.common.pojo.PageResult; | 11 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 11 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; | 12 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| @@ -89,6 +90,12 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | @@ -89,6 +90,12 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | ||
| 89 | @Transactional(rollbackFor = Exception.class) | 90 | @Transactional(rollbackFor = Exception.class) |
| 90 | @Override | 91 | @Override |
| 91 | public CommonResult<Integer> createInspectionPlan(InspectionPlanSaveReqVO createReqVO) { | 92 | public CommonResult<Integer> createInspectionPlan(InspectionPlanSaveReqVO createReqVO) { |
| 93 | + createReqVO.getRoadListReqVO().forEach(road -> { | ||
| 94 | + if (road.getDeptId() == null || road.getRoadId() == 0L) { | ||
| 95 | + ErrorCode errorCode = new ErrorCode(INSPECTION_PLAN_NOT_EXISTS.getCode(), road.getRoadName()+"未配置部门信息,请在道路管理界面配置班组"); | ||
| 96 | + throw exception(errorCode); | ||
| 97 | + } | ||
| 98 | + }); | ||
| 92 | //存在性校验 | 99 | //存在性校验 |
| 93 | validateInspectionPlanExists(createReqVO); | 100 | validateInspectionPlanExists(createReqVO); |
| 94 | LocalDateTime now = LocalDateTime.now(); | 101 | LocalDateTime now = LocalDateTime.now(); |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanServiceImpl.java
| @@ -6,6 +6,7 @@ import cn.hutool.core.util.RandomUtil; | @@ -6,6 +6,7 @@ import cn.hutool.core.util.RandomUtil; | ||
| 6 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 6 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 7 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 7 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| 8 | import com.baomidou.mybatisplus.core.metadata.IPage; | 8 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 9 | +import com.zteits.urbanops.framework.common.exception.ErrorCode; | ||
| 9 | import com.zteits.urbanops.framework.common.pojo.CommonResult; | 10 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 10 | import com.zteits.urbanops.framework.dict.core.DictFrameworkUtils; | 11 | import com.zteits.urbanops.framework.dict.core.DictFrameworkUtils; |
| 11 | import com.zteits.urbanops.framework.mybatis.core.util.MyBatisUtils; | 12 | import com.zteits.urbanops.framework.mybatis.core.util.MyBatisUtils; |
| @@ -102,6 +103,12 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { | @@ -102,6 +103,12 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { | ||
| 102 | 103 | ||
| 103 | @Override | 104 | @Override |
| 104 | public CommonResult<Integer> createMaintainPlan(MaintainPlanSaveReqVO createReqVO) { | 105 | public CommonResult<Integer> createMaintainPlan(MaintainPlanSaveReqVO createReqVO) { |
| 106 | + createReqVO.getRoadListReqVO().forEach(road -> { | ||
| 107 | + if (road.getDeptId() == null || road.getRoadId() == 0L) { | ||
| 108 | + ErrorCode errorCode = new ErrorCode(INSPECTION_PLAN_NOT_EXISTS.getCode(), road.getRoadName() + "未配置部门信息,请在道路管理界面配置班组"); | ||
| 109 | + throw exception(errorCode); | ||
| 110 | + } | ||
| 111 | + }); | ||
| 105 | //存在性校验 | 112 | //存在性校验 |
| 106 | validateMaintainPlanExists(createReqVO); | 113 | validateMaintainPlanExists(createReqVO); |
| 107 | LocalDateTime now = LocalDateTime.now(); | 114 | LocalDateTime now = LocalDateTime.now(); |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialinventoryout/MaterialInventoryOutServiceImpl.java
| @@ -15,6 +15,7 @@ import com.zteits.urbanops.module.system.api.dept.DeptApi; | @@ -15,6 +15,7 @@ import com.zteits.urbanops.module.system.api.dept.DeptApi; | ||
| 15 | import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO; | 15 | import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO; |
| 16 | import jakarta.annotation.Resource; | 16 | import jakarta.annotation.Resource; |
| 17 | import org.apache.commons.collections4.CollectionUtils; | 17 | import org.apache.commons.collections4.CollectionUtils; |
| 18 | +import org.apache.commons.lang3.StringUtils; | ||
| 18 | import org.springframework.stereotype.Service; | 19 | import org.springframework.stereotype.Service; |
| 19 | import org.springframework.transaction.annotation.Transactional; | 20 | import org.springframework.transaction.annotation.Transactional; |
| 20 | import org.springframework.validation.annotation.Validated; | 21 | import org.springframework.validation.annotation.Validated; |
| @@ -55,6 +56,7 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ | @@ -55,6 +56,7 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ | ||
| 55 | if(null == material){ | 56 | if(null == material){ |
| 56 | throw exception0(BAD_REQUEST.getCode(), "无效参数-materialId"); | 57 | throw exception0(BAD_REQUEST.getCode(), "无效参数-materialId"); |
| 57 | } | 58 | } |
| 59 | + | ||
| 58 | MaterialInventoryDO materialInventory = materialInventoryService.getMaterialInventory(createReqVO.getInventoryId()); | 60 | MaterialInventoryDO materialInventory = materialInventoryService.getMaterialInventory(createReqVO.getInventoryId()); |
| 59 | if(null == materialInventory){ | 61 | if(null == materialInventory){ |
| 60 | throw exception0(BAD_REQUEST.getCode(),createReqVO.getMaterialName()+"没有库存"); | 62 | throw exception0(BAD_REQUEST.getCode(),createReqVO.getMaterialName()+"没有库存"); |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/materialdetail/vo/MaterialDetailSaveReqVO.java
| @@ -79,4 +79,7 @@ public class MaterialDetailSaveReqVO { | @@ -79,4 +79,7 @@ public class MaterialDetailSaveReqVO { | ||
| 79 | @Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED, example = "规格") | 79 | @Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED, example = "规格") |
| 80 | @NotEmpty(message = "规格不能为空") | 80 | @NotEmpty(message = "规格不能为空") |
| 81 | private String specifications; | 81 | private String specifications; |
| 82 | + | ||
| 83 | + @Schema(description = "库存ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "111") | ||
| 84 | + private Long inventoryId; | ||
| 82 | } | 85 | } |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/materialdetail/MaterialDetailServiceImpl.java
| @@ -133,12 +133,13 @@ public class MaterialDetailServiceImpl implements MaterialDetailService { | @@ -133,12 +133,13 @@ public class MaterialDetailServiceImpl implements MaterialDetailService { | ||
| 133 | // } | 133 | // } |
| 134 | // } | 134 | // } |
| 135 | //耗材出库 | 135 | //耗材出库 |
| 136 | - for (MaterialDetailDO materialDetailDO : materialDetailList) { | 136 | + for (MaterialDetailSaveReqVO materialDetailDO : createReqVO) { |
| 137 | MaterialInventoryOutDto outDto = new MaterialInventoryOutDto(); | 137 | MaterialInventoryOutDto outDto = new MaterialInventoryOutDto(); |
| 138 | outDto.setMaterialId(materialDetailDO.getMaterialId()); | 138 | outDto.setMaterialId(materialDetailDO.getMaterialId()); |
| 139 | outDto.setMaterialName(materialDetailDO.getMaterialName()); | 139 | outDto.setMaterialName(materialDetailDO.getMaterialName()); |
| 140 | - outDto.setOutInventoryNum(materialDetailDO.getUserCount()); | 140 | + outDto.setOutInventoryNum(Long.valueOf(materialDetailDO.getUserCount())); |
| 141 | outDto.setOutDate(LocalDateTime.now()); | 141 | outDto.setOutDate(LocalDateTime.now()); |
| 142 | + outDto.setInventoryId(materialDetailDO.getInventoryId()); | ||
| 142 | materialApi.createMaterialInventoryOut(outDto); | 143 | materialApi.createMaterialInventoryOut(outDto); |
| 143 | } | 144 | } |
| 144 | //保存耗材 | 145 | //保存耗材 |