Ver código fonte

营销方式分页总数,所有商品事务回滚

lsp 4 anos atrás
pai
commit
dd88b1c392

+ 2 - 8
kmall-admin/src/main/java/com/kmall/admin/controller/GoodsController.java

@@ -261,10 +261,7 @@ public class GoodsController {
             e.printStackTrace();
             return R.error("导入失败!");
         }
-        int result = goodsService.uploadExcel(goodsDtoList,Integer.parseInt(Dict.exportDataType.item_1.getItem()));
-        if(0 == result){
-            throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
-        }
+        goodsService.uploadExcel(goodsDtoList,Integer.parseInt(Dict.exportDataType.item_1.getItem()));
         //上传文件
         return R.ok();
     }
@@ -285,10 +282,7 @@ public class GoodsController {
             e.printStackTrace();
             return R.error("导入失败!");
         }
-        int result = goodsService.uploadExcel(generalGoodsDtoList,Integer.parseInt(Dict.exportDataType.item_2.getItem()));
-        if(0 == result){
-            throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
-        }
+        goodsService.uploadExcel(generalGoodsDtoList,Integer.parseInt(Dict.exportDataType.item_2.getItem()));
         //上传文件
         return R.ok();
     }

+ 1 - 1
kmall-admin/src/main/java/com/kmall/admin/controller/mk/MkActivityFormController.java

