| | |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| | | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils; |
| | |
| | | return; |
| | | } |
| | | if (ObjUtil.notEqual(machinery.getId(), id)) { |
| | | throw exception(DV_MACHINERY_CODE_DUPLICATE); |
| | | throw new ServiceException(DV_MACHINERY_CODE_DUPLICATE.getCode(), |
| | | "设备编号[" + code + "]已被设备[" + machinery.getName() + "]使用,请更换编号,或点击“自动生成”重新生成"); |
| | | } |
| | | } |
| | | |
| | |
| | | // 3.1 校验必填字段 |
| | | String key = StrUtil.blankToDefault(importItem.getCode(), "第 " + currentIndex + " 行"); |
| | | if (StrUtil.isBlank(importItem.getCode())) { |
| | | respVO.getFailureCodes().put(key, "设备编码不能为空"); |
| | | respVO.getFailureCodes().put(key, "设备编号不能为空"); |
| | | return; |
| | | } |
| | | if (StrUtil.isBlank(importItem.getName())) { |
| | |
| | | respVO.getUpdateCodes().add(importItem.getCode()); |
| | | } else { |
| | | // 不支持更新 |
| | | respVO.getFailureCodes().put(key, "设备编码已存在"); |
| | | respVO.getFailureCodes().put(key, "设备编号已存在,如需覆盖请勾选“是否覆盖”后重新导入"); |
| | | } |
| | | }); |
| | | // 记录导入结果汇总,供 @LogRecord 的 success 文案引用 |