Browse Source

优化产品备案

hj123456 3 years ago
parent
commit
c52edbc5c4

+ 24 - 3
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsProductServiceImpl.java

@@ -139,8 +139,9 @@ public class GoodsProductServiceImpl implements GoodsProductService {
         List<SysCusNationCodeEntity> cusNationCodeEntityList = sysCusNationCodeService.findCusNationByAll();
         // 获取单位代码
         List<SysCusUnitCodeEntity> cusUnitCodeEntityList = sysCusUnitCodeService.getAll();
+        boolean flag = false;
         if (Objects.nonNull(goodsProductDtoList) && goodsProductDtoList.size() > 0) {
-            int count = 0;
+            int count = 1;
             for (GoodsProductDto goodsProductDto : goodsProductDtoList) {
                 if (StringUtils.isEmpty(goodsProductDto.getMerchSn())) {
                     throw new RRException("第" + count + "行的商户编号为空!");
@@ -177,16 +178,21 @@ public class GoodsProductServiceImpl implements GoodsProductService {
                     goodsProductDto.setProdBrand(goodsProductDto.getProdBrandEn());
                 }
                 if (StringUtils.isEmpty(goodsProductDto.getUnitCode())) {
-                    throw new RRException("第" + count + "行的计量单位为空!");
+                    throw new RRException("第" + count + "行的计量名称为空!");
                 }else {
+                    flag = true;
                     String unitCode = goodsProductDto.getUnitCode();
                     for (SysCusUnitCodeEntity sysCusUnitCodeEntity : cusUnitCodeEntityList) {
                         String code = sysCusUnitCodeEntity.getCode();
                         String name = sysCusUnitCodeEntity.getName();
                         if (unitCode.equals(name)) {
                             goodsProductDto.setUnitCode(code);
+                            flag = false;
                         }
                     }
+                    if (flag) {
+                        throw new RRException("第" + count + "行的计量名称没有维护,请联系管理员!");
+                    }
                 }
                 if (StringUtils.isEmpty(goodsProductDto.getCusGoodsCode())) {
                     throw new RRException("第" + count + "行的海关商品编码为空!");
@@ -202,16 +208,21 @@ public class GoodsProductServiceImpl implements GoodsProductService {
                     goodsProductDto.setCusDeclEle(trim);
                 }
                 if (StringUtils.isEmpty(goodsProductDto.getOriCntCode())) {
-                    throw new RRException("第" + count + "行的原产国代码为空!");
+                    throw new RRException("第" + count + "行的原产国名称为空!");
                 }else {
+                    flag = true;
                     String oriCntCode = goodsProductDto.getOriCntCode();
                     for (SysCusNationCodeEntity sysCusNationCodeEntity : cusNationCodeEntityList) {
                         String code = sysCusNationCodeEntity.getCode();
                         String name = sysCusNationCodeEntity.getName();
                         if (oriCntCode.equals(name)) {
                             goodsProductDto.setOriCntCode(code);
+                            flag = false;
                         }
                     }
+                    if (flag) {
+                        throw new RRException("第" + count + "行的原产国名称没有维护,请联系管理员!");
+                    }
                 }
                 if (StringUtils.isEmpty(goodsProductDto.getCiqProdModel())) {
                     throw new RRException("第" + count + "行的规格型号为空!");
@@ -240,14 +251,19 @@ public class GoodsProductServiceImpl implements GoodsProductService {
                 if (StringUtils.isEmpty(goodsProductDto.getSupplierCntCode())){
                     throw new RRException("第" + count + "行的供应商国别名称为空!");
                 }else {
+                    flag = true;
                     String supplierCntCode = goodsProductDto.getSupplierCntCode();
                     for (SysCusNationCodeEntity sysCusNationCodeEntity : cusNationCodeEntityList) {
                         String code = sysCusNationCodeEntity.getCode();
                         String name = sysCusNationCodeEntity.getName();
                         if (supplierCntCode.equals(name)) {
                             goodsProductDto.setSupplierCntCode(code);
+                            flag = false;
                         }
                     }
+                    if (flag) {
+                        throw new RRException("第" + count + "行的供应商国别名称没有维护,请联系管理员!");
+                    }
                 }
                 if (StringUtils.isEmpty(goodsProductDto.getProdCompName())){
                     throw new RRException("第" + count + "行的生产企业名称为空!");
@@ -255,14 +271,19 @@ public class GoodsProductServiceImpl implements GoodsProductService {
                 if (StringUtils.isEmpty(goodsProductDto.getProdCompCntCode())){
                     throw new RRException("第" + count + "行的生产国别名称为空!");
                 }else {
+                    flag = true;
                     String prodCompCntCode = goodsProductDto.getProdCompCntCode();
                     for (SysCusNationCodeEntity sysCusNationCodeEntity : cusNationCodeEntityList) {
                         String code = sysCusNationCodeEntity.getCode();
                         String name = sysCusNationCodeEntity.getName();
                         if (prodCompCntCode.equals(name)) {
                             goodsProductDto.setProdCompCntCode(code);
+                            flag = false;
                         }
                     }
+                    if (flag) {
+                        throw new RRException("第" + count + "行的生产国别名称没有维护,请联系管理员!");
+                    }
                 }
                 GoodsProductEntity queryProduct = goodsProductDao.selectByParams(goodsProductDto.getSku(), goodsProductDto.getMerchSn(), null,goodsProductDto.getProdBarcode());
                 if (Objects.nonNull(queryProduct)) {

BIN
kmall-admin/src/main/webapp/statics/file/goods_product_import_yyyy_mm_dd_v1.0.0.xlsx