From 9b3d5e47568ac430a7a544297cfa7d1a77186e86 Mon Sep 17 00:00:00 2001 From: 唐耀东 <18861537@qq.com> Date: 星期五, 31 十二月 2021 17:34:20 +0800 Subject: [PATCH] 配置工具修改 --- ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/DevEquipmentServiceImpl.java | 61 +++++++++++++++++++++--------- 1 files changed, 43 insertions(+), 18 deletions(-) diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/DevEquipmentServiceImpl.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/DevEquipmentServiceImpl.java index 4bfe12a..740091a 100644 --- a/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/DevEquipmentServiceImpl.java +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/DevEquipmentServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.http.HttpStatus; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.core.page.PagePlus; @@ -123,45 +124,69 @@ DevEquipment po = baseMapper.selectOne(new QueryWrapper<DevEquipment>().lambda() .eq(DevEquipment::getSequenceCode, bo.getSequenceCode())); // 璁惧瀛樺湪锛岀洿鎺ヨ繑鍥炶澶囦俊鎭� - if (StringUtils.isEmpty(po)) { + if (StringUtils.isNotEmpty(po)) { return po; } // 璁惧涓嶅瓨鍦ㄥ垯鏂板缓 else { - // 鍏堟牴鎹簭鍒楃爜鐢熸垚搴忓垪鍙� - DevEquipmentCode c = new DevEquipmentCode(); - c.setSequenceCode(bo.getSequenceCode()); - devEquipmentCodeMapper.insert(c); - // 娣诲姞璁惧 - DevEquipment add = BeanUtil.toBean(bo, DevEquipment.class); - add.setSerialNumber(c.getId()); - baseMapper.insert(add); - return add; + if(bo.isRegister()) { + // 鍏堟牴鎹簭鍒楃爜鐢熸垚搴忓垪鍙� + DevEquipmentCode c = new DevEquipmentCode(); + c.setCreateTime(DateUtils.getNowDate()); + devEquipmentCodeMapper.insert(c); + // 娣诲姞璁惧 + DevEquipment add = BeanUtil.toBean(bo, DevEquipment.class); + add.setSerialNumber(c.getId()); + baseMapper.insert(add); + return add; + }else{ + return po; + } } } @Override + @Transactional(rollbackFor = Exception.class) public DevEquipment equipmentEdit(DevEquipmentBo bo) { DevEquipment po = baseMapper.selectById(bo.getId()); + if (po == null) { + throw new ServiceException("娌℃湁璁惧淇℃伅", HttpStatus.HTTP_PARTIAL); + } if (null != bo.getSchoolId()) { po.setSchoolId(bo.getSchoolId()); } - if (StringUtils.isEmpty(bo.getHostId())) { + if (StringUtils.isNotBlank(bo.getHostId())) { po.setHostId(bo.getHostId()); } - if (StringUtils.isEmpty(bo.getNetworkId())) { - po.setNetworkId(bo.getNetworkId()); - } - if (StringUtils.isEmpty(bo.getFrequencyBand())) { - po.setFrequencyBand(bo.getFrequencyBand()); +// if (StringUtils.isEmpty(bo.getNetworkId())) { +// po.setNetworkId(bo.getNetworkId()); +// } +// if (StringUtils.isEmpty(bo.getFrequencyBand())) { +// po.setFrequencyBand(bo.getFrequencyBand()); +// } +// if (null != bo.getBatchId()) { +// po.setBatchId(bo.getBatchId()); +// } +// if (StringUtils.isEmpty(bo.getRemarks())) { +// po.setRemarks(bo.getRemarks()); +// } + baseMapper.updateById(po); + return po; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void submitComment(DevEquipmentBo bo) { + DevEquipment po = baseMapper.selectById(bo.getId()); + if (po == null) { + throw new ServiceException("娌℃湁璁惧淇℃伅", HttpStatus.HTTP_PARTIAL); } if (null != bo.getBatchId()) { po.setBatchId(bo.getBatchId()); } - if (StringUtils.isEmpty(bo.getRemarks())) { + if (StringUtils.isNotBlank(bo.getRemarks())) { po.setRemarks(bo.getRemarks()); } baseMapper.updateById(po); - return po; } } -- Gitblit v1.9.1