From 8b3acc99b7eb126963daf548a5ac9ef82cff83ba Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Tue, 10 Oct 2023 16:32:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86-=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E9=A1=B9=E7=BB=B4=E6=8A=A4(=E4=BF=AE=E6=94=B9BUG?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/EquCheckItemServiceImpl.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java index ca59075c..1c240e80 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java @@ -189,9 +189,27 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { equCheckItemMapper.updateEquCheckItem(equCheckItem); for (EquCheckItemDetail detail : equCheckItemDTO.getFormStandard()) { - detail.setUpdatedBy(SecurityContextHolder.getUserName()); - detail.setUpdatedTime(DateUtils.getNowDate()); - equCheckItemDetailMapper.updateEquCheckItemDetail(detail); + // 标准不存在则新增 + if (detail.getDetailCode() == null) { + // 获取标准流水号 + String detailSerialNum = String.format("%03d", equCheckItemDetailMapper.selectSerialNumber(equCheckItem.getItemCode())); + + detail.setDetailId(IdUtils.fastSimpleUUID()); + detail.setParentCode(equCheckItem.getItemCode()); + detail.setFactoryCode(equCheckItem.getFactoryCode()); + detail.setDetailCode(equCheckItem.getItemCode()+detailSerialNum); + detail.setCreatedBy(SecurityContextHolder.getUserName()); + detail.setCreatedTime(DateUtils.getNowDate()); + detail.setUpdatedBy(SecurityContextHolder.getUserName()); + detail.setUpdatedTime(DateUtils.getNowDate()); + + // 插入到数据库 + equCheckItemDetailMapper.insertEquCheckItemDetail(detail); + }else { + detail.setUpdatedBy(SecurityContextHolder.getUserName()); + detail.setUpdatedTime(DateUtils.getNowDate()); + equCheckItemDetailMapper.updateEquCheckItemDetail(detail); + } } return success("修改成功"); }