| | |
| | | return Result.error(name + ": 设备标准已存在,不能重复添加"); |
| | | } |
| | | } |
| | | if (eamMaintenanceStandardOld.getEquipmentId().equals(eamMaintenanceStandard.getEquipmentId()) |
| | | &&eamMaintenanceStandardOld.getMaintenanceCategory().equals(eamMaintenanceStandard.getMaintenanceCategory())) { |
| | | //升版操作,作废原有 |
| | | eamMaintenanceStandardOld.setStandardStatus(MaintenanceStandardStatusEnum.ABOLISH.name()); |
| | | eamMaintenanceStandardMapper.updateById(eamMaintenanceStandard); |
| | | //版本递增获取数字 |
| | | Pattern pattern = Pattern.compile("(\\d+)(?:\\.\\d+)*$"); |
| | | Matcher matcher = pattern.matcher(eamMaintenanceStandardOld.getStandardVersion()); |
| | | if (matcher.find()) { |
| | | try { |
| | | int mainVersion = Integer.parseInt(matcher.group(1)); |
| | | eamMaintenanceStandard.setStandardVersion("v" + (mainVersion + 1)); |
| | | } catch (NumberFormatException ignored) { |
| | | if (StrUtil.isNotEmpty(id)){ |
| | | if (eamMaintenanceStandardOld.getEquipmentId().equals(eamMaintenanceStandard.getEquipmentId()) |
| | | &&eamMaintenanceStandardOld.getMaintenanceCategory().equals(eamMaintenanceStandard.getMaintenanceCategory())) { |
| | | //升版操作,作废原有 |
| | | eamMaintenanceStandardOld.setStandardStatus(MaintenanceStandardStatusEnum.ABOLISH.name()); |
| | | eamMaintenanceStandardMapper.updateById(eamMaintenanceStandard); |
| | | //版本递增获取数字 |
| | | Pattern pattern = Pattern.compile("(\\d+)(?:\\.\\d+)*$"); |
| | | Matcher matcher = pattern.matcher(eamMaintenanceStandardOld.getStandardVersion()); |
| | | if (matcher.find()) { |
| | | try { |
| | | int mainVersion = Integer.parseInt(matcher.group(1)); |
| | | eamMaintenanceStandard.setStandardVersion("v" + (mainVersion + 1)); |
| | | } catch (NumberFormatException ignored) { |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | if (eamMaintenanceStandardOld.getEquipmentId().equals(standard.getEquipmentId()) |
| | | &&eamMaintenanceStandardOld.getMaintenanceCategory().equals(standard.getMaintenanceCategory())) { |
| | | //升版操作,作废原有 |
| | | eamMaintenanceStandardOld.setStandardStatus(MaintenanceStandardStatusEnum.ABOLISH.name()); |
| | | eamMaintenanceStandardMapper.updateById(eamMaintenanceStandardOld); |
| | | //版本递增获取数字 |
| | | Pattern pattern = Pattern.compile("(\\d+)(?:\\.\\d+)*$"); |
| | | Matcher matcher = pattern.matcher(eamMaintenanceStandardOld.getStandardVersion()); |
| | | if (matcher.find()) { |
| | | try { |
| | | int mainVersion = Integer.parseInt(matcher.group(1)); |
| | | standard.setStandardVersion("v" + (mainVersion + 1)); |
| | | } catch (NumberFormatException ignored) { |
| | | if (StrUtil.isNotEmpty(id)){ |
| | | if (eamMaintenanceStandardOld.getEquipmentId().equals(standard.getEquipmentId()) |
| | | &&eamMaintenanceStandardOld.getMaintenanceCategory().equals(standard.getMaintenanceCategory())) { |
| | | //升版操作,作废原有 |
| | | eamMaintenanceStandardOld.setStandardStatus(MaintenanceStandardStatusEnum.ABOLISH.name()); |
| | | eamMaintenanceStandardMapper.updateById(eamMaintenanceStandardOld); |
| | | //版本递增获取数字 |
| | | Pattern pattern = Pattern.compile("(\\d+)(?:\\.\\d+)*$"); |
| | | Matcher matcher = pattern.matcher(eamMaintenanceStandardOld.getStandardVersion()); |
| | | if (matcher.find()) { |
| | | try { |
| | | int mainVersion = Integer.parseInt(matcher.group(1)); |
| | | standard.setStandardVersion("v" + (mainVersion + 1)); |
| | | } catch (NumberFormatException ignored) { |
| | | } |
| | | } |
| | | } |
| | | } |