可以添加多张测量图片

This commit is contained in:
liuchengqian 2022-03-08 17:05:53 +08:00
parent c698abfa11
commit 49130281bb

View File

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