From 24cb4c00895e93e3f54c6cc268ea2c44e17d1026 Mon Sep 17 00:00:00 2001 From: lxw <810412026@qq.com> Date: 星期一, 11 九月 2023 11:27:07 +0800 Subject: [PATCH] Merge branch 'master' of http://118.89.139.230:10101/r/~whyclxw/CadDrawManager --- src/main/java/com/whyc/service/ProductService.java | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/whyc/service/ProductService.java b/src/main/java/com/whyc/service/ProductService.java index 5c3b5cc..e79178e 100644 --- a/src/main/java/com/whyc/service/ProductService.java +++ b/src/main/java/com/whyc/service/ProductService.java @@ -424,7 +424,7 @@ * @return * @throws IOException */ - @Transactional + @Transactional(rollbackFor = {RuntimeException.class,Exception.class}) public Response add(Product product) throws IOException { String parentCode = product.getParentCode(); String customCode = product.getCustomCode(); @@ -587,6 +587,9 @@ newTemp.setQuantity(bom.getQuantity()); //2323-09-08 涓庢潹绾㈠叞寰俊纭<灏辨寜鐓ф垜涓婁紶娓呭崟鐨勬椂闂达紝绯荤粺閲屾渶鏂扮殑鏄暐鍨嬪彿锛屽氨鍙栦粈涔堝瀷鍙�> Material relatedMaterial = mService.getLastByCode(related); + if(relatedMaterial == null){ + throw new RuntimeException("褰撳墠鏇挎枡"+related+",缂栫爜鍦ㄥ钩鍙颁腑涓嶅瓨鍦�,鏃犳硶鍏宠仈鏇夸唬"); + } newTemp.setMaterialId(relatedMaterial.getId()); newTemp.setCreateTime(date); newAddedList.add(newTemp); @@ -612,6 +615,9 @@ newTemp.setQuantity(bom.getQuantity()); //2323-09-08 涓庢潹绾㈠叞寰俊纭<灏辨寜鐓ф垜涓婁紶娓呭崟鐨勬椂闂达紝绯荤粺閲屾渶鏂扮殑鏄暐鍨嬪彿锛屽氨鍙栦粈涔堝瀷鍙�> Material relatedMaterial = mService.getLastByCode(related); + if(relatedMaterial == null){ + throw new RuntimeException("褰撳墠鏇挎枡"+related+",缂栫爜鍦ㄥ钩鍙颁腑涓嶅瓨鍦�,鏃犳硶鍏宠仈鏇夸唬"); + } newTemp.setMaterialId(relatedMaterial.getId()); newTemp.setCreateTime(date); newAddedList.add(newTemp); -- Gitblit v1.9.1