From 49130281bb65c40d48c86dc00c495f26805dc191 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Tue, 8 Mar 2022 17:05:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E6=B7=BB=E5=8A=A0=E5=A4=9A?= =?UTF-8?q?=E5=BC=A0=E6=B5=8B=E9=87=8F=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/service/impl/PictureServiceImpl.java | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java b/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java index 7e162ba..66a498c 100644 --- a/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java @@ -13,7 +13,6 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.IOException; import java.util.Locale; -import java.util.Optional; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @@ -26,26 +25,16 @@ public class PictureServiceImpl implements PictureService { @Override public String insertPicture(PictureQo pictureQo, MultipartFile pictureFile) throws IOException { Locale locale = LocaleContextHolder.getLocale(); - String lotNo = pictureQo.getLotNo(); - String machineNo = pictureQo.getMachineNo(); - String materialNo = pictureQo.getMaterialNo(); - String modelNo = pictureQo.getModelNo(); - String machineTypeNo = pictureQo.getMachineTypeNo(); - String craftItemName = pictureQo.getCraftItemName(); - Optional pictureEntity2 = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName); - if (pictureEntity2.isPresent()) { - return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "请勿重复添加!", locale); - } String file = ExcelUploadUtil.memoryFile(pictureFile, 2); - PictureEntity pictureEntity1 = new PictureEntity(); - pictureEntity1.setLotNo(lotNo); - pictureEntity1.setMachineNo(machineNo); - pictureEntity1.setMaterialNo(materialNo); - pictureEntity1.setModelNo(modelNo); - pictureEntity1.setMachineTypeNo(machineTypeNo); - pictureEntity1.setCraftItemName(craftItemName); - pictureEntity1.setPicturePath(file); - pictureDao.save(pictureEntity1); + PictureEntity pictureEntity = new PictureEntity(); + pictureEntity.setLotNo(pictureQo.getLotNo()); + pictureEntity.setMachineNo(pictureQo.getMachineNo()); + pictureEntity.setMaterialNo(pictureQo.getMaterialNo()); + pictureEntity.setModelNo(pictureQo.getModelNo()); + pictureEntity.setMachineTypeNo(pictureQo.getMachineTypeNo()); + pictureEntity.setCraftItemName(pictureQo.getCraftItemName()); + pictureEntity.setPicturePath(file); + pictureDao.save(pictureEntity); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); } }