From cf8e5eac70e27401888ad4492ef124ab4a60b459 Mon Sep 17 00:00:00 2001 From: mashuai Date: Wed, 12 Jun 2024 18:17:28 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InventoryAndWarehousingController.java | 3 +++ .../InventoryAndWarehousingServiceImpl.java | 18 +++++++++++++++--- .../mapper/system/BmNumLogsMapper.xml | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/InventoryAndWarehousingController.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/InventoryAndWarehousingController.java index 017e069d..9fac2aad 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/InventoryAndWarehousingController.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/InventoryAndWarehousingController.java @@ -3,6 +3,8 @@ package com.bonus.sgzb.material.controller; import com.bonus.sgzb.common.core.web.controller.BaseController; import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.page.TableDataInfo; +import com.bonus.sgzb.common.log.annotation.Log; +import com.bonus.sgzb.common.log.enums.BusinessType; import com.bonus.sgzb.material.domain.PutInStorageBean; import com.bonus.sgzb.material.domain.SavePutInfoDto; import com.bonus.sgzb.material.service.InventoryAndWarehousingService; @@ -46,6 +48,7 @@ public class InventoryAndWarehousingController extends BaseController { */ @ApiOperation(value = "新增入库盘点") @PostMapping("/addList") + @Log(title = "盘点入库操作", businessType = BusinessType.MATERIAL) public AjaxResult savePutInfo(@RequestBody SavePutInfoDto dto) { return inventoryAndWarehousingService.savePutInfo(dto); } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/InventoryAndWarehousingServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/InventoryAndWarehousingServiceImpl.java index b699ca56..09af0c15 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/InventoryAndWarehousingServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/InventoryAndWarehousingServiceImpl.java @@ -2,6 +2,7 @@ package com.bonus.sgzb.material.service.impl; import com.bonus.sgzb.common.core.exception.ServiceException; import com.bonus.sgzb.common.core.utils.DateUtils; +import com.bonus.sgzb.common.core.utils.StringUtils; import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.material.config.ExceptionEnum; @@ -88,11 +89,22 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi } String code = genderBackCode(); List machIneDtoList = dto.getMachIneDtoList(); + //判断提交表单中是否存在相同编码 + for (int i = 0; i < machIneDtoList.size() - 1; i++) { + for (int j = i + 1; j < machIneDtoList.size(); j++) { + if (machIneDtoList.get(i).getMaCode().equals(machIneDtoList.get(j).getMaCode())) { + throw new ServiceException("列表中包含以下相同的设备编码,请修改后重新提交:" + machIneDtoList.get(i).getMaCode()); + } + } + } + //判断提交中设备编码是否与库中相同 if (CollectionUtils.isNotEmpty(machIneDtoList)) { for (MachIneDto machIneDto : machIneDtoList) { - int count = selectByMaCode(machIneDto.getMaCode()); - if (count != 0) { - throw new ServiceException("以下设备编码与库中数据存在重复,请修改后重新提交:" + machIneDto.getMaCode()); + if (StringUtils.isNotBlank(machIneDto.getMaCode())) { + int count = selectByMaCode(machIneDto.getMaCode()); + if (count != 0) { + throw new ServiceException("以下设备编码与库中数据存在重复,请修改后重新提交:" + machIneDto.getMaCode()); + } } } } diff --git a/sgzb-modules/sgzb-system/src/main/resources/mapper/system/BmNumLogsMapper.xml b/sgzb-modules/sgzb-system/src/main/resources/mapper/system/BmNumLogsMapper.xml index d9830732..01f4a674 100644 --- a/sgzb-modules/sgzb-system/src/main/resources/mapper/system/BmNumLogsMapper.xml +++ b/sgzb-modules/sgzb-system/src/main/resources/mapper/system/BmNumLogsMapper.xml @@ -70,7 +70,7 @@ ) values (#{modelTitle,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{task,jdbcType=VARCHAR}, #{typeId,jdbcType=INTEGER}, #{description,jdbcType=VARCHAR}, #{jsonResult,jdbcType=VARCHAR}, - #{time,jdbcType=TIMESTAMP}, #{creator,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR} + now(), #{creator,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR} )