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 | 18 | */ |
| 19 | 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 | 24 | private static final Pattern PATTERN_URL = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"); |
| 24 | 25 | |
| 25 | 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 | 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 | 17 | @Schema(description = "入库ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18713") |
| 18 | 18 | private Long id; |
| 19 | 19 | |
| 20 | + @Schema(description = "库存ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "111") | |
| 21 | + private Long inventoryId; | |
| 22 | + | |
| 20 | 23 | @Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14541") |
| 21 | 24 | @NotNull(message = "物料ID不能为空") |
| 22 | 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 | 206 | log.info("数据列表为空,跳过插入操作"); |
| 207 | 207 | return; |
| 208 | 208 | } |
| 209 | + //总公司 | |
| 210 | + DeptRespDTO deptRespDTO = deptApi.getDept(getCompanyId()); | |
| 209 | 211 | //单位集合 |
| 210 | 212 | List<DeptRespDTO> companyList = deptApi.getSubDeptList(); |
| 211 | 213 | // 1. 预加载部门映射(循环外加载,避免重复查询) |
| ... | ... | @@ -220,7 +222,7 @@ public class CostFeeServiceImpl implements CostFeeService { |
| 220 | 222 | )); |
| 221 | 223 | |
| 222 | 224 | |
| 223 | - // 模板类型校验 | |
| 225 | + // 模板类型校验 | |
| 224 | 226 | Class<?> importClass = template.getImportClass(); // 从枚举获取导入类,避免switch |
| 225 | 227 | // 根据不同模板类型执行不同的处理逻辑 |
| 226 | 228 | if (WaterFeeImport.class.isAssignableFrom(importClass)) { |
| ... | ... | @@ -239,8 +241,8 @@ public class CostFeeServiceImpl implements CostFeeService { |
| 239 | 241 | WaterFeeDO fee = new WaterFeeDO(); |
| 240 | 242 | BeanUtils.copyProperties(importObj, fee); |
| 241 | 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 | 246 | } else { |
| 245 | 247 | // 设置单位id |
| 246 | 248 | fee.setCompanyName(String.valueOf(companyIdToNamedMap.get(getCompanyId()))); |
| ... | ... | @@ -612,7 +614,7 @@ public class CostFeeServiceImpl implements CostFeeService { |
| 612 | 614 | Set<ConstraintViolation<WaterFeeImport>> violations = validator.validate(importBean); |
| 613 | 615 | if (!violations.isEmpty()) { |
| 614 | 616 | // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”) |
| 615 | - // StringBuilder errorMsg = new StringBuilder(); | |
| 617 | + // StringBuilder errorMsg = new StringBuilder(); | |
| 616 | 618 | for (ConstraintViolation<WaterFeeImport> violation : violations) { |
| 617 | 619 | //errorMsg.append(violation.getMessage()).append(";"); |
| 618 | 620 | throw exception0(BAD_REQUEST.getCode() ,String.format( |
| ... | ... | @@ -644,13 +646,13 @@ public class CostFeeServiceImpl implements CostFeeService { |
| 644 | 646 | // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”) |
| 645 | 647 | //StringBuilder errorMsg = new StringBuilder(); |
| 646 | 648 | for (ConstraintViolation<PersonalCostImport> violation : violations) { |
| 647 | - // errorMsg.append(violation.getMessage()).append(";"); | |
| 649 | + // errorMsg.append(violation.getMessage()).append(";"); | |
| 648 | 650 | throw exception0(BAD_REQUEST.getCode() ,String.format( |
| 649 | 651 | "第[{}]条数据:"+ violation.getMessage() |
| 650 | 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 | 657 | Long companyId = nameToCompanyIdMap.get(importBean.getCompanyName()); |
| 656 | 658 | //单位校验 |
| ... | ... | @@ -766,9 +768,9 @@ public class CostFeeServiceImpl implements CostFeeService { |
| 766 | 768 | Set<ConstraintViolation<RentalMechanicalCostImport>> violations = validator.validate(importBean); |
| 767 | 769 | if (!violations.isEmpty()) { |
| 768 | 770 | // 收集所有校验错误信息(比如“用水量不能为空”“格式应为两位小数”) |
| 769 | - // StringBuilder errorMsg = new StringBuilder(); | |
| 771 | + // StringBuilder errorMsg = new StringBuilder(); | |
| 770 | 772 | for (ConstraintViolation<RentalMechanicalCostImport> violation : violations) { |
| 771 | - // errorMsg.append(violation.getMessage()).append(";"); | |
| 773 | + // errorMsg.append(violation.getMessage()).append(";"); | |
| 772 | 774 | throw exception0(BAD_REQUEST.getCode() ,String.format( |
| 773 | 775 | "第[{}]条数据:"+violation.getMessage() |
| 774 | 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 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 7 | 7 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| 8 | 8 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 9 | +import com.zteits.urbanops.framework.common.exception.ErrorCode; | |
| 9 | 10 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 10 | 11 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 11 | 12 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| ... | ... | @@ -89,6 +90,12 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 89 | 90 | @Transactional(rollbackFor = Exception.class) |
| 90 | 91 | @Override |
| 91 | 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 | 100 | validateInspectionPlanExists(createReqVO); |
| 94 | 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 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 7 | 7 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| 8 | 8 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 9 | +import com.zteits.urbanops.framework.common.exception.ErrorCode; | |
| 9 | 10 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 10 | 11 | import com.zteits.urbanops.framework.dict.core.DictFrameworkUtils; |
| 11 | 12 | import com.zteits.urbanops.framework.mybatis.core.util.MyBatisUtils; |
| ... | ... | @@ -102,6 +103,12 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { |
| 102 | 103 | |
| 103 | 104 | @Override |
| 104 | 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 | 113 | validateMaintainPlanExists(createReqVO); |
| 107 | 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 | 15 | import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO; |
| 16 | 16 | import jakarta.annotation.Resource; |
| 17 | 17 | import org.apache.commons.collections4.CollectionUtils; |
| 18 | +import org.apache.commons.lang3.StringUtils; | |
| 18 | 19 | import org.springframework.stereotype.Service; |
| 19 | 20 | import org.springframework.transaction.annotation.Transactional; |
| 20 | 21 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -55,6 +56,7 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ |
| 55 | 56 | if(null == material){ |
| 56 | 57 | throw exception0(BAD_REQUEST.getCode(), "无效参数-materialId"); |
| 57 | 58 | } |
| 59 | + | |
| 58 | 60 | MaterialInventoryDO materialInventory = materialInventoryService.getMaterialInventory(createReqVO.getInventoryId()); |
| 59 | 61 | if(null == materialInventory){ |
| 60 | 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 | 79 | @Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED, example = "规格") |
| 80 | 80 | @NotEmpty(message = "规格不能为空") |
| 81 | 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 | 133 | // } |
| 134 | 134 | // } |
| 135 | 135 | //耗材出库 |
| 136 | - for (MaterialDetailDO materialDetailDO : materialDetailList) { | |
| 136 | + for (MaterialDetailSaveReqVO materialDetailDO : createReqVO) { | |
| 137 | 137 | MaterialInventoryOutDto outDto = new MaterialInventoryOutDto(); |
| 138 | 138 | outDto.setMaterialId(materialDetailDO.getMaterialId()); |
| 139 | 139 | outDto.setMaterialName(materialDetailDO.getMaterialName()); |
| 140 | - outDto.setOutInventoryNum(materialDetailDO.getUserCount()); | |
| 140 | + outDto.setOutInventoryNum(Long.valueOf(materialDetailDO.getUserCount())); | |
| 141 | 141 | outDto.setOutDate(LocalDateTime.now()); |
| 142 | + outDto.setInventoryId(materialDetailDO.getInventoryId()); | |
| 142 | 143 | materialApi.createMaterialInventoryOut(outDto); |
| 143 | 144 | } |
| 144 | 145 | //保存耗材 | ... | ... |