From fee66fde68610850d4c8c52df022b9d53a0cd3f7 Mon Sep 17 00:00:00 2001 From: zhangfeng <1603559716@qq.com> Date: 星期三, 21 九月 2022 14:40:34 +0800 Subject: [PATCH] Merge branch 'master' of https://sinanoaq.cn:8888/r/safePlatform-out into zf --- equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/KeypointEquipmentInfoServiceImpl.java | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/KeypointEquipmentInfoServiceImpl.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/KeypointEquipmentInfoServiceImpl.java index 160a22a..b17ee7e 100644 --- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/KeypointEquipmentInfoServiceImpl.java +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/KeypointEquipmentInfoServiceImpl.java @@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.safePlatform.account.rpc.apimodel.AccountDepartmentService; import com.gkhy.safePlatform.equipment.entity.*; +import com.gkhy.safePlatform.equipment.enums.EquipmentResultCodes; +import com.gkhy.safePlatform.equipment.enums.KeypointEquipmentPartTypeEnum; import com.gkhy.safePlatform.equipment.excepiton.EquipmentException; import com.gkhy.safePlatform.equipment.model.dto.req.*; import com.gkhy.safePlatform.equipment.model.dto.resp.KeypointEquipmentInfoExcel; @@ -77,7 +79,7 @@ @Autowired public HttpServletResponse response; - + @Override public ResultVO queryAll(PageQuery<KeypointEquipmentInfoQueryCriteria> pageQuery) { Long pageIndex = pageQuery.getPageIndex(); @@ -241,6 +243,10 @@ @Override public void addOrUpdate(KeypointEquipmentInfoDto infoDto) { + + // 验证枚举 + checkEnum(infoDto); + KeypointEquipmentInfo equipmentInfo = BeanCopyUtils.copyBean(infoDto, KeypointEquipmentInfo.class); //保存主数据 if (infoDto.getId() == null) { //新增 @@ -453,4 +459,14 @@ ExcelUtil.exportExcel(map,respList , response.getOutputStream(),DateUtils.PATTERN_STANDARD); response.getOutputStream().close(); } -} \ No newline at end of file + + /** + * 枚举验证 + * @param infoDto + */ + public void checkEnum(KeypointEquipmentInfoDto infoDto){ + if (KeypointEquipmentPartTypeEnum.getByCode(infoDto.getPartType()) == null) { + throw new EquipmentException(EquipmentResultCodes.KEYPOINT_EQUIPMENT_ENUM_PART_TYPE_NOT_EXIST); + } + } +} -- Gitblit v1.9.2