@@ -117,7 +117,7 @@ public class MkActivityFormController {
         Query query = new Query(params);
 
         List<MkActivitiesEntity> mkActivityFormList = mkActivityFormService.queryMkactivitiesList(query);
-        int total = mkActivityFormService.queryTotal(query);
+        int total = mkActivityFormService.queryMkactivitiesTotal(query);
 
         PageUtils pageUtil = new PageUtils(mkActivityFormList, total, query.getLimit(), query.getPage());
 

+ 24 - 20
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java

@@ -9,6 +9,7 @@ import com.kmall.admin.dto.GoodsDto;
 import com.kmall.admin.dto.GoodsPanoramaDto;
 import com.kmall.admin.entity.*;
 import com.kmall.admin.service.GoodsService;
+import com.kmall.admin.utils.GoodsUtils;
 import com.kmall.admin.utils.ShiroUtils;
 import com.kmall.api.entity.exportpdf.PDFGoodsDto;
 import com.kmall.common.constant.Dict;
@@ -66,6 +67,8 @@ public class GoodsServiceImpl implements GoodsService {
     private MerchUserDao merchUserDao;
     @Autowired
     private StoreMngChangeDao storeMngChangeDao;
+    @Autowired
+    private GoodsUtils goodsUtils;
 
     @Override
     public GoodsEntity queryObject(Integer id) {
@@ -949,43 +952,44 @@ public class GoodsServiceImpl implements GoodsService {
             }else{
                 exportExceptionDataEntity.setExportDataType(Dict.exportDataType.item_2.getItem());
             }
+
             if(failMerchUserGoodsSnList != null && failMerchUserGoodsSnList.size() > 0){
                 exportExceptionDataEntity.setExportExceptionData("不能操作除了登录用户以外商户的商品,当前商户编号为【"+merchSn+"】,请检查商品编码【"+failMerchUserGoodsSnList+"】的商品信息");
-                exportExceptionDataDao.save(exportExceptionDataEntity);
-                return 0;
+                goodsUtils.save(exportExceptionDataEntity);
+                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
             if(failMerchGoodsSnList != null && failMerchGoodsSnList.size() > 0){
                 exportExceptionDataEntity.setExportExceptionData("第三方商户代码不存在,请在商城配置》第三方商户管理中维护,请检查商品编码【"+failMerchGoodsSnList+"】的商品信息,请先维护再继续操作!");
-                exportExceptionDataDao.save(exportExceptionDataEntity);
-                return 0;
+                goodsUtils.save(exportExceptionDataEntity);
+                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
             if(failGoodsSnList != null && failGoodsSnList.size() > 0){
                 if(failSameSkuList.size()>0) {
                     exportExceptionDataEntity.setExportExceptionData("不能有重复的商品编码、sku信息!请检查商品编码【" + failGoodsSnList + "】,业务类型【" +
                             failGoodsTypeList + "】,SKU【" + failSameSkuList + "】的商品信息");
-                    exportExceptionDataDao.save(exportExceptionDataEntity);
-                    return 0;
+                    goodsUtils.save(exportExceptionDataEntity);
+                    throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
                 }else{
                     exportExceptionDataEntity.setExportExceptionData("不能有重复的商品编码、sku信息!请检查商品编码【" + failGoodsSnList + "】,业务类型【" +
                             failGoodsTypeList + "】的商品信息");
-                    exportExceptionDataDao.save(exportExceptionDataEntity);
-                    return 0;
+                    goodsUtils.save(exportExceptionDataEntity);
+                    throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
                 }
             }
             if(failTypeGoodsSnList != null && failTypeGoodsSnList.size() > 0){
                 exportExceptionDataEntity.setExportExceptionData("货品业务类型只能是【00保税备货、02保税补货、10保税展示】!请检查商品编码【"+failTypeGoodsSnList+"】的商品信息");
-                exportExceptionDataDao.save(exportExceptionDataEntity);
-                return 0;
+                goodsUtils.save(exportExceptionDataEntity);
+                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
             if(failProdbarGoodsSnList != null && failProdbarGoodsSnList.size() > 0){
                 exportExceptionDataEntity.setExportExceptionData("不能有重复的产品条码信息!请检查商品编码【"+failProdbarGoodsSnList+"】的商品产品条码信息");
-                exportExceptionDataDao.save(exportExceptionDataEntity);
-                return 0;
+                goodsUtils.save(exportExceptionDataEntity);
+                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
             if(failHotGoodsSnList != null && failHotGoodsSnList.size() > 0){
                 exportExceptionDataEntity.setExportExceptionData("请检查业务类型为【保税补货或保税展示】的商品,商品编码【"+failHotGoodsSnList+"】的商品不能设置为热销!");
-                exportExceptionDataDao.save(exportExceptionDataEntity);
-                return 0;
+                goodsUtils.save(exportExceptionDataEntity);
+                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
 //            if(failCateGoodsSnList != null && failCateGoodsSnList.size() > 0){
 //                exportExceptionDataEntity.setExportExceptionData("分类信息请在商城配置》商品分类中维护,商品分类与商户信息对应,请检查该商品商户信息下的分类是否维护,不存在的商品编码【"+failCateGoodsSnList+"】");
@@ -1009,18 +1013,18 @@ public class GoodsServiceImpl implements GoodsService {
 //            }
             if(failSuppGoodsSnList != null && failSuppGoodsSnList.size() > 0){
                 exportExceptionDataEntity.setExportExceptionData("供应商信息请在商城配置》商品供应商中维护,供应商与商户信息对应,请检查该商品商户信息下的供应商是否维护,不存在的商品编码【" + failSuppGoodsSnList + "】");
-                exportExceptionDataDao.save(exportExceptionDataEntity);
-                return 0;
+                goodsUtils.save(exportExceptionDataEntity);
+                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
             if(failUnitGoodsSnList != null && failUnitGoodsSnList.size() > 0){
                 exportExceptionDataEntity.setExportExceptionData("计算单位信息请在商城配置》计算单位中维护,不存在的商品编码【" + failUnitGoodsSnList + "】");
-                exportExceptionDataDao.save(exportExceptionDataEntity);
-                return 0;
+                goodsUtils.save(exportExceptionDataEntity);
+                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
             if(failNationGoodsSnList != null && failNationGoodsSnList.size() > 0){
                 exportExceptionDataEntity.setExportExceptionData("原产国信息请在商城配置》原产国中维护,不存在的商品编码【" + failNationGoodsSnList + "】");
-                exportExceptionDataDao.save(exportExceptionDataEntity);
-                return 0;
+                goodsUtils.save(exportExceptionDataEntity);
+                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
         }else{
             throw new RRException("导入数据为空,或者检查商品编码数据是否为空");

+ 3 - 1
kmall-admin/src/main/java/com/kmall/admin/utils/TestUtils.java → kmall-admin/src/main/java/com/kmall/admin/utils/GoodsUtils.java

@@ -3,6 +3,7 @@ package com.kmall.admin.utils;
 import com.kmall.admin.dao.ExportExceptionDataDao;
 import com.kmall.admin.entity.ExportExceptionDataEntity;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -11,7 +12,8 @@ import org.springframework.transaction.annotation.Transactional;
  * @version 1.0.0
  * 2020/9/18
  */
-public class TestUtils {
+@Component
+public class GoodsUtils {
 
     @Autowired
     private ExportExceptionDataDao exportExceptionDataDao;