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); } }