瀏覽代碼

Merge branch 'master' of xwh/kmall-pt-general into master

肖文浩 4 年之前
父節點
當前提交
8155886587

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

@@ -253,6 +253,7 @@ public class GoodsController {
      * 上传文件
      */
     @RequestMapping("/upload")
+    @ResponseBody
     public R upload(@RequestParam("file") MultipartFile file) {
         List<GoodsDto> goodsDtoList = new ArrayList<>();//商品信息
         try {
@@ -274,6 +275,7 @@ public class GoodsController {
      * 上传文件
      */
     @RequestMapping("/generalGoodsUpload")
+    @ResponseBody
     public R generalGoodsUpload(@RequestParam("file") MultipartFile file) {
         List<GoodsDto> generalGoodsDtoList = new ArrayList<>();//商品信息
         try {

+ 1 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/OrderController.java

@@ -912,6 +912,7 @@ public class OrderController {
      * 上传文件
      */
     @RequestMapping("/expressUpload")
+    @ResponseBody
     public R expressUpload(@RequestParam("file") MultipartFile file) {
         List<OrderExpressDto> orderExpressList = new ArrayList<>();//快递信息
         try {

+ 1 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/ProductStoreRelaController.java

@@ -275,6 +275,7 @@ public class ProductStoreRelaController {
      * 上传文件
      */
     @RequestMapping("/productStoreRelaUpload")
+    @ResponseBody
     public R storeUpload(@RequestParam("file") MultipartFile file) {
         List<StoreGoodsDto> StoreGoodsDtoList = new ArrayList<>();//信息
         try {

+ 1 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/StoreController.java

@@ -223,6 +223,7 @@ public class StoreController {
      * 上传文件
      */
     @RequestMapping("/storeUpload")
+    @ResponseBody
     public R storeUpload(@RequestParam("file") MultipartFile file) {
         List<StoreDto> storeDtoList = new ArrayList<>();//信息
         try {

+ 1 - 1
kmall-admin/src/main/java/com/kmall/admin/dao/FreightDao.java

@@ -23,5 +23,5 @@ public interface FreightDao extends BaseDao<FreightEntity> {
     FreightEntity queryObjectByName(@Param("defaultFreight")String defaultFreight,@Param("merchSn")String merchSn);
     List<FreightEntity> queryObjectByStoreId(@Param("storeId") Long storeId);
 
-    FreightEntity queryFreightByDefaultFreightAndStoreId(@Param("defaultFreight")String defaultFreight, @Param("storeId") Long storeId);
+    FreightEntity queryFreightByFreightNameAndStoreId(@Param("freightName")String freightName, @Param("storeId") Long storeId);
 }

+ 2 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/GoodsBatchDao.java

@@ -16,4 +16,6 @@ import java.util.List;
 public interface GoodsBatchDao extends BaseDao<GoodsBatchEntity> {
 
     List<GoodsBatchEntity> queryListBySku(@Param("sku") String sku);
+
+    GoodsBatchEntity queryByBatchSnAndSku(@Param("batchSn") String batchSn,@Param("sku") String sku);
 }

+ 18 - 0
kmall-admin/src/main/java/com/kmall/admin/dto/StoreGoodsDto.java

@@ -23,6 +23,24 @@ public class StoreGoodsDto implements Serializable {
     private String brandName;
     private String freightName;
     private String supplierThirdCode;
+    private String bottomLinePrice;//底线价
+    private String batchSn;//批次编号
+
+    public String getBatchSn() {
+        return batchSn;
+    }
+
+    public void setBatchSn(String batchSn) {
+        this.batchSn = batchSn;
+    }
+
+    public String getBottomLinePrice() {
+        return bottomLinePrice;
+    }
+
+    public void setBottomLinePrice(String bottomLinePrice) {
+        this.bottomLinePrice = bottomLinePrice;
+    }
 
     public String getStoreName() {
         return storeName;

+ 2 - 0
kmall-admin/src/main/java/com/kmall/admin/fromcomm/controller/UploadStoreIdController.java

@@ -14,6 +14,7 @@ import com.kmall.common.utils.excel.ExcelUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -67,6 +68,7 @@ public class UploadStoreIdController extends AbstractController {
      * 上传文件
      */
     @RequestMapping("/cateStoreUpload")
+    @ResponseBody
     public R cateStoreUpload(@RequestParam("file") MultipartFile file) {
         List<CateStoreDto> cateStoreDtoList = new ArrayList<>();//信息
         try {

+ 357 - 278
kmall-admin/src/main/java/com/kmall/admin/service/impl/ProductStoreRelaServiceImpl.java

@@ -7,18 +7,23 @@ import com.kmall.admin.dao.mk.dist.MkDistSellAllocationDao;
 import com.kmall.admin.dto.StoreGoodsDto;
 import com.kmall.admin.entity.*;
 import com.kmall.admin.entity.mk.dist.MkDistSellAllocationEntity;
+import com.kmall.admin.fromcomm.entity.SysUserEntity;
 import com.kmall.admin.service.ProductStoreRelaService;
 import com.kmall.admin.utils.ShiroUtils;
 import com.kmall.api.util.StockUtil;
 import com.kmall.common.constant.Dict;
-import com.kmall.admin.fromcomm.entity.SysUserEntity;
 import com.kmall.common.utils.*;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
-import java.util.*;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * Service实现类
@@ -65,6 +70,8 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
     private MerchUserDao merchUserDao;
     @Autowired
     private ExportExceptionDataDao exportExceptionDataDao;
+    @Autowired
+    private GoodsBatchDao goodsBatchDao;
 
     @Override
     public ProductStoreRelaEntity queryObject(Integer id) {
@@ -117,13 +124,16 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
             throw new RRException(r.get("msg").toString());
         } else {
             goodsEntity = goodsDao.queryObject(productStoreRela.getGoodsId());
+            if (goodsEntity == null) {
+                throw new RRException("该商品异常,未添加该商品");
+            }
             isStockShare = StockUtil.getIsStockShareByGoodsEntity(goodsEntity.getIsSupplierGoods(),
                     goodsEntity.getIsStockShare(), goodsEntity.getIsStockShare());
-            if(goodsEntity.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_00.getItem())){
-                if(isStockShare.equalsIgnoreCase(Dict.isStockShare.item_0.getItem())){
+            if (goodsEntity.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_00.getItem())) {
+                if (isStockShare.equalsIgnoreCase(Dict.isStockShare.item_0.getItem())) {
                     builder.put("stockNum", "库存");
                 }
-            }else{
+            } else {
                 builder.put("stockNum", "库存");
             }
 
@@ -529,297 +539,366 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
         return productStoreRelaDao.queryGoodsRealListByTopicIdTotal(map);
     }
 
+//    @Override
+//    public int uploadExcel(List<StoreGoodsDto> storeGoodsDtoList){
+//        GoodsEntity goodsEntity = null;
+//        String isStockShare = "";
+//        SysUserEntity user = ShiroUtils.getUserEntity();
+//        String merchSn = user.getMerchSn();
+//        boolean isFail = false;
+//        List<String> failThirdMerchSnList = new ArrayList<>(),
+//                failGoodsSnList = new ArrayList<>(), failHaveNameList = new ArrayList<>(), failHaveGoodsSnList = new ArrayList<>()
+//                , failParentCateList = new ArrayList<>(), failCateList = new ArrayList<>(), failHaveStoreNameList = new ArrayList<>()
+//                , failBrandList = new ArrayList<>(), failFreightList = new ArrayList<>();
+//        if (storeGoodsDtoList != null && storeGoodsDtoList.size() > 0) {
+//            for (int i = 0; i < storeGoodsDtoList.size(); i++) {
+//                StoreGoodsDto storeGoodsDto = storeGoodsDtoList.get(i);
+//                ProductStoreRelaEntity storeRelaEntity = new ProductStoreRelaEntity();
+//                Map<String, Object> valideDate = MapBeanUtil.fromObject(storeGoodsDto);
+//                ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
+//                builder.put("storeName", "门店名称");
+//                builder.put("goodsSn", "商品编码");
+//                builder.put("categoryName", "一级分类");
+//                builder.put("attributeCategory", "二级分类");
+//                builder.put("brandName", "品牌");
+//                builder.put("freightName", "运费");
+//
+//                R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
+//                if (Integer.valueOf(r.get("code").toString()) != 0) {
+//                    throw new RRException(r.get("msg").toString());
+//                }
+//                StoreEntity store = storeDao.queryObjectByName(storeGoodsDto.getStoreName().trim());
+//                if (store != null) {
+//                    storeRelaEntity.setStoreId(store.getId());
+//                    storeRelaEntity.setMerchSn(store.getMerchSn());
+//                    MerchEntity merchEntity = merchDao.findByMerchSn(store.getMerchSn());
+//                    if(merchEntity != null){
+//                        storeRelaEntity.setMerchName(merchEntity.getMerchName());
+//                    }
+//                    goodsEntity = goodsDao.queryGoodsByGoodsSnAndStoreId(storeGoodsDto.getGoodsSn(), store.getId());
+//                    if(goodsEntity == null){//商品不存在
+//                        isFail = true;
+//                        failGoodsSnList.add(storeGoodsDto.getStoreName());
+//                    }else {
+//                        storeRelaEntity.setSku(goodsEntity.getSku());
+//                        storeRelaEntity.setGoodsId(goodsEntity.getId());
+//                        storeRelaEntity.setGoodsBizType(goodsEntity.getGoodsBizType());
+//                        isStockShare = StockUtil.getIsStockShareByGoodsEntity(goodsEntity.getIsSupplierGoods(),
+//                                goodsEntity.getIsStockShare(), goodsEntity.getIsStockShareBySuppler());
+//
+//                        if(goodsEntity.getIsSupplierGoods().equalsIgnoreCase(Dict.isSupplierGoods.item_1.getItem())) {
+//                            builder.put("supplierThirdName", "商品供货商所属第三方商户");
+//                        }
+//                        if(Dict.orderBizType.item_00.getItem().equalsIgnoreCase(goodsEntity.getGoodsBizType())){
+//                            if(Dict.isStockShare.item_0.getItem().equalsIgnoreCase(isStockShare)){
+//                                builder.put("stockNum", "库存");
+//                            }
+//                        }else{
+//                            builder.put("stockNum", "库存");
+//                        }
+//                        if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
+//                            // 普通商品校验商品规格
+//                            builder.put("specification", "产品规格");
+//                        }
+//                        builder.put("retailPrice", "零售价");
+//                        builder.put("marketPrice", "市场价");
+//                        r = ValidatorUtil.isEmpty(builder.build(), valideDate);
+//                        if (Integer.valueOf(r.get("code").toString()) != 0) {
+//                            throw new RRException(r.get("msg").toString());
+//                        }
+//                        //商品配置校验
+//                        if(!StringUtils.isNotEmpty(goodsEntity.getListPicUrl())){
+//                            throw new RRException("该商品列表图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品列表图信息,再来操作门店商品数据");
+//                        }
+//                        if(!StringUtils.isNotEmpty(goodsEntity.getPrimaryPicUrl())){
+//                            throw new RRException("该商品主图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品主图信息,再来操作门店商品数据");
+//                        }
+//                        List<GoodsGalleryEntity> galleryEntityList = goodsGalleryDao.queryObjectByGoodId(goodsEntity.getId());
+//                        if (galleryEntityList == null || galleryEntityList.size() <= 0) {
+//                            throw new RRException("该商品轮播图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品详情轮播图信息,再来操作门店商品数据");
+//                        }
+//
+//                        if(goodsEntity.getIsSupplierGoods().equalsIgnoreCase(Dict.isSupplierGoods.item_1.getItem())) {
+//                            builder.put("supplierThirdCode", "商品供货商所属第三方商户");
+//                            ThirdMerchantBizEntity thirdMerchantBizEntity = thirdMerchantBizDao.getThirdMerchangByCode(storeGoodsDto.getSupplierThirdCode());
+//                            if(thirdMerchantBizEntity != null){
+//                                storeRelaEntity.setThirdPartyMerchCode(thirdMerchantBizEntity.getThirdPartyMerchCode());
+//                                storeRelaEntity.setSupplierThirdId(thirdMerchantBizEntity.getThirdMerchSn());
+//                            }else{//第三方商户不存在
+//                                isFail = true;
+//                                failThirdMerchSnList.add(storeGoodsDto.getStoreName());
+//                            }
+//                        }
+//                        CategoryEntity parentCategoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getAttributeCategory(), store.getMerchSn());
+//                        if(parentCategoryEntity == null){
+//                            isFail = true;
+//                            failParentCateList.add(storeGoodsDto.getStoreName());
+//                        }else {
+//                            storeRelaEntity.setAttributeCategory(parentCategoryEntity.getParentId());
+//                        }
+//                        CategoryEntity categoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getCategoryName(), store.getMerchSn());
+//                        if(categoryEntity == null){
+//                            isFail = true;
+//                            failCateList.add(storeGoodsDto.getStoreName());
+//                        }else {
+//                            storeRelaEntity.setCategoryId(categoryEntity.getId());
+//                        }
+//                        BrandEntity brandEntity = brandDao.queryBrandByBrandNameAndStoreId(storeGoodsDto.getBrandName(), store.getId());
+//                        if(brandEntity == null){
+//                            isFail = true;
+//                            failBrandList.add(storeGoodsDto.getStoreName());
+//                        }else {
+//                            storeRelaEntity.setBrandId(brandEntity.getId());
+//                        }
+//                        FreightEntity freightEntity = freightDao.queryFreightByDefaultFreightAndStoreId(storeGoodsDto.getBrandName(), store.getId());
+//                        if(freightEntity == null){
+//                            isFail = true;
+//                            failFreightList.add(storeGoodsDto.getStoreName());
+//                        }else {
+//                            storeRelaEntity.setFreightId(freightEntity.getId());
+//                        }
+//
+//                        //校验总库存
+//                        if(goodsEntity.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_00.getItem()) && isStockShare.equalsIgnoreCase(Dict.isStockShare.item_1.getItem())){
+//                            Integer stockNum = Integer.parseInt(storeGoodsDto.getStockNum());
+//                            Integer goodsNumber = goodsEntity.getGoodsNumber();//商品总库存
+//                            if (stockNum.intValue() != goodsNumber.intValue()) {
+//                                throw new RRException("门店【" + store.getStoreName() + "】商品编码【" + storeGoodsDto.getGoodsSn()
+//                                        + "】的门店商品分配库存不等于商品总库存!当前门店属于共享库存,需与总库存一致,该商品总库存【" + goodsNumber + "】");
+//                            } else {
+//                                storeRelaEntity.setStockNum(goodsEntity.getGoodsNumber());
+//                            }
+//                        }
+//                        if((!goodsEntity.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_00.getItem()) && isStockShare.equalsIgnoreCase(Dict.isStockShare.item_1.getItem())) ||
+//                                isStockShare.equalsIgnoreCase(Dict.isStockShare.item_0.getItem())){
+//                            Integer stockNum = Integer.parseInt(storeGoodsDto.getStockNum());
+//                            Integer goodsNumber = goodsEntity.getGoodsNumber();//商品总库存
+//                            Integer storeTotalStockNum = 0;//商品分配库存
+//                            List<ProductStoreRelaEntity> proStoreList = productStoreRelaDao.queryByGoodsId(goodsEntity.getId());
+//                            for(ProductStoreRelaEntity relaEntity: proStoreList){
+//                                if(relaEntity.getStoreId().intValue() != store.getId().intValue()) {
+//                                    storeTotalStockNum = storeTotalStockNum + relaEntity.getStockNum();
+//                                }
+//                            }
+//                            Integer totalStockNum = storeTotalStockNum + stockNum;
+//                            if(goodsNumber < totalStockNum){
+//                                throw new RRException("门店【" + store.getStoreName() + "】商品编码【" + storeGoodsDto.getGoodsSn()
+//                                        + "】的门店商品分配库存已超过商品总库存!当前门店商品分配库存【" + stockNum + "】,已在各门店分配库存总额【"+
+//                                        storeTotalStockNum + "】,该商品总库存【" + goodsNumber + "】");
+//                            }
+//                        }
+//
+//                        String storeId = String.valueOf(store.getId());
+//                        String goodsId = String.valueOf(goodsEntity.getId());
+//                        Map<String, Object> map = Maps.newHashMap();
+//                        map.put("goodsId", goodsId);
+//                        map.put("storeId", storeId);
+//                        List<ProductStoreRelaEntity> storeRelaList = querySameList(map);
+//                        if (storeRelaList != null && storeRelaList.size() > 0) {
+////                        throw new RRException("该门店已存在此商品!");
+//                            isFail = true;
+//                            failHaveNameList.add(storeGoodsDto.getStoreName());
+//                            failHaveGoodsSnList.add(storeGoodsDto.getGoodsSn());
+//                        }
+//
+//                        ProductEntity product = productDao.queryObjectByGoodsIdAndStoreId(goodsId, "");
+//                        if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
+//                            GoodsSpecificationEntity goodsSpecificationEntity = goodsSpecificationDao.queryByGoodsId(goodsEntity.getId());
+//                            if(goodsSpecificationEntity != null){
+//                                goodsSpecificationDao.delete(goodsSpecificationEntity.getId());
+//                            }
+//                            // 添加商品规格
+//                            GoodsSpecificationEntity goodsSpecification = new GoodsSpecificationEntity();
+//                            goodsSpecification.setGoodsId(goodsEntity.getId());
+//                            goodsSpecification.setValue(storeGoodsDto.getSpecification());
+//                            goodsSpecification.setSpecificationId(1);
+//                            goodsSpecificationDao.save(goodsSpecification);
+//
+//                            // 修改产品
+//                            if(product == null){
+//                                product = new ProductEntity();
+//                                product.setGoodsSn(goodsEntity.getGoodsSn());
+//                                product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
+//                                product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
+//                                product.setGoodsId(goodsEntity.getId());
+//                                product.setGoodsNumber(goodsEntity.getGoodsNumber());
+//                                product.setGoodsDefault(0);
+//                                productDao.save(product);
+//                            }else{
+//                                product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
+//                                product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
+//                                productDao.update(product);
+//                            }
+//                        }
+//
+//                        // 批量导入不添加商品参数
+//                        //新增库存操作记录
+//                        StoreMngChangeEntity storeMngChangeEntity = new StoreMngChangeEntity();
+//                        storeMngChangeEntity.setChangeType(Dict.changeType.item_2.getItem());
+//                        storeMngChangeEntity.setChangeReason("新增门店商品");
+//                        storeMngChangeEntity.setGoodsId(Integer.parseInt(String.valueOf(goodsEntity.getId())));
+//                        storeMngChangeEntity.setStoreId(Integer.parseInt(String.valueOf(store.getId())));
+//                        storeMngChangeEntity.setMerchSn(store.getMerchSn());
+//                        storeMngChangeEntity.setCreateTime(new Date());
+//                        storeMngChangeEntity.setModTime(new Date());
+//                        storeMngChangeEntity.setStoreChangeNum(Integer.parseInt(storeGoodsDto.getStockNum()));
+//                        storeMngChangeEntity.setStoreOriginalNum(0);
+//                        storeMngChangeEntity.setStoreValidNum(Integer.parseInt(storeGoodsDto.getStockNum()));
+//                        storeMngChangeEntity.setCreaterSn(user.getUsername());
+//                        storeMngChangeEntity.setModerSn(user.getUsername());
+//                        storeMngChangeEntity.setIsValid(0);
+//                        storeMngChangeDao.save(storeMngChangeEntity);
+//
+//                        //更新门店商品是否有修改字段
+//                        updateLoadGoodsByStoreId(storeId, user);
+//
+//                        storeRelaEntity.setProductId(product.getId());
+////                    storeRelaEntity.setGoodsBizType(goodsEntity.getGoodsBizType());
+////                    storeRelaEntity.setSku(goodsEntity.getSku());
+//                        storeRelaEntity.setRetailPrice(BigDecimal.valueOf(Long.valueOf(storeGoodsDto.getRetailPrice())));
+//                        storeRelaEntity.setMarketPrice(BigDecimal.valueOf(Long.valueOf(storeGoodsDto.getMarketPrice())));
+//                        storeRelaEntity.setCreaterSn(user.getUserId().toString());
+//                        storeRelaEntity.setCreateTime(new Date());
+//                        storeRelaEntity.setModerSn(user.getUserId().toString());
+//                        storeRelaEntity.setModTime(new Date());
+//                    }
+//                }else{
+//                    isFail = true;
+//                    failHaveStoreNameList.add(storeGoodsDto.getStoreName());
+//                }
+//
+//                if(!isFail){
+//                    productStoreRelaDao.save(storeRelaEntity);
+//                }
+//
+//                ExportExceptionDataEntity exportExceptionDataEntity = new ExportExceptionDataEntity();
+//                exportExceptionDataEntity.setCreaterSn(user.getUserId().toString());
+//                exportExceptionDataEntity.setUserId(user.getUserId().intValue());
+//                exportExceptionDataEntity.setCreateTime(new Date());
+//                exportExceptionDataEntity.setModTime(new Date());
+//                exportExceptionDataEntity.setMerchSn(merchSn);
+//                exportExceptionDataEntity.setStoreId(user.getStoreId());
+//                exportExceptionDataEntity.setExportDataType(Dict.exportDataType.item_3.getItem());
+//
+//                if(failHaveStoreNameList != null && failHaveStoreNameList.size() > 0){
+//                    exportExceptionDataEntity.setExportExceptionData("门店名称不存在,请检查门店名称【"+failHaveStoreNameList+"】的门店名称信息!");
+//                    exportExceptionDataDao.save(exportExceptionDataEntity);
+//                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
+//                }
+//                if(failThirdMerchSnList != null && failThirdMerchSnList.size() > 0){
+//                    exportExceptionDataEntity.setExportExceptionData("第三方商户代码不存在,请在商城配置》第三方商户管理中维护,请检查门店名称【"+failThirdMerchSnList+"】的第三方商户代码信息,请先维护再继续操作!");
+//                    exportExceptionDataDao.save(exportExceptionDataEntity);
+//                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
+//                }
+//                if(failHaveNameList != null && failHaveNameList.size() > 0){
+//                    exportExceptionDataEntity.setExportExceptionData("门店商品已存在!请检查门店名称【" + failHaveNameList + "】商品编码【" + failHaveGoodsSnList + "】的门店商品信息");
+//                    exportExceptionDataDao.save(exportExceptionDataEntity);
+//                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
+//                }
+//                if(failGoodsSnList != null && failGoodsSnList.size() > 0){
+//                    exportExceptionDataEntity.setExportExceptionData("商户编码不存在,请检查门店名称【"+failGoodsSnList+"】的商户编码信息,请先维护再继续操作!");
+//                    exportExceptionDataDao.save(exportExceptionDataEntity);
+//                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
+//                }
+//                if(failParentCateList != null && failParentCateList.size() > 0){
+//                    exportExceptionDataEntity.setExportExceptionData("一级分类不存在,请检查门店名称【"+failParentCateList+"】的一级分类信息,请先维护再继续操作!");
+//                    exportExceptionDataDao.save(exportExceptionDataEntity);
+//                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
+//                }
+//                if(failCateList != null && failCateList.size() > 0){
+//                    exportExceptionDataEntity.setExportExceptionData("二级分类不存在,请检查门店名称【"+failCateList+"】的二级分类信息,请先维护再继续操作!");
+//                    exportExceptionDataDao.save(exportExceptionDataEntity);
+//                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
+//                }
+//                if(failBrandList != null && failBrandList.size() > 0){
+//                    exportExceptionDataEntity.setExportExceptionData("品牌不存在,请检查门店名称【"+failBrandList+"】的品牌信息,请先维护再继续操作!");
+//                    exportExceptionDataDao.save(exportExceptionDataEntity);
+//                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
+//                }
+//                if(failFreightList != null && failFreightList.size() > 0){
+//                    exportExceptionDataEntity.setExportExceptionData("运费模板不存在,请检查门店名称【"+failFreightList+"】的运费模板信息,请先维护再继续操作!");
+//                    exportExceptionDataDao.save(exportExceptionDataEntity);
+//                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
+//                }
+//            }
+//        }else{
+//            throw new RRException("导入数据为空,或者检查数据是否为空");
+//        }
+//        throw new RRException("导入成功!");
+////        return 1;
+//    }
+
     @Override
-    public int uploadExcel(List<StoreGoodsDto> storeGoodsDtoList){
-        GoodsEntity goodsEntity = null;
-        String isStockShare = "";
-        SysUserEntity user = ShiroUtils.getUserEntity();
-        String merchSn = user.getMerchSn();
-        boolean isFail = false;
-        List<String> failThirdMerchSnList = new ArrayList<>(),
-                failGoodsSnList = new ArrayList<>(), failHaveNameList = new ArrayList<>(), failHaveGoodsSnList = new ArrayList<>()
-                , failParentCateList = new ArrayList<>(), failCateList = new ArrayList<>(), failHaveStoreNameList = new ArrayList<>()
-                , failBrandList = new ArrayList<>(), failFreightList = new ArrayList<>();
+    public List<ProductStoreRelaEntity> queryExportList(Map<String, Object> params) {
+        return productStoreRelaDao.queryExportList(params);
+    }
+
+
+    @Override
+    @Transactional
+    public int uploadExcel(List<StoreGoodsDto> storeGoodsDtoList) {
         if (storeGoodsDtoList != null && storeGoodsDtoList.size() > 0) {
             for (int i = 0; i < storeGoodsDtoList.size(); i++) {
                 StoreGoodsDto storeGoodsDto = storeGoodsDtoList.get(i);
                 ProductStoreRelaEntity storeRelaEntity = new ProductStoreRelaEntity();
-                Map<String, Object> valideDate = MapBeanUtil.fromObject(storeGoodsDto);
-                ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
-                builder.put("storeName", "门店名称");
-                builder.put("goodsSn", "商品编码");
-                builder.put("categoryName", "一级分类");
-                builder.put("attributeCategory", "二级分类");
-                builder.put("brandName", "品牌");
-                builder.put("freightName", "运费");
-
-                R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
-                if (Integer.valueOf(r.get("code").toString()) != 0) {
-                    throw new RRException(r.get("msg").toString());
-                }
                 StoreEntity store = storeDao.queryObjectByName(storeGoodsDto.getStoreName().trim());
-                if (store != null) {
-                    storeRelaEntity.setStoreId(store.getId());
-                    storeRelaEntity.setMerchSn(store.getMerchSn());
-                    MerchEntity merchEntity = merchDao.findByMerchSn(store.getMerchSn());
-                    if(merchEntity != null){
-                        storeRelaEntity.setMerchName(merchEntity.getMerchName());
-                    }
-                    goodsEntity = goodsDao.queryGoodsByGoodsSnAndStoreId(storeGoodsDto.getGoodsSn(), store.getId());
-                    if(goodsEntity == null){//商品不存在
-                        isFail = true;
-                        failGoodsSnList.add(storeGoodsDto.getStoreName());
-                    }else {
-                        storeRelaEntity.setSku(goodsEntity.getSku());
-                        storeRelaEntity.setGoodsId(goodsEntity.getId());
-                        storeRelaEntity.setGoodsBizType(goodsEntity.getGoodsBizType());
-                        isStockShare = StockUtil.getIsStockShareByGoodsEntity(goodsEntity.getIsSupplierGoods(),
-                                goodsEntity.getIsStockShare(), goodsEntity.getIsStockShareBySuppler());
-
-                        if(goodsEntity.getIsSupplierGoods().equalsIgnoreCase(Dict.isSupplierGoods.item_1.getItem())) {
-                            builder.put("supplierThirdName", "商品供货商所属第三方商户");
-                        }
-                        if(Dict.orderBizType.item_00.getItem().equalsIgnoreCase(goodsEntity.getGoodsBizType())){
-                            if(Dict.isStockShare.item_0.getItem().equalsIgnoreCase(isStockShare)){
-                                builder.put("stockNum", "库存");
-                            }
-                        }else{
-                            builder.put("stockNum", "库存");
-                        }
-                        if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
-                            // 普通商品校验商品规格
-                            builder.put("specification", "产品规格");
-                        }
-                        builder.put("retailPrice", "零售价");
-                        builder.put("marketPrice", "市场价");
-                        r = ValidatorUtil.isEmpty(builder.build(), valideDate);
-                        if (Integer.valueOf(r.get("code").toString()) != 0) {
-                            throw new RRException(r.get("msg").toString());
-                        }
-                        //商品配置校验
-                        if(!StringUtils.isNotEmpty(goodsEntity.getListPicUrl())){
-                            throw new RRException("该商品列表图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品列表图信息,再来操作门店商品数据");
-                        }
-                        if(!StringUtils.isNotEmpty(goodsEntity.getPrimaryPicUrl())){
-                            throw new RRException("该商品主图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品主图信息,再来操作门店商品数据");
-                        }
-                        List<GoodsGalleryEntity> galleryEntityList = goodsGalleryDao.queryObjectByGoodId(goodsEntity.getId());
-                        if (galleryEntityList == null || galleryEntityList.size() <= 0) {
-                            throw new RRException("该商品轮播图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品详情轮播图信息,再来操作门店商品数据");
-                        }
-
-                        if(goodsEntity.getIsSupplierGoods().equalsIgnoreCase(Dict.isSupplierGoods.item_1.getItem())) {
-                            builder.put("supplierThirdCode", "商品供货商所属第三方商户");
-                            ThirdMerchantBizEntity thirdMerchantBizEntity = thirdMerchantBizDao.getThirdMerchangByCode(storeGoodsDto.getSupplierThirdCode());
-                            if(thirdMerchantBizEntity != null){
-                                storeRelaEntity.setThirdPartyMerchCode(thirdMerchantBizEntity.getThirdPartyMerchCode());
-                                storeRelaEntity.setSupplierThirdId(thirdMerchantBizEntity.getThirdMerchSn());
-                            }else{//第三方商户不存在
-                                isFail = true;
-                                failThirdMerchSnList.add(storeGoodsDto.getStoreName());
-                            }
-                        }
-                        CategoryEntity parentCategoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getAttributeCategory(), store.getMerchSn());
-                        if(parentCategoryEntity == null){
-                            isFail = true;
-                            failParentCateList.add(storeGoodsDto.getStoreName());
-                        }else {
-                            storeRelaEntity.setAttributeCategory(parentCategoryEntity.getParentId());
-                        }
-                        CategoryEntity categoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getCategoryName(), store.getMerchSn());
-                        if(categoryEntity == null){
-                            isFail = true;
-                            failCateList.add(storeGoodsDto.getStoreName());
-                        }else {
-                            storeRelaEntity.setCategoryId(categoryEntity.getId());
-                        }
-                        BrandEntity brandEntity = brandDao.queryBrandByBrandNameAndStoreId(storeGoodsDto.getBrandName(), store.getId());
-                        if(brandEntity == null){
-                            isFail = true;
-                            failBrandList.add(storeGoodsDto.getStoreName());
-                        }else {
-                            storeRelaEntity.setBrandId(brandEntity.getId());
-                        }
-                        FreightEntity freightEntity = freightDao.queryFreightByDefaultFreightAndStoreId(storeGoodsDto.getBrandName(), store.getId());
-                        if(freightEntity == null){
-                            isFail = true;
-                            failFreightList.add(storeGoodsDto.getStoreName());
-                        }else {
-                            storeRelaEntity.setFreightId(freightEntity.getId());
-                        }
-
-                        //校验总库存
-                        if(goodsEntity.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_00.getItem()) && isStockShare.equalsIgnoreCase(Dict.isStockShare.item_1.getItem())){
-                            Integer stockNum = Integer.parseInt(storeGoodsDto.getStockNum());
-                            Integer goodsNumber = goodsEntity.getGoodsNumber();//商品总库存
-                            if (stockNum.intValue() != goodsNumber.intValue()) {
-                                throw new RRException("门店【" + store.getStoreName() + "】商品编码【" + storeGoodsDto.getGoodsSn()
-                                        + "】的门店商品分配库存不等于商品总库存!当前门店属于共享库存,需与总库存一致,该商品总库存【" + goodsNumber + "】");
-                            } else {
-                                storeRelaEntity.setStockNum(goodsEntity.getGoodsNumber());
-                            }
-                        }
-                        if((!goodsEntity.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_00.getItem()) && isStockShare.equalsIgnoreCase(Dict.isStockShare.item_1.getItem())) ||
-                                isStockShare.equalsIgnoreCase(Dict.isStockShare.item_0.getItem())){
-                            Integer stockNum = Integer.parseInt(storeGoodsDto.getStockNum());
-                            Integer goodsNumber = goodsEntity.getGoodsNumber();//商品总库存
-                            Integer storeTotalStockNum = 0;//商品分配库存
-                            List<ProductStoreRelaEntity> proStoreList = productStoreRelaDao.queryByGoodsId(goodsEntity.getId());
-                            for(ProductStoreRelaEntity relaEntity: proStoreList){
-                                if(relaEntity.getStoreId().intValue() != store.getId().intValue()) {
-                                    storeTotalStockNum = storeTotalStockNum + relaEntity.getStockNum();
-                                }
-                            }
-                            Integer totalStockNum = storeTotalStockNum + stockNum;
-                            if(goodsNumber < totalStockNum){
-                                throw new RRException("门店【" + store.getStoreName() + "】商品编码【" + storeGoodsDto.getGoodsSn()
-                                        + "】的门店商品分配库存已超过商品总库存!当前门店商品分配库存【" + stockNum + "】,已在各门店分配库存总额【"+
-                                        storeTotalStockNum + "】,该商品总库存【" + goodsNumber + "】");
-                            }
-                        }
-
-                        String storeId = String.valueOf(store.getId());
-                        String goodsId = String.valueOf(goodsEntity.getId());
-                        Map<String, Object> map = Maps.newHashMap();
-                        map.put("goodsId", goodsId);
-                        map.put("storeId", storeId);
-                        List<ProductStoreRelaEntity> storeRelaList = querySameList(map);
-                        if (storeRelaList != null && storeRelaList.size() > 0) {
-//                        throw new RRException("该门店已存在此商品!");
-                            isFail = true;
-                            failHaveNameList.add(storeGoodsDto.getStoreName());
-                            failHaveGoodsSnList.add(storeGoodsDto.getGoodsSn());
-                        }
-
-                        ProductEntity product = productDao.queryObjectByGoodsIdAndStoreId(goodsId, "");
-                        if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
-                            GoodsSpecificationEntity goodsSpecificationEntity = goodsSpecificationDao.queryByGoodsId(goodsEntity.getId());
-                            if(goodsSpecificationEntity != null){
-                                goodsSpecificationDao.delete(goodsSpecificationEntity.getId());
-                            }
-                            // 添加商品规格
-                            GoodsSpecificationEntity goodsSpecification = new GoodsSpecificationEntity();
-                            goodsSpecification.setGoodsId(goodsEntity.getId());
-                            goodsSpecification.setValue(storeGoodsDto.getSpecification());
-                            goodsSpecification.setSpecificationId(1);
-                            goodsSpecificationDao.save(goodsSpecification);
-
-                            // 修改产品
-                            if(product == null){
-                                product = new ProductEntity();
-                                product.setGoodsSn(goodsEntity.getGoodsSn());
-                                product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
-                                product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
-                                product.setGoodsId(goodsEntity.getId());
-                                product.setGoodsNumber(goodsEntity.getGoodsNumber());
-                                product.setGoodsDefault(0);
-                                productDao.save(product);
-                            }else{
-                                product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
-                                product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
-                                productDao.update(product);
-                            }
-                        }
-
-                        // 批量导入不添加商品参数
-                        //新增库存操作记录
-                        StoreMngChangeEntity storeMngChangeEntity = new StoreMngChangeEntity();
-                        storeMngChangeEntity.setChangeType(Dict.changeType.item_2.getItem());
-                        storeMngChangeEntity.setChangeReason("新增门店商品");
-                        storeMngChangeEntity.setGoodsId(Integer.parseInt(String.valueOf(goodsEntity.getId())));
-                        storeMngChangeEntity.setStoreId(Integer.parseInt(String.valueOf(store.getId())));
-                        storeMngChangeEntity.setMerchSn(store.getMerchSn());
-                        storeMngChangeEntity.setCreateTime(new Date());
-                        storeMngChangeEntity.setModTime(new Date());
-                        storeMngChangeEntity.setStoreChangeNum(Integer.parseInt(storeGoodsDto.getStockNum()));
-                        storeMngChangeEntity.setStoreOriginalNum(0);
-                        storeMngChangeEntity.setStoreValidNum(Integer.parseInt(storeGoodsDto.getStockNum()));
-                        storeMngChangeEntity.setCreaterSn(user.getUsername());
-                        storeMngChangeEntity.setModerSn(user.getUsername());
-                        storeMngChangeEntity.setIsValid(0);
-                        storeMngChangeDao.save(storeMngChangeEntity);
-
-                        //更新门店商品是否有修改字段
-                        updateLoadGoodsByStoreId(storeId, user);
-
-                        storeRelaEntity.setProductId(product.getId());
-//                    storeRelaEntity.setGoodsBizType(goodsEntity.getGoodsBizType());
-//                    storeRelaEntity.setSku(goodsEntity.getSku());
-                        storeRelaEntity.setRetailPrice(BigDecimal.valueOf(Long.valueOf(storeGoodsDto.getRetailPrice())));
-                        storeRelaEntity.setMarketPrice(BigDecimal.valueOf(Long.valueOf(storeGoodsDto.getMarketPrice())));
-                        storeRelaEntity.setCreaterSn(user.getUserId().toString());
-                        storeRelaEntity.setCreateTime(new Date());
-                        storeRelaEntity.setModerSn(user.getUserId().toString());
-                        storeRelaEntity.setModTime(new Date());
-                    }
-                }else{
-                    isFail = true;
-                    failHaveStoreNameList.add(storeGoodsDto.getStoreName());
-                }
-
-                if(!isFail){
-                    productStoreRelaDao.save(storeRelaEntity);
-                }
 
-                ExportExceptionDataEntity exportExceptionDataEntity = new ExportExceptionDataEntity();
-                exportExceptionDataEntity.setCreaterSn(user.getUserId().toString());
-                exportExceptionDataEntity.setUserId(user.getUserId().intValue());
-                exportExceptionDataEntity.setCreateTime(new Date());
-                exportExceptionDataEntity.setModTime(new Date());
-                exportExceptionDataEntity.setMerchSn(merchSn);
-                exportExceptionDataEntity.setStoreId(user.getStoreId());
-                exportExceptionDataEntity.setExportDataType(Dict.exportDataType.item_3.getItem());
-
-                if(failHaveStoreNameList != null && failHaveStoreNameList.size() > 0){
-                    exportExceptionDataEntity.setExportExceptionData("门店名称不存在,请检查门店名称【"+failHaveStoreNameList+"】的门店名称信息!");
-                    exportExceptionDataDao.save(exportExceptionDataEntity);
-                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
-                }
-                if(failThirdMerchSnList != null && failThirdMerchSnList.size() > 0){
-                    exportExceptionDataEntity.setExportExceptionData("第三方商户代码不存在,请在商城配置》第三方商户管理中维护,请检查门店名称【"+failThirdMerchSnList+"】的第三方商户代码信息,请先维护再继续操作!");
-                    exportExceptionDataDao.save(exportExceptionDataEntity);
-                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
+                storeRelaEntity.setStoreId(store.getId());
+                GoodsEntity goodsEntity = goodsDao.queryObjectBySn(storeGoodsDto.getGoodsSn());
+                if (goodsEntity != null) {
+                    storeRelaEntity.setGoodsId(goodsEntity.getId());
+                }else{
+                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]未录入系统");
                 }
-                if(failHaveNameList != null && failHaveNameList.size() > 0){
-                    exportExceptionDataEntity.setExportExceptionData("门店商品已存在!请检查门店名称【" + failHaveNameList + "】商品编码【" + failHaveGoodsSnList + "】的门店商品信息");
-                    exportExceptionDataDao.save(exportExceptionDataEntity);
-                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
+                CategoryEntity categoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getAttributeCategory(), store.getMerchSn());
+                if (categoryEntity != null) {
+                    storeRelaEntity.setAttributeCategory(categoryEntity.getId());
+                }else{
+                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的二级类别输入有误");
                 }
-                if(failGoodsSnList != null && failGoodsSnList.size() > 0){
-                    exportExceptionDataEntity.setExportExceptionData("商户编码不存在,请检查门店名称【"+failGoodsSnList+"】的商户编码信息,请先维护再继续操作!");
-                    exportExceptionDataDao.save(exportExceptionDataEntity);
-                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
+                CategoryEntity parentCategoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getCategoryName(), store.getMerchSn());
+                if (parentCategoryEntity != null && categoryEntity.getParentId().intValue()==parentCategoryEntity.getId().intValue()) {
+                    storeRelaEntity.setCategoryId(parentCategoryEntity.getId());
+                }else{
+                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的一级类别输入有误");
                 }
-                if(failParentCateList != null && failParentCateList.size() > 0){
-                    exportExceptionDataEntity.setExportExceptionData("一级分类不存在,请检查门店名称【"+failParentCateList+"】的一级分类信息,请先维护再继续操作!");
-                    exportExceptionDataDao.save(exportExceptionDataEntity);
-                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
+                BrandEntity brandEntity = brandDao.queryObjectByName(storeGoodsDto.getBrandName(), store.getMerchSn());
+                if (brandEntity != null) {
+                    storeRelaEntity.setBrandId(brandEntity.getId());
+                }else{
+                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的品牌输入有误");
                 }
-                if(failCateList != null && failCateList.size() > 0){
-                    exportExceptionDataEntity.setExportExceptionData("二级分类不存在,请检查门店名称【"+failCateList+"】的二级分类信息,请先维护再继续操作!");
-                    exportExceptionDataDao.save(exportExceptionDataEntity);
-                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
+                FreightEntity freightEntity = freightDao.queryFreightByFreightNameAndStoreId(storeGoodsDto.getFreightName(), store.getId());
+                if (freightEntity != null) {
+                    storeRelaEntity.setFreightId(freightEntity.getId());
+                }else{
+                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的运费模板输入有误");
                 }
-                if(failBrandList != null && failBrandList.size() > 0){
-                    exportExceptionDataEntity.setExportExceptionData("品牌不存在,请检查门店名称【"+failBrandList+"】的品牌信息,请先维护再继续操作!");
-                    exportExceptionDataDao.save(exportExceptionDataEntity);
-                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
+                // 如果底线价大于零售价
+                if (new BigDecimal(storeGoodsDto.getBottomLinePrice()).compareTo(new BigDecimal(storeGoodsDto.getRetailPrice())) == 1) {
+                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的底线价不可以大于零售价");
                 }
-                if(failFreightList != null && failFreightList.size() > 0){
-                    exportExceptionDataEntity.setExportExceptionData("运费模板不存在,请检查门店名称【"+failFreightList+"】的运费模板信息,请先维护再继续操作!");
-                    exportExceptionDataDao.save(exportExceptionDataEntity);
-                    throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
+                // 查询批次号是否存在
+                GoodsBatchEntity goodsBatchEntity = goodsBatchDao.queryByBatchSnAndSku(storeGoodsDto.getBatchSn(), goodsEntity.getSku());
+                if (goodsBatchEntity!=null){
+                    storeRelaEntity.setBatchSn(goodsBatchEntity.getBatchSn());
+                    Date batchExpireDate = goodsBatchEntity.getBatchExpireDate();
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                    storeRelaEntity.setBatchExpireDate(sdf.format(batchExpireDate));
+                }else{
+                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的批次号不存在");
                 }
+                storeRelaEntity.setMarketPrice(new BigDecimal(storeGoodsDto.getMarketPrice()));
+                storeRelaEntity.setRetailPrice(new BigDecimal(storeGoodsDto.getRetailPrice()));
+                storeRelaEntity.setBottomLinePrice(storeGoodsDto.getBottomLinePrice());
+                storeRelaEntity.setStockNum(Integer.valueOf(storeGoodsDto.getStockNum()));
+                save(storeRelaEntity);
             }
         }else{
             throw new RRException("导入数据为空,或者检查数据是否为空");
         }
-        throw new RRException("导入成功!");
-//        return 1;
+        return 1;
     }
 
-    @Override
-    public List<ProductStoreRelaEntity> queryExportList(Map<String, Object> params) {
-        return productStoreRelaDao.queryExportList(params);
-    }
+
 }

+ 9 - 9
kmall-admin/src/main/resources/XmlTemplate/StoreGoodsDtoList.xml

@@ -6,16 +6,16 @@
               varType="com.kmall.admin.dto.StoreGoodsDto">
             <section startRow="1" endRow="1">
                 <mapping row="1" col="0">StoreGoodsDto.storeName</mapping>
-                <mapping row="1" col="1">StoreGoodsDto.specification</mapping>
+                <mapping row="1" col="1">StoreGoodsDto.goodsSn</mapping>
                 <mapping row="1" col="2">StoreGoodsDto.stockNum</mapping>
-                <mapping row="1" col="3">StoreGoodsDto.goodsSn</mapping>
-                <mapping row="1" col="4">StoreGoodsDto.retailPrice</mapping>
-                <mapping row="1" col="5">StoreGoodsDto.marketPrice</mapping>
-                <mapping row="1" col="6">StoreGoodsDto.categoryName</mapping>
-                <mapping row="1" col="7">StoreGoodsDto.attributeCategory</mapping>
-                <mapping row="1" col="8">StoreGoodsDto.brandName</mapping>
-                <mapping row="1" col="9">StoreGoodsDto.freightName</mapping>
-                <mapping row="1" col="10">StoreGoodsDto.supplierThirdCode</mapping>
+                <mapping row="1" col="3">StoreGoodsDto.categoryName</mapping>
+                <mapping row="1" col="4">StoreGoodsDto.attributeCategory</mapping>
+                <mapping row="1" col="5">StoreGoodsDto.brandName</mapping>
+                <mapping row="1" col="6">StoreGoodsDto.freightName</mapping>
+                <mapping row="1" col="7">StoreGoodsDto.retailPrice</mapping>
+                <mapping row="1" col="8">StoreGoodsDto.marketPrice</mapping>
+                <mapping row="1" col="9">StoreGoodsDto.bottomLinePrice</mapping>
+                <mapping row="1" col="10">StoreGoodsDto.batchSn</mapping>
             </section>
             <loopbreakcondition>
                 <rowcheck offset="0">

+ 15 - 18
kmall-admin/src/main/resources/mybatis/mapper/BrandDao.xml

@@ -47,21 +47,21 @@
 
     <select id="queryObjectByName" resultType="com.kmall.admin.entity.BrandEntity">
         select
-        `id`,
-        `name`,
-        `store_id`,
-		`merch_sn`,
-        `list_pic_url`,
-        `simple_desc`,
-        `pic_url`,
-        `sort_order`,
-        `is_show`,
-        `floor_price`,
-        `app_list_pic_url`,
-        `is_new`,
-        `new_pic_url`,
-        `new_sort_order`,
-        b.category_id
+        b.`id`,
+        b.`name`,
+        b.`store_id`,
+		b.`merch_sn`,
+        b.`list_pic_url`,
+        b.`simple_desc`,
+        b.`pic_url`,
+        b.`sort_order`,
+        b.`is_show`,
+        b.`floor_price`,
+        b.`app_list_pic_url`,
+        b.`is_new`,
+        b.`new_pic_url`,
+        b.`new_sort_order`,
+        b.category_id,
         s.store_name storeName,
         m.merch_name merchName
         from mall_brand b
@@ -71,9 +71,6 @@
         <if test="merchSn != null and merchSn.trim() != ''">
             AND b.merch_sn = #{merchSn}
         </if>
-        <if test="categoryId != null">
-            AND b.category_id = #{categoryId}
-        </if>
     </select>
 
     <select id="queryBrandByBrandNameAndStoreId" resultType="com.kmall.admin.entity.BrandEntity">

+ 3 - 3
kmall-admin/src/main/resources/mybatis/mapper/FreightDao.xml

@@ -47,7 +47,7 @@
 		</if>
 	</select>
 
-	<select id="queryFreightByDefaultFreightAndStoreId" resultType="com.kmall.admin.entity.FreightEntity">
+	<select id="queryFreightByFreightNameAndStoreId" resultType="com.kmall.admin.entity.FreightEntity">
 		select
 		`id`,
 		`name`,
@@ -59,8 +59,8 @@
 		`is_default`
 		from mall_freight
 		where 1=1
-		<if test="defaultFreight != null and defaultFreight != ''">
-			AND default_freight = #{defaultFreight}
+		<if test="freightName != null and freightName != ''">
+			AND `name` = #{freightName}
 		</if>
 		<if test="storeId != null and storeId != ''">
 			AND store_id = #{storeId}

+ 3 - 0
kmall-admin/src/main/resources/mybatis/mapper/GoodsBatchDao.xml

@@ -75,6 +75,9 @@
     <select id="queryListBySku" resultType="com.kmall.admin.entity.GoodsBatchEntity">
 		select * from mall_goods_batch where sku=#{sku}
 	</select>
+    <select id="queryByBatchSnAndSku" resultType="com.kmall.admin.entity.GoodsBatchEntity">
+		select * from mall_goods_batch where sku=#{sku} and batch_sn=#{batchSn}
+	</select>
 
     <insert id="save" parameterType="com.kmall.admin.entity.GoodsBatchEntity">
 		insert into mall_goods_batch(

+ 12 - 12
kmall-admin/src/main/webapp/WEB-INF/page/shop/storeProductStock.html

@@ -128,18 +128,18 @@
                 #if($shiro.hasPermission("productstorerela:delete"))
                 <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                 #end
-<!--                #if($shiro.hasPermission("productstorerela:productStoreRelaUpload"))-->
-<!--                <i-col style="display: inline-grid;">-->
-<!--                    <Upload :show-upload-list="false" :on-success="uploadExcelSuccess" :on-error="uploadExcelError" :on-format-error="uploadExcelFormatError"-->
-<!--                            :format="['xls','xlsx']"-->
-<!--                            action="../productstorerela/productStoreRelaUpload">-->
-<!--                        <i-button type="ghost" icon="ios-cloud-upload-outline">门店商品导入</i-button>-->
-<!--                    </Upload>-->
-<!--                </i-col>-->
-<!--                #end-->
-<!--                #if($shiro.hasPermission("productstorerela:down"))-->
-<!--                &nbsp;&nbsp;&nbsp;<a href="../statics/file/store_goods_export_yyyy_mm_dd_v1.0.0.xls">门店商品模板下载</a>&nbsp;&nbsp;&nbsp;&nbsp;-->
-<!--                #end-->
+                #if($shiro.hasPermission("productstorerela:productStoreRelaUpload"))
+                <i-col style="display: inline-grid;">
+                    <Upload :show-upload-list="false" :on-success="uploadExcelSuccess" :on-format-error="uploadExcelFormatError"
+                            :format="['xls','xlsx']"
+                            action="../productstorerela/productStoreRelaUpload">
+                        <i-button type="ghost" icon="ios-cloud-upload-outline">门店商品导入</i-button>
+                    </Upload>
+                </i-col>
+                #end
+                #if($shiro.hasPermission("productstorerela:down"))
+                &nbsp;&nbsp;&nbsp;<a href="../statics/file/store_goods_export_yyyy_mm_dd_v1.0.0.xls">门店商品模板下载</a>&nbsp;&nbsp;&nbsp;&nbsp;
+                #end
             </div>
         </Row>
         <table id="jqGrid"></table>

二進制
kmall-admin/src/main/webapp/statics/file/store_goods_export_yyyy_mm_dd_v1.0.0.xls