Bladeren bron

小程序管理后台前后端品牌、商品、门店商品修改

hyq 6 jaren geleden
bovenliggende
commit
2a95722a7b
33 gewijzigde bestanden met toevoegingen van 844 en 371 verwijderingen
  1. 2 1
      kmall-admin/src/main/java/com/kmall/admin/controller/BrandController.java
  2. 10 1
      kmall-admin/src/main/java/com/kmall/admin/controller/GoodsController.java
  3. 1 1
      kmall-admin/src/main/java/com/kmall/admin/controller/OfflineCartController.java
  4. 19 0
      kmall-admin/src/main/java/com/kmall/admin/controller/ProductStoreRelaController.java
  5. 1 1
      kmall-admin/src/main/java/com/kmall/admin/dao/GoodsDao.java
  6. 12 3
      kmall-admin/src/main/java/com/kmall/admin/dao/ProductDao.java
  7. 2 0
      kmall-admin/src/main/java/com/kmall/admin/dao/ProductStoreRelaDao.java
  8. 5 5
      kmall-admin/src/main/java/com/kmall/admin/dto/GoodsDto.java
  9. 18 0
      kmall-admin/src/main/java/com/kmall/admin/entity/BrandEntity.java
  10. 53 0
      kmall-admin/src/main/java/com/kmall/admin/entity/ProductStoreRelaEntity.java
  11. 1 1
      kmall-admin/src/main/java/com/kmall/admin/service/GoodsService.java
  12. 3 3
      kmall-admin/src/main/java/com/kmall/admin/service/ProductService.java
  13. 3 0
      kmall-admin/src/main/java/com/kmall/admin/service/ProductStoreRelaService.java
  14. 9 7
      kmall-admin/src/main/java/com/kmall/admin/service/impl/CategoryServiceImpl.java
  15. 80 70
      kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java
  16. 2 2
      kmall-admin/src/main/java/com/kmall/admin/service/impl/ProductServiceImpl.java
  17. 69 30
      kmall-admin/src/main/java/com/kmall/admin/service/impl/ProductStoreRelaServiceImpl.java
  18. 11 11
      kmall-admin/src/main/resources/XmlTemplate/GeneralGoodsDtoList.xml
  19. 20 20
      kmall-admin/src/main/resources/XmlTemplate/GoodsDtoList.xml
  20. 30 8
      kmall-admin/src/main/resources/mybatis/mapper/BrandDao.xml
  21. 16 52
      kmall-admin/src/main/resources/mybatis/mapper/GoodsDao.xml
  22. 1 0
      kmall-admin/src/main/resources/mybatis/mapper/OrderGoodsDao.xml
  23. 2 2
      kmall-admin/src/main/resources/mybatis/mapper/ProductDao.xml
  24. 139 24
      kmall-admin/src/main/resources/mybatis/mapper/ProductStoreRelaDao.xml
  25. 9 2
      kmall-admin/src/main/webapp/WEB-INF/page/shop/brand.html
  26. 21 58
      kmall-admin/src/main/webapp/WEB-INF/page/shop/goods.html
  27. 83 6
      kmall-admin/src/main/webapp/WEB-INF/page/shop/storeProductStock.html
  28. 12 1
      kmall-admin/src/main/webapp/js/shop/brand.js
  29. 47 42
      kmall-admin/src/main/webapp/js/shop/goods.js
  30. 7 7
      kmall-admin/src/main/webapp/js/shop/scannShop.js
  31. 156 13
      kmall-admin/src/main/webapp/js/shop/storeProductStock.js
  32. BIN
      kmall-admin/src/main/webapp/statics/file/general_goods_export_yyyy_mm_dd_v1.0.0.xls
  33. BIN
      kmall-admin/src/main/webapp/statics/file/goods_export_yyyy_mm_dd_v1.0.0.xls

+ 2 - 1
kmall-admin/src/main/java/com/kmall/admin/controller/BrandController.java

@@ -67,12 +67,12 @@ public class BrandController {
         ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
         builder.put("merchSn", "商户");
         builder.put("storeId", "门店");
+        builder.put("categoryId", "分类");
         R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
         if (Integer.valueOf(r.get("code").toString()) != 0) {
             throw new RRException(r.get("msg").toString());
         }
 
-
         brandService.save(brand);
 
         return R.ok();
@@ -89,6 +89,7 @@ public class BrandController {
         ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
         builder.put("merchSn", "商户");
         builder.put("storeId", "门店");
+        builder.put("categoryId", "分类");
         R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
         if (Integer.valueOf(r.get("code").toString()) != 0) {
             throw new RRException(r.get("msg").toString());

+ 10 - 1
kmall-admin/src/main/java/com/kmall/admin/controller/GoodsController.java

@@ -59,6 +59,15 @@ public class GoodsController {
                 throw new RRException("请维护门店信息中的第三方商户编号信息!再进行商品查看");
             }
         }
+        String goodsName = (String) params.get("goodsName");
+        if(org.apache.commons.lang3.StringUtils.isNotEmpty(goodsName)){
+            try{
+                goodsName = new String(goodsName.getBytes("iso-8859-1"),"utf-8");
+            }catch (Exception e){
+                e.printStackTrace();
+            }
+            params.put("goodsName", goodsName);
+        }
         //查询列表数据
         Query query = new Query(params);
 
@@ -290,7 +299,7 @@ public class GoodsController {
         if (!user.getRoleType().equalsIgnoreCase("2")) {
             return R.error("该操作只允许店员账户操作");
         }
-        GoodsEntity goods = goodsService.queryObjectByProdBarcodeAndBizType(prodBarcode);
+        GoodsEntity goods = goodsService.queryObjectByProdBarcodeAndBizType(prodBarcode, user.getStoreId());
         if(goods == null) {
             return R.error("商品信息不存在");
         }

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

@@ -118,7 +118,7 @@ public class OfflineCartController {
         offlineCartService.deleteByUserId(user.getUserId());
         List<OfflineCartEntity> cartEntityList = new ArrayList<>();
         for (OfflineCartEntity cartEntity:offlineCartEntityList) {
-            GoodsEntity goods = goodsService.queryObjectByProdBarcodeAndBizType(cartEntity.getProdBarcode());
+            GoodsEntity goods = goodsService.queryObjectByProdBarcodeAndBizType(cartEntity.getProdBarcode(), user.getStoreId());
             cartEntityList = offlineCartService.offlineGoodsCart(goods);
         }
 

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

@@ -38,6 +38,15 @@ public class ProductStoreRelaController {
     @ResponseBody
     public R list(@RequestParam Map<String, Object> params) {
         ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", false);
+        String goodsName = (String) params.get("goodsName");
+        if(org.apache.commons.lang3.StringUtils.isNotEmpty(goodsName)){
+            try{
+                goodsName = new String(goodsName.getBytes("iso-8859-1"),"utf-8");
+            }catch (Exception e){
+                e.printStackTrace();
+            }
+            params.put("goodsName", goodsName);
+        }
         //查询列表数据
         Query query = new Query(params);
 
@@ -59,6 +68,16 @@ public class ProductStoreRelaController {
 
         return R.ok().put("productStoreRela", productStoreRela);
     }
+    /**
+     * 根据商品id查看信息
+     */
+    @RequestMapping("/infoByGoodsId")
+    @ResponseBody
+    public R infoByGoodsId(@RequestParam Map<String, Object> params) {
+        ProductStoreRelaEntity productStoreRela = productStoreRelaService.queryObjectByStoreAndGoodsId(params);
+
+        return R.ok().put("productStoreRela", productStoreRela);
+    }
 
     /**
      * 保存

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

@@ -19,7 +19,7 @@ public interface GoodsDao extends BaseDao<GoodsEntity> {
 
     GoodsEntity queryObjectBySn(String goodsSn);
 
-    GoodsEntity queryObjectByProdBarcodeAndBizType(String goodsSn);
+    GoodsEntity queryObjectByProdBarcodeAndBizType(@Param("prodBarcode")String prodBarcode, @Param("storeId")Integer storeId);
 
     List<GoodsEntity> querySame(Map<String, Object> map);
 

+ 12 - 3
kmall-admin/src/main/java/com/kmall/admin/dao/ProductDao.java

@@ -22,10 +22,19 @@ public interface ProductDao extends BaseDao<ProductEntity> {
     int deleteByGoodsId(Integer goodsId);
 
     /**
-     * 根据编码查询产品
+     * 根据id查询产品
      *
-     * @param goodsSn
+     * @param goodsId
      * @return
      */
-    ProductEntity queryObjectBySn(@Param("goodsSn") String goodsSn);
+    ProductEntity queryObjectByGoodsId(@Param("goodsId") String goodsId);
+
+//    /**
+//     * 根据编码查询产品
+//     *
+//     * @param goodsSn
+//     * @return
+//     */
+//    ProductEntity queryObjectBySn(@Param("goodsSn") String goodsSn);
+
 }

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

@@ -18,6 +18,8 @@ public interface ProductStoreRelaDao extends BaseDao<ProductStoreRelaEntity> {
 
     int deleteByGoodsId(Integer goodsId);
 
+    ProductStoreRelaEntity queryObjectByStoreAndGoodsId(Map<String, Object> params);
+
     ProductStoreRelaEntity queryByStoreIdProductId(@Param("storeId") Long storeId, @Param("productId") Long productId);
 
     ProductStoreRelaEntity queryByGoodsIdAndStoreId(@Param("storeId") Long storeId, @Param("goodsId") Long goodsId);

+ 5 - 5
kmall-admin/src/main/java/com/kmall/admin/dto/GoodsDto.java

@@ -115,14 +115,14 @@ public class GoodsDto implements Serializable {
     //热销
     private String isHotStr;
 
-    private String merchSn;
+    private String thirdPartyMerchCode;
 
-    public String getMerchSn() {
-        return merchSn;
+    public String getThirdPartyMerchCode() {
+        return thirdPartyMerchCode;
     }
 
-    public void setMerchSn(String merchSn) {
-        this.merchSn = merchSn;
+    public void setThirdPartyMerchCode(String thirdPartyMerchCode) {
+        this.thirdPartyMerchCode = thirdPartyMerchCode;
     }
 
     public Integer getStoreId() {

+ 18 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/BrandEntity.java

@@ -46,6 +46,24 @@ public class BrandEntity implements Serializable {
 
     private String storeName;
     private String merchName;
+    private Integer categoryId;
+    private String categoryName;
+
+    public String getCategoryName() {
+        return categoryName;
+    }
+
+    public void setCategoryName(String categoryName) {
+        this.categoryName = categoryName;
+    }
+
+    public Integer getCategoryId() {
+        return categoryId;
+    }
+
+    public void setCategoryId(Integer categoryId) {
+        this.categoryId = categoryId;
+    }
 
     public String getStoreName() {
         return storeName;

+ 53 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/ProductStoreRelaEntity.java

@@ -4,7 +4,9 @@ import com.kmall.common.utils.Constant;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 实体
@@ -87,6 +89,57 @@ public class ProductStoreRelaEntity implements Serializable {
 
     private String goodsMerchSn;
 
+    private Integer categoryId;
+
+    private Integer brandId;
+
+    private Integer freightId;
+
+    //属性类别
+    private Integer attributeCategory;
+
+    List<GoodsAttributeEntity> attributeEntityList = new ArrayList<>();
+
+    public Integer getFreightId() {
+        return freightId;
+    }
+
+    public void setFreightId(Integer freightId) {
+        this.freightId = freightId;
+    }
+
+    public Integer getCategoryId() {
+        return categoryId;
+    }
+
+    public void setCategoryId(Integer categoryId) {
+        this.categoryId = categoryId;
+    }
+
+    public Integer getBrandId() {
+        return brandId;
+    }
+
+    public void setBrandId(Integer brandId) {
+        this.brandId = brandId;
+    }
+
+    public Integer getAttributeCategory() {
+        return attributeCategory;
+    }
+
+    public void setAttributeCategory(Integer attributeCategory) {
+        this.attributeCategory = attributeCategory;
+    }
+
+    public List<GoodsAttributeEntity> getAttributeEntityList() {
+        return attributeEntityList;
+    }
+
+    public void setAttributeEntityList(List<GoodsAttributeEntity> attributeEntityList) {
+        this.attributeEntityList = attributeEntityList;
+    }
+
     public String getGoodsMerchSn() {
         return goodsMerchSn;
     }

+ 1 - 1
kmall-admin/src/main/java/com/kmall/admin/service/GoodsService.java

@@ -25,7 +25,7 @@ public interface GoodsService {
      */
     GoodsEntity queryObject(Integer id);
 
-    GoodsEntity queryObjectByProdBarcodeAndBizType(String prodBarcode);
+    GoodsEntity queryObjectByProdBarcodeAndBizType(String prodBarcode, Integer storeId);
     /**
      * 分页查询
      *

+ 3 - 3
kmall-admin/src/main/java/com/kmall/admin/service/ProductService.java

@@ -23,12 +23,12 @@ public interface ProductService {
     ProductEntity queryObject(Integer id);
 
     /**
-     * 根据编码查询产品
+     * 根据查询产品
      *
-     * @param goodsSn
+     * @param goodsId
      * @return 实体
      */
-    ProductEntity queryObjectBySn(String goodsSn);
+    ProductEntity queryObjectByGoodsId(String goodsId);
 
     /**
      * 分页查询

+ 3 - 0
kmall-admin/src/main/java/com/kmall/admin/service/ProductStoreRelaService.java

@@ -22,6 +22,9 @@ public interface ProductStoreRelaService {
      */
     ProductStoreRelaEntity queryObject(Integer id);
 
+    ProductStoreRelaEntity queryObjectByStoreAndGoodsId(Map<String, Object> params);
+
+
     ProductStoreRelaEntity queryByStoreIdProductId(Long storeId, Long productId);
 
     /**

+ 9 - 7
kmall-admin/src/main/java/com/kmall/admin/service/impl/CategoryServiceImpl.java

@@ -3,8 +3,10 @@ package com.kmall.admin.service.impl;
 import com.google.common.collect.ImmutableBiMap;
 import com.kmall.admin.dao.CategoryDao;
 import com.kmall.admin.dao.GoodsDao;
+import com.kmall.admin.dao.ProductStoreRelaDao;
 import com.kmall.admin.entity.CategoryEntity;
 import com.kmall.admin.entity.GoodsEntity;
+import com.kmall.admin.entity.ProductStoreRelaEntity;
 import com.kmall.admin.service.CategoryService;
 import com.kmall.common.constant.Dict;
 import com.kmall.common.utils.MapBeanUtil;
@@ -30,7 +32,7 @@ public class CategoryServiceImpl implements CategoryService {
     @Autowired
     private CategoryDao categoryDao;
     @Autowired
-    private GoodsDao goodsDao;
+    private ProductStoreRelaDao productStoreRelaDao;
 
     @Override
     public CategoryEntity queryObject(Integer id) {
@@ -104,9 +106,9 @@ public class CategoryServiceImpl implements CategoryService {
                         map.clear();
                         map.put("categoryId", categoryEntity.getId());
                         map.put("isDelete", Dict.isDelete.item_1.getItem());
-                        List<GoodsEntity> goodsEntityList = goodsDao.queryList(map);
-                        if (goodsEntityList != null) {
-                            goodsTotal += goodsEntityList.size();
+                        List<ProductStoreRelaEntity> storeRelaEntityList = productStoreRelaDao.queryList(map);
+                        if (storeRelaEntityList != null) {
+                            goodsTotal += storeRelaEntityList.size();
                         }
                     }
 
@@ -121,9 +123,9 @@ public class CategoryServiceImpl implements CategoryService {
             } else{
                 map.clear();
                 map.put("categoryId",id);
-                List<GoodsEntity> goodsEntityList = goodsDao.queryList(map);
-                if (goodsEntityList != null && goodsEntityList.size() > 0) {
-                    throw new RRException("【" + category.getName() + "】商品类型下还有【" + goodsEntityList.size() + "】个商品,无法删除!");
+                List<ProductStoreRelaEntity> storeRelaEntityList = productStoreRelaDao.queryList(map);
+                if (storeRelaEntityList != null && storeRelaEntityList.size() > 0) {
+                    throw new RRException("【" + category.getName() + "】商品类型下还有【" + storeRelaEntityList.size() + "】个商品,无法删除!");
                 }
             }
 

+ 80 - 70
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java

@@ -60,24 +60,26 @@ public class GoodsServiceImpl implements GoodsService {
     private ExportExceptionDataDao exportExceptionDataDao;
     @Autowired
     private CartDao cartDao;
+    @Autowired
+    private ThirdMerchantBizDao thirdMerchantBizDao;
 
     @Override
     public GoodsEntity queryObject(Integer id) {
         Map<String, Object> map = new HashMap<String, Object>();
         map.put("goodsId", id);
-        List<GoodsAttributeEntity> attributeEntities = goodsAttributeDao.queryList(map);
+//        List<GoodsAttributeEntity> attributeEntities = goodsAttributeDao.queryList(map);
         List<ProductEntity> productEntityList = productDao.queryList(map);
         GoodsEntity entity = goodsDao.queryObject(id);
-        entity.setAttributeEntityList(attributeEntities);
+//        entity.setAttributeEntityList(attributeEntities);
         entity.setProductEntityList(productEntityList);
         return entity;
     }
 
     @Override
-    public GoodsEntity queryObjectByProdBarcodeAndBizType(String prodBarcode){
+    public GoodsEntity queryObjectByProdBarcodeAndBizType(String prodBarcode, Integer storeId){
         Map<String, Object> map = new HashMap<String, Object>();
         map.put("prodBarcode", prodBarcode);
-        GoodsEntity entity = goodsDao.queryObjectByProdBarcodeAndBizType(prodBarcode);
+        GoodsEntity entity = goodsDao.queryObjectByProdBarcodeAndBizType(prodBarcode, storeId);
         return entity;
     }
     @Override
@@ -102,16 +104,16 @@ public class GoodsServiceImpl implements GoodsService {
         ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
         builder.put("merchSn", "商户编号");
         builder.put("thirdPartyMerchCode", "第三方商户编号");
-        builder.put("attributeCategory", "商品分类");
-        builder.put("categoryId", "商品二级分类");
+//        builder.put("attributeCategory", "商品分类");
+//        builder.put("categoryId", "商品二级分类");
         builder.put("goodsSn", "商品编码");
         builder.put("name", "商品名称");
         builder.put("goodsUnit", "商品单位");
         builder.put("prodBarcode", "产品条码");
         builder.put("goodsBizType", "货品业务类型");
-        builder.put("brandId", "品牌");
+//        builder.put("brandId", "品牌");
         builder.put("supplierId", "供应商");
-        builder.put("freightId", "运费模版");
+//        builder.put("freightId", "运费模版");
         builder.put("primaryPicUrl", "商品主图");
         builder.put("listPicUrl", "商品列表图");
         builder.put("goodsDesc", "商品描述");
@@ -167,7 +169,7 @@ public class GoodsServiceImpl implements GoodsService {
                 || Dict.orderBizType.item_10.getItem().equals(goods.getGoodsBizType())) {
             goods.setIsHot(0);
         }
-        goods.setAttributeCategory(categoryDao.queryObject(goods.getCategoryId()).getParentId());
+//        goods.setAttributeCategory(categoryDao.queryObject(goods.getCategoryId()).getParentId());
         goods.setAddTime(new Date());
         goods.setIsDelete(Integer.parseInt(Dict.isDelete.item_0.getItem()));
         goods.setIsNew(0);
@@ -198,7 +200,7 @@ public class GoodsServiceImpl implements GoodsService {
             galleryEntity.setFileType("1");//视频
             goodsGalleryDao.save(galleryEntity);
         }
-
+/*
         // 添加商品参数
         List<GoodsAttributeEntity> attributeEntityList = goods.getAttributeEntityList();
         if (attributeEntityList != null && attributeEntityList.size() > 0) {
@@ -215,7 +217,7 @@ public class GoodsServiceImpl implements GoodsService {
                     }
                 }
             }
-        }
+        }*/
 
         // 添加产品
         ProductEntity product = new ProductEntity();
@@ -244,16 +246,16 @@ public class GoodsServiceImpl implements GoodsService {
         ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
         builder.put("merchSn", "商户编号");
         builder.put("thirdPartyMerchCode", "第三方商户编号");
-        builder.put("attributeCategory", "商品分类");
-        builder.put("categoryId", "商品二级分类");
+//        builder.put("attributeCategory", "商品分类");
+//        builder.put("categoryId", "商品二级分类");
         builder.put("goodsSn", "商品编码");
         builder.put("name", "商品名称");
         builder.put("goodsUnit", "商品单位");
         builder.put("prodBarcode", "产品条码");
         builder.put("goodsBizType", "货品业务类型");
-        builder.put("brandId", "品牌");
+//        builder.put("brandId", "品牌");
         builder.put("supplierId", "供应商");
-        builder.put("freightId", "运费模版");
+//        builder.put("freightId", "运费模版");
         builder.put("primaryPicUrl", "商品主图");
         builder.put("listPicUrl", "商品列表图");
         builder.put("goodsDesc", "商品描述");
@@ -310,7 +312,7 @@ public class GoodsServiceImpl implements GoodsService {
                 || Dict.orderBizType.item_10.getItem().equals(goods.getGoodsBizType())) {
             goods.setIsHot(0);
         }
-        goods.setAttributeCategory(categoryDao.queryObject(goods.getCategoryId()).getParentId());
+//        goods.setAttributeCategory(categoryDao.queryObject(goods.getCategoryId()).getParentId());
         goods.setIsDelete(Integer.parseInt(Dict.isDelete.item_0.getItem()));
         goods.setIsNew(0);
         goods.setUpdateUserId(user.getUserId());
@@ -392,8 +394,7 @@ public class GoodsServiceImpl implements GoodsService {
             goodsGalleryDao.save(galleryEntity);
         }
 
-
-        // 修改商品参数
+        /*// 修改商品参数
         List<GoodsAttributeEntity> attributeEntityList = goods.getAttributeEntityList();
         if (attributeEntityList != null && attributeEntityList.size() > 0) {
             for (GoodsAttributeEntity item : attributeEntityList) {
@@ -414,10 +415,10 @@ public class GoodsServiceImpl implements GoodsService {
                     goodsAttributeDao.delete(item.getId());
                 }
             }
-        }
+        }*/
 
         // 修改产品
-        ProductEntity product = productDao.queryObjectBySn(goods.getGoodsSn());
+        ProductEntity product = productDao.queryObjectByGoodsId(String.valueOf(goods.getId()));
 
         GoodsSpecificationEntity goodsSpecification = new GoodsSpecificationEntity();
         // 保税商品,普通货物暂不添加商品规格
@@ -552,27 +553,31 @@ public class GoodsServiceImpl implements GoodsService {
         SysUserEntity user = ShiroUtils.getUserEntity();
         String merchSn = user.getMerchSn();
         boolean isSuccess = false;
-        List<String> failSameSkuList = new ArrayList<>(), failHotGoodsSnList = new ArrayList<>(), failCateGoodsSnList = new ArrayList<>(),
-                failBrandGoodsSnList = new ArrayList<>(), failFreightGoodsSnList = new ArrayList<>(), failSuppGoodsSnList = new ArrayList<>(),
+        List<String> failSameSkuList = new ArrayList<>(), failHotGoodsSnList = new ArrayList<>(),
+                failSuppGoodsSnList = new ArrayList<>(),
                 failUnitGoodsSnList = new ArrayList<>(), failNationGoodsSnList = new ArrayList<>(),failProdbarGoodsSnList = new ArrayList<>(),
-                failCateL2GoodsSnList = new ArrayList<>(), failTypeGoodsSnList = new ArrayList<>(), failMerchGoodsSnList = new ArrayList<>(),
+                 failTypeGoodsSnList = new ArrayList<>(), failMerchGoodsSnList = new ArrayList<>(),
+//                failCateL2GoodsSnList = new ArrayList<>(),
+//                failCateGoodsSnList = new ArrayList<>(),
+//                failBrandGoodsSnList = new ArrayList<>(),
+//                failFreightGoodsSnList = new ArrayList<>(),
                 failMerchUserGoodsSnList = new ArrayList<>();
         List<String> failGoodsSnList = new ArrayList<>();
         List<String> failGoodsTypeList = new ArrayList<>();
-        List<String> failFreightList = new ArrayList<>();
+//        List<String> failFreightList = new ArrayList<>();
         if (goodsEntityList != null && goodsEntityList.size() > 0) {
             for (int i = 0; i < goodsEntityList.size(); i++) {
                 GoodsDto goodsDto = goodsEntityList.get(i);
                 GoodsEntity goodsEntity = new GoodsEntity();
                 Map<String, Object> valideDate = MapBeanUtil.fromObject(goodsDto);
                 ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
-                builder.put("merchSn", "商户编号");
                 builder.put("goodsSn", "商品编码");
-                builder.put("categoryName", "商品分类");
+                builder.put("thirdPartyMerchCode", "第三方商户代码");
+//                builder.put("categoryName", "商品分类");
                 builder.put("goodsBizType", "货品业务类型");
                 builder.put("name", "商品名称");
-                builder.put("brandName", "商品品牌名称");
-                builder.put("defaultFreight", "运费");
+//                builder.put("brandName", "商品品牌名称");
+//                builder.put("defaultFreight", "运费");
                 builder.put("isOnSaleStr", "上架");
                 builder.put("goodsUnit", "商品单位");
                 builder.put("isHotStr", "热销");
@@ -610,15 +615,17 @@ public class GoodsServiceImpl implements GoodsService {
                         failTypeGoodsSnList.add(goodsDto.getSku());
                     }
                 }
-                if(!user.getRoleType().equalsIgnoreCase(Dict.roleType.item_1.getItem())) {
-                    if (!merchSn.equalsIgnoreCase(goodsDto.getMerchSn())) {
-                        isSuccess = true;
-                        failMerchUserGoodsSnList.add(goodsDto.getGoodsSn());
+                ThirdMerchantBizEntity thirdMerchantBizEntity = thirdMerchantBizDao.getThirdMerchangByCode(goodsDto.getThirdPartyMerchCode());
+                if(thirdMerchantBizEntity != null){
+                    goodsEntity.setMerchSn(thirdMerchantBizEntity.getMerchSn());
+                    goodsEntity.setThirdPartyMerchCode(thirdMerchantBizEntity.getThirdPartyMerchCode());
+
+                    if(!user.getRoleType().equalsIgnoreCase(Dict.roleType.item_1.getItem())) {
+                        if (!merchSn.equalsIgnoreCase(thirdMerchantBizEntity.getMerchSn())) {
+                            isSuccess = true;
+                            failMerchUserGoodsSnList.add(goodsDto.getGoodsSn());
+                        }
                     }
-                }
-                MerchEntity merchEntity = merchDao.findByMerchSn(goodsDto.getMerchSn());
-                if(merchEntity != null){
-                    goodsEntity.setMerchSn(merchEntity.getMerchSn());
                 }else{//商户不存在
                     isSuccess = true;
                     failMerchGoodsSnList.add(goodsDto.getGoodsSn());
@@ -655,8 +662,17 @@ public class GoodsServiceImpl implements GoodsService {
                         failHotGoodsSnList.add(goodsDto.getGoodsSn());
                     }
                 }
+                if(thirdMerchantBizEntity != null) {
+                    SupplierEntity supplierEntity = supplierDao.queryObjectByName(goodsDto.getSupplierName(), thirdMerchantBizEntity.getMerchSn());
+                    if (supplierEntity == null) {
+                        isSuccess = true;
+                        failSuppGoodsSnList.add(goodsDto.getGoodsSn());
+                    } else {
+                        goodsEntity.setSupplierId(supplierEntity.getId());
+                    }
+                }
                 //商品配置校验
-                CategoryEntity categoryEntity = categoryDao.queryObjectByName(goodsDto.getCategoryName(),goodsDto.getMerchSn());
+                /*CategoryEntity categoryEntity = categoryDao.queryObjectByName(goodsDto.getCategoryName(),goodsDto.getMerchSn());
                 if(categoryEntity==null){
                     isSuccess = true;
                     failCateGoodsSnList.add(goodsDto.getGoodsSn());
@@ -684,15 +700,8 @@ public class GoodsServiceImpl implements GoodsService {
                     failFreightList.add(goodsDto.getDefaultFreight());
                 }else {
                     goodsEntity.setFreightId(freightEntity.getId());
-                }
+                }*/
                 if (!Dict.orderBizType.item_11.getItem().equals(goodsDto.getGoodsBizType())) {
-                    SupplierEntity supplierEntity = supplierDao.queryObjectByName(goodsDto.getSupplierName(),goodsDto.getMerchSn());
-                    if (supplierEntity == null) {
-                        isSuccess = true;
-                        failSuppGoodsSnList.add(goodsDto.getGoodsSn());
-                    } else {
-                        goodsEntity.setSupplierId(supplierEntity.getId());
-                    }
                     SysCusUnitCodeEntity sysCusUnitCodeEntity = sysCusUnitCodeDao.queryObjectByName(goodsDto.getUnitName());
                     if (sysCusUnitCodeEntity == null) {
                         isSuccess = true;
@@ -752,29 +761,30 @@ public class GoodsServiceImpl implements GoodsService {
 //                        }
 //                    }
                     // 修改产品
-                    ProductEntity product = productDao.queryObjectBySn(goodsDto.getGoodsSn());
+                    ProductEntity product = productDao.queryObjectByGoodsId(String.valueOf(goodsEntity.getId()));
 
                     GoodsSpecificationEntity goodsSpecification = new GoodsSpecificationEntity();
                     // 保税商品,普通货物暂不添加商品规格
                     if (!Dict.orderBizType.item_11.getItem().equals(goodsDto.getGoodsBizType())) {
                         // 添加商品规格
                         GoodsSpecificationEntity specificationEntity = goodsSpecificationDao.queryByGoodsId(goodsEntity.getId());
-                        if(specificationEntity ==null) {
+                        if(specificationEntity == null) {
                             goodsSpecification.setGoodsId(goodsEntity.getId());
                             goodsSpecification.setValue(goodsEntity.getCiqProdModel());
                             goodsSpecification.setSpecificationId(1);
                             goodsSpecificationDao.save(goodsSpecification);
                         }else {
                             goodsSpecification.setValue(goodsDto.getCiqProdModel());
+                            goodsSpecification.setId(specificationEntity.getId());
                             goodsSpecificationDao.update(goodsSpecification);
                         }
+                        product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
+                        product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
                     }
 
                     if(product == null){
                         product = new ProductEntity();
                         product.setGoodsSn(goodsDto.getGoodsSn());
-                        product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
-                        product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
                         product.setGoodsId(goodsEntity.getId());
                         product.setGoodsDefault(0);
                         product.setGoodsNumber(goodsEntity.getGoodsNumber());
@@ -804,7 +814,7 @@ public class GoodsServiceImpl implements GoodsService {
                 throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
             if(failMerchGoodsSnList != null && failMerchGoodsSnList.size() > 0){
-                exportExceptionDataEntity.setExportExceptionData("商户编号不存在,请检查商品编码【"+failMerchGoodsSnList+"】的商品信息,请先维护用户商户编号信息再继续操作!");
+                exportExceptionDataEntity.setExportExceptionData("第三方商户代码不存在,请在商城配置》第三方商户管理中维护,请检查商品编码【"+failMerchGoodsSnList+"】的商品信息,请先维护再继续操作!");
                 exportExceptionDataDao.save(exportExceptionDataEntity);
                 throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
@@ -836,26 +846,26 @@ public class GoodsServiceImpl implements GoodsService {
                 exportExceptionDataDao.save(exportExceptionDataEntity);
                 throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
-            if(failCateGoodsSnList != null && failCateGoodsSnList.size() > 0){
-                exportExceptionDataEntity.setExportExceptionData("分类信息请在商城配置》商品分类中维护,商品分类与商户信息对应,请检查该商品商户信息下的分类是否维护,不存在的商品编码【"+failCateGoodsSnList+"】");
-                exportExceptionDataDao.save(exportExceptionDataEntity);
-                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
-            }
-            if(failCateL2GoodsSnList != null && failCateL2GoodsSnList.size() > 0){
-                exportExceptionDataEntity.setExportExceptionData("分类信息请在商城配置》商品分类中查看,商品分类必须为二级分类,不存在的商品编码【"+failCateL2GoodsSnList+"】");
-                exportExceptionDataDao.save(exportExceptionDataEntity);
-                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
-            }
-            if(failBrandGoodsSnList != null && failBrandGoodsSnList.size() > 0){
-                exportExceptionDataEntity.setExportExceptionData("品牌信息请在商城配置》品牌制造商中维护,品牌与商户信息对应,请检查该商品商户信息下的品牌是否维护,不存在的商品编码【" + failBrandGoodsSnList + "】");
-                exportExceptionDataDao.save(exportExceptionDataEntity);
-                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
-            }
-            if(failFreightGoodsSnList != null && failFreightGoodsSnList.size() > 0){
-                exportExceptionDataEntity.setExportExceptionData("运费信息请在商城配置》运费模板中维护,运费与商户信息对应,请检查该商品商户信息下的运费是否维护,不存在的商品编码【"+failFreightGoodsSnList+"】,运费【"+failFreightList+"】");
-                exportExceptionDataDao.save(exportExceptionDataEntity);
-                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
-            }
+//            if(failCateGoodsSnList != null && failCateGoodsSnList.size() > 0){
+//                exportExceptionDataEntity.setExportExceptionData("分类信息请在商城配置》商品分类中维护,商品分类与商户信息对应,请检查该商品商户信息下的分类是否维护,不存在的商品编码【"+failCateGoodsSnList+"】");
+//                exportExceptionDataDao.save(exportExceptionDataEntity);
+//                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
+//            }
+//            if(failCateL2GoodsSnList != null && failCateL2GoodsSnList.size() > 0){
+//                exportExceptionDataEntity.setExportExceptionData("分类信息请在商城配置》商品分类中查看,商品分类必须为二级分类,不存在的商品编码【"+failCateL2GoodsSnList+"】");
+//                exportExceptionDataDao.save(exportExceptionDataEntity);
+//                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
+//            }
+//            if(failBrandGoodsSnList != null && failBrandGoodsSnList.size() > 0){
+//                exportExceptionDataEntity.setExportExceptionData("品牌信息请在商城配置》品牌制造商中维护,品牌与商户信息对应,请检查该商品商户信息下的品牌是否维护,不存在的商品编码【" + failBrandGoodsSnList + "】");
+//                exportExceptionDataDao.save(exportExceptionDataEntity);
+//                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
+//            }
+//            if(failFreightGoodsSnList != null && failFreightGoodsSnList.size() > 0){
+//                exportExceptionDataEntity.setExportExceptionData("运费信息请在商城配置》运费模板中维护,运费与商户信息对应,请检查该商品商户信息下的运费是否维护,不存在的商品编码【"+failFreightGoodsSnList+"】,运费【"+failFreightList+"】");
+//                exportExceptionDataDao.save(exportExceptionDataEntity);
+//                throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
+//            }
             if(failSuppGoodsSnList != null && failSuppGoodsSnList.size() > 0){
                 exportExceptionDataEntity.setExportExceptionData("供应商信息请在商城配置》商品供应商中维护,供应商与商户信息对应,请检查该商品商户信息下的供应商是否维护,不存在的商品编码【" + failSuppGoodsSnList + "】");
                 exportExceptionDataDao.save(exportExceptionDataEntity);

+ 2 - 2
kmall-admin/src/main/java/com/kmall/admin/service/impl/ProductServiceImpl.java

@@ -31,8 +31,8 @@ public class ProductServiceImpl implements ProductService {
     }
 
     @Override
-    public ProductEntity queryObjectBySn(String goodsSn) {
-        return productDao.queryObjectBySn(goodsSn);
+    public ProductEntity queryObjectByGoodsId(String goodsId) {
+        return productDao.queryObjectByGoodsId(goodsId);
     }
 
     @Override

+ 69 - 30
kmall-admin/src/main/java/com/kmall/admin/service/impl/ProductStoreRelaServiceImpl.java

@@ -43,10 +43,26 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
     private FreightDao freightDao;
     @Autowired
     private CategoryDao categoryDao;
+    @Autowired
+    private GoodsAttributeDao goodsAttributeDao;
+    @Autowired
+    private AttributeDao attributeDao;
 
     @Override
     public ProductStoreRelaEntity queryObject(Integer id) {
-        return productStoreRelaDao.queryObject(id);
+        ProductStoreRelaEntity productStoreRelaEntity = productStoreRelaDao.queryObject(id);
+
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("goodsId", productStoreRelaEntity.getGoodsId());
+        List<GoodsAttributeEntity> attributeEntities = goodsAttributeDao.queryList(map);
+        productStoreRelaEntity.setAttributeEntityList(attributeEntities);
+
+        return productStoreRelaEntity;
+    }
+
+    @Override
+    public ProductStoreRelaEntity queryObjectByStoreAndGoodsId(Map<String, Object> params){
+        return productStoreRelaDao.queryObjectByStoreAndGoodsId(params);
     }
 
     @Override
@@ -72,6 +88,10 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
         builder.put("storeId", "门店");
         builder.put("goodsId", "商品");
         builder.put("stockNum", "库存");
+        builder.put("attributeCategory", "一级分类");
+        builder.put("categoryId", "二级分类");
+        builder.put("brandId", "品牌");
+        builder.put("freightId", "运费模版");
 
         R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
         if (Integer.valueOf(r.get("code").toString()) != 0) {
@@ -90,18 +110,6 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
             }
 
             //商品配置校验
-            List<CategoryEntity> categoryEntity = categoryDao.queryObjectByStoreId(productStoreRela.getStoreId());
-            if(categoryEntity == null || categoryEntity.size() == 0){
-                throw new RRException("该门店商品类型没有数据!请先在商品配置》商品类型中维护门店编号为【"+productStoreRela.getStoreId()+"】的商品类型信息,再来操作门店商品数据");
-            }
-            List<BrandEntity> brandEntity = brandDao.queryObjectByStoreId(productStoreRela.getStoreId());
-            if(brandEntity == null || brandEntity.size() == 0){
-                throw new RRException("该门店商品品牌没有数据!请先在商品配置》品牌制造商中维护门店编号为【"+productStoreRela.getStoreId()+"】的品牌信息,再来操作门店商品数据");
-            }
-            List<FreightEntity> freightEntity = freightDao.queryObjectByStoreId(productStoreRela.getStoreId());
-            if(freightEntity == null || freightEntity.size() == 0){
-                throw new RRException("该门店商品运费没有数据!请先在商品配置》运费模板中维护门店编号为【"+productStoreRela.getStoreId()+"】的商品运费信息,再来操作门店商品数据");
-            }
             if(!StringUtils.isNotEmpty(goodsEntity.getListPicUrl())){
                 throw new RRException("该商品列表图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品列表图信息,再来操作门店商品数据");
             }
@@ -113,7 +121,6 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
                 throw new RRException("该商品轮播图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品详情轮播图信息,再来操作门店商品数据");
             }
         }
-
         if(!goodsEntity.getMerchSn().equalsIgnoreCase(productStoreRela.getMerchSn())) {
             throw new RRException("该商品所属商户不属于该门店所属商户!");
         }
@@ -126,7 +133,7 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
         }
 
         SysUserEntity user = ShiroUtils.getUserEntity();
-        ProductEntity product = productDao.queryObjectBySn(goodsEntity.getGoodsSn());
+        ProductEntity product = productDao.queryObjectByGoodsId(String.valueOf(goodsEntity.getId()));
 
 //        GoodsEntity goods = new GoodsEntity();
 //        goods.setRetailPrice(productStoreRela.getRetailPrice());
@@ -154,6 +161,25 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
             productStoreRela.setMarketPrice(goodsEntity.getMarketPrice());
         }*/
 
+        // 添加商品参数
+        List<GoodsAttributeEntity> attributeEntityList = productStoreRela.getAttributeEntityList();
+        if (attributeEntityList != null && attributeEntityList.size() > 0) {
+            for (GoodsAttributeEntity item : attributeEntityList) {
+                if (item.getIsDelete() == 0) {
+                    if (item.getId() == null && item.getAttributeId() != null && com.kmall.common.utils.StringUtils.isNotEmpty(item.getValue())) {
+                        item.setGoodsId(goodsEntity.getId());
+                        item.setMerchSn(goodsEntity.getMerchSn());
+                        goodsAttributeDao.save(item);
+                    } else if (item.getId() == null && item.getAttributeId() != null && com.kmall.common.utils.StringUtils.isNullOrEmpty(item.getValue())) {
+                        throw new RRException("商品属性【" + attributeDao.queryObject(item.getAttributeId()).getName() + "】值不能为空!");
+                    } else if (item.getId() == null && item.getAttributeId() == null) {
+                        continue;
+                    }
+                }
+            }
+        }
+
+        productStoreRela.setAttributeCategory(categoryDao.queryObject(productStoreRela.getCategoryId()).getParentId());
         productStoreRela.setProductId(product.getId());
         productStoreRela.setGoodsBizType(goodsEntity.getGoodsBizType());
         productStoreRela.setSku(goodsEntity.getSku());
@@ -177,6 +203,10 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
         builder.put("storeId", "门店");
         builder.put("goodsId", "商品");
         builder.put("stockNum", "库存");
+        builder.put("attributeCategory", "一级分类");
+        builder.put("categoryId", "二级分类");
+        builder.put("brandId", "品牌");
+        builder.put("freightId", "运费模版");
 
         R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
         if (Integer.valueOf(r.get("code").toString()) != 0) {
@@ -194,19 +224,6 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
                 throw new RRException(r.get("msg").toString());
             }
         }
-        //商品配置校验
-        List<CategoryEntity> categoryEntity = categoryDao.queryObjectByStoreId(productStoreRela.getStoreId());
-        if(categoryEntity == null || categoryEntity.size() == 0){
-            throw new RRException("该门店商品类型没有数据!请先在商品配置》商品类型中维护门店编号为【"+productStoreRela.getStoreId()+"】的商品类型信息,再来操作门店商品数据");
-        }
-        List<BrandEntity> brandEntity = brandDao.queryObjectByStoreId(productStoreRela.getStoreId());
-        if(brandEntity == null || brandEntity.size() == 0){
-            throw new RRException("该门店商品品牌没有数据!请先在商品配置》品牌制造商中维护门店编号为【"+productStoreRela.getStoreId()+"】的品牌信息,再来操作门店商品数据");
-        }
-        List<FreightEntity> freightEntity = freightDao.queryObjectByStoreId(productStoreRela.getStoreId());
-        if(freightEntity == null || freightEntity.size() == 0){
-            throw new RRException("该门店商品运费没有数据!请先在商品配置》运费模板中维护门店编号为【"+productStoreRela.getStoreId()+"】的商品运费信息,再来操作门店商品数据");
-        }
 
         if(!goodsEntity.getMerchSn().equalsIgnoreCase(productStoreRela.getMerchSn())) {
             throw new RRException("该商品所属商户不属于该门店所属商户!");
@@ -234,12 +251,33 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
             goodsSpecificationDao.update(goodsSpecification);
 
             // 修改产品
-            ProductEntity product = productDao.queryObjectBySn(goodsEntity.getGoodsSn());
+            ProductEntity product = productDao.queryObjectByGoodsId(String.valueOf(goodsEntity.getId()));
             product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
             product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
             productDao.update(product);
         }
-
+        // 修改商品参数
+        List<GoodsAttributeEntity> attributeEntityList = productStoreRela.getAttributeEntityList();
+        if (attributeEntityList != null && attributeEntityList.size() > 0) {
+            for (GoodsAttributeEntity item : attributeEntityList) {
+                if (item.getIsDelete() == 0) {
+                    if (item.getId() != null) {
+                        item.setMerchSn(goodsEntity.getMerchSn());
+                        goodsAttributeDao.update(item);
+                    } else if (item.getId() == null && item.getAttributeId() != null && com.kmall.common.utils.StringUtils.isNotEmpty(item.getValue())) {
+                        item.setMerchSn(goodsEntity.getMerchSn());
+                        item.setGoodsId(goodsEntity.getId());
+                        goodsAttributeDao.save(item);
+                    } else if (item.getId() == null && item.getAttributeId() != null && com.kmall.common.utils.StringUtils.isNullOrEmpty(item.getValue())) {
+                        throw new RRException("商品属性【" + attributeDao.queryObject(item.getAttributeId()).getName() + "】值不能为空!");
+                    } else if (item.getId() == null && item.getAttributeId() == null) {
+                        continue;
+                    }
+                } else if (item.getIsDelete() == 1) {
+                    goodsAttributeDao.delete(item.getId());
+                }
+            }
+        }
         Map cartMap = new HashMap();
         cartMap.put("goodsId",goodsEntity.getId());
         List<CartEntity> cartList = cartDao.queryList(cartMap);
@@ -255,6 +293,7 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
             }
         }
 
+        productStoreRela.setAttributeCategory(categoryDao.queryObject(productStoreRela.getCategoryId()).getParentId());
         productStoreRela.setModerSn(user.getUserId().toString());
         productStoreRela.setModTime(new Date());
         productStoreRela.setGoodsBizType(goodsEntity.getGoodsBizType());

+ 11 - 11
kmall-admin/src/main/resources/XmlTemplate/GeneralGoodsDtoList.xml

@@ -6,17 +6,17 @@
               varType="com.kmall.admin.dto.GoodsDto">
             <section startRow="1" endRow="1">
                 <mapping row="1" col="0">GoodsDto.goodsSn</mapping>
-                <mapping row="1" col="1">GoodsDto.merchSn</mapping>
-                <mapping row="1" col="2">GoodsDto.categoryName</mapping>
-                <mapping row="1" col="3">GoodsDto.goodsBizType</mapping>
-                <mapping row="1" col="4">GoodsDto.name</mapping>
-                <mapping row="1" col="5">GoodsDto.prodBarcode</mapping>
-                <mapping row="1" col="6">GoodsDto.supplierName</mapping>
-                <mapping row="1" col="7">GoodsDto.brandName</mapping>
-                <mapping row="1" col="8">GoodsDto.defaultFreight</mapping>
-                <mapping row="1" col="9">GoodsDto.isOnSaleStr</mapping>
-                <mapping row="1" col="10">GoodsDto.goodsUnit</mapping>
-                <mapping row="1" col="11">GoodsDto.isHotStr</mapping>
+                <mapping row="1" col="1">GoodsDto.thirdPartyMerchCode</mapping>
+                <!--<mapping row="1" col="2">GoodsDto.categoryName</mapping>-->
+                <mapping row="1" col="2">GoodsDto.goodsBizType</mapping>
+                <mapping row="1" col="3">GoodsDto.name</mapping>
+                <mapping row="1" col="4">GoodsDto.prodBarcode</mapping>
+                <mapping row="1" col="5">GoodsDto.supplierName</mapping>
+                <!--<mapping row="1" col="7">GoodsDto.brandName</mapping>-->
+                <!--<mapping row="1" col="8">GoodsDto.defaultFreight</mapping>-->
+                <mapping row="1" col="6">GoodsDto.isOnSaleStr</mapping>
+                <mapping row="1" col="7">GoodsDto.goodsUnit</mapping>
+                <mapping row="1" col="8">GoodsDto.isHotStr</mapping>
                 <!--<mapping row="1" col="12">GoodsDto.marketPrice</mapping>-->
                 <!--<mapping row="1" col="13">GoodsDto.retailPrice</mapping>-->
             </section>

+ 20 - 20
kmall-admin/src/main/resources/XmlTemplate/GoodsDtoList.xml

@@ -6,28 +6,28 @@
               varType="com.kmall.admin.dto.GoodsDto">
             <section startRow="1" endRow="1">
                 <mapping row="1" col="0">GoodsDto.goodsSn</mapping>
-                <mapping row="1" col="1">GoodsDto.merchSn</mapping>
-                <mapping row="1" col="2">GoodsDto.categoryName</mapping>
-                <mapping row="1" col="3">GoodsDto.goodsBizType</mapping>
-                <mapping row="1" col="4">GoodsDto.name</mapping>
-                <mapping row="1" col="5">GoodsDto.prodBarcode</mapping>
-                <mapping row="1" col="6">GoodsDto.supplierName</mapping>
-                <mapping row="1" col="7">GoodsDto.sku</mapping>
-                <mapping row="1" col="8">GoodsDto.brandName</mapping>
-                <mapping row="1" col="9">GoodsDto.defaultFreight</mapping>
-                <mapping row="1" col="10">GoodsDto.isOnSaleStr</mapping>
-                <mapping row="1" col="11">GoodsDto.goodsUnit</mapping>
-                <mapping row="1" col="12">GoodsDto.isHotStr</mapping>
-                <mapping row="1" col="13">GoodsDto.cusGoodsCode</mapping>
-                <mapping row="1" col="14">GoodsDto.ciqProdModel</mapping>
-                <mapping row="1" col="15">GoodsDto.goodsRate</mapping>
+                <mapping row="1" col="1">GoodsDto.thirdPartyMerchCode</mapping>
+                <!--<mapping row="1" col="2">GoodsDto.categoryName</mapping>-->
+                <mapping row="1" col="2">GoodsDto.goodsBizType</mapping>
+                <mapping row="1" col="3">GoodsDto.name</mapping>
+                <mapping row="1" col="4">GoodsDto.prodBarcode</mapping>
+                <mapping row="1" col="5">GoodsDto.supplierName</mapping>
+                <mapping row="1" col="6">GoodsDto.sku</mapping>
+                <!--<mapping row="1" col="8">GoodsDto.brandName</mapping>-->
+                <!--<mapping row="1" col="7">GoodsDto.defaultFreight</mapping>-->
+                <mapping row="1" col="7">GoodsDto.isOnSaleStr</mapping>
+                <mapping row="1" col="8">GoodsDto.goodsUnit</mapping>
+                <mapping row="1" col="9">GoodsDto.isHotStr</mapping>
+                <mapping row="1" col="10">GoodsDto.cusGoodsCode</mapping>
+                <mapping row="1" col="11">GoodsDto.ciqProdModel</mapping>
+                <mapping row="1" col="12">GoodsDto.goodsRate</mapping>
                 <!--<mapping row="1" col="16">GoodsDto.marketPrice</mapping>-->
                 <!--<mapping row="1" col="17">GoodsDto.retailPrice</mapping>-->
-                <mapping row="1" col="16">GoodsDto.brand</mapping>
-                <mapping row="1" col="17">GoodsDto.unitName</mapping>
-                <mapping row="1" col="18">GoodsDto.oriCntName</mapping>
-                <mapping row="1" col="19">GoodsDto.cusDeclEle</mapping>
-                <mapping row="1" col="20">GoodsDto.cusRecCode</mapping>
+                <mapping row="1" col="13">GoodsDto.brand</mapping>
+                <mapping row="1" col="14">GoodsDto.unitName</mapping>
+                <mapping row="1" col="15">GoodsDto.oriCntName</mapping>
+                <mapping row="1" col="16">GoodsDto.cusDeclEle</mapping>
+                <mapping row="1" col="17">GoodsDto.cusRecCode</mapping>
             </section>
             <loopbreakcondition>
                 <rowcheck offset="0">

+ 30 - 8
kmall-admin/src/main/resources/mybatis/mapper/BrandDao.xml

@@ -20,6 +20,8 @@
         <result property="newSortOrder" column="new_sort_order"/>
         <result property="storeName" column="storeName"/>
         <result column="merchName" property="merchName" />
+        <result column="category_id" property="categoryId" />
+        <result column="categoryName" property="categoryName" />
     </resultMap>
 
     <select id="queryObject" resultType="com.kmall.admin.entity.BrandEntity">
@@ -37,7 +39,8 @@
 			`app_list_pic_url`,
 			`is_new`,
 			`new_pic_url`,
-			`new_sort_order`
+			`new_sort_order`,
+			category_id
 		from mall_brand
 		where id = #{id}
 	</select>
@@ -58,6 +61,7 @@
         `is_new`,
         `new_pic_url`,
         `new_sort_order`,
+        b.category_id
         s.store_name storeName,
         m.merch_name merchName
         from mall_brand b
@@ -65,7 +69,10 @@
         left join mall_merch m on b.merch_sn = m.merch_sn
         where `name` = #{brandName}
         <if test="merchSn != null and merchSn.trim() != ''">
-            AND merch_sn = #{merchSn}
+            AND b.merch_sn = #{merchSn}
+        </if>
+        <if test="categoryId != null">
+            AND b.category_id = #{categoryId}
         </if>
     </select>
 
@@ -92,11 +99,17 @@
         `new_pic_url`,
         b.new_sort_order,
         s.store_name storeName,
-        m.merch_name merchName
+        m.merch_name merchName,
+        cg.name categoryName,
+        b.category_id
         from mall_brand b
         left join mall_store s on b.store_id = s.id
         left join mall_merch m on b.merch_sn = m.merch_sn
+        LEFT JOIN mall_category cg ON b.category_id = cg.id
         WHERE 1=1
+        <if test="categoryId != null and categoryId != ''">
+            AND b.category_id = #{categoryId}
+        </if>
         <if test="storeId != null and storeId != ''">
             AND b.store_id = #{storeId}
         </if>
@@ -120,13 +133,19 @@
     </select>
 
     <select id="queryTotal" resultType="int">
-        select count(*) from mall_brand
+        select count(*) from mall_brand b
+        left join mall_store s on b.store_id = s.id
+        left join mall_merch m on b.merch_sn = m.merch_sn
+        LEFT JOIN mall_category cg ON b.category_id = cg.id
         WHERE 1=1
+        <if test="categoryId != null and categoryId != ''">
+            AND b.category_id = #{categoryId}
+        </if>
         <if test="storeId != null and storeId != ''">
-            AND store_id = #{storeId}
+            AND b.store_id = #{storeId}
         </if>
         <if test="merchSn != null and merchSn.trim() != ''">
-            AND merch_sn = #{merchSn}
+            AND b.merch_sn = #{merchSn}
         </if>
         <if test="name != null and name.trim() != ''">
             AND name LIKE concat('%',#{name},'%')
@@ -147,7 +166,8 @@
 			`app_list_pic_url`,
 			`is_new`,
 			`new_pic_url`,
-			`new_sort_order`)
+			`new_sort_order`,
+            category_id)
 		values(
 			#{name},
 			#{storeId},
@@ -161,7 +181,8 @@
 			#{appListPicUrl},
 			#{isNew},
 			#{newPicUrl},
-			#{newSortOrder})
+			#{newSortOrder},
+            #{categoryId})
 	</insert>
 
     <update id="update" parameterType="com.kmall.admin.entity.BrandEntity">
@@ -179,6 +200,7 @@
             <if test="appListPicUrl != null">`app_list_pic_url` = #{appListPicUrl},</if>
             <if test="isNew != null">`is_new` = #{isNew},</if>
             <if test="newPicUrl != null">`new_pic_url` = #{newPicUrl},</if>
+            <if test="categoryId != null">`category_id` = #{categoryId},</if>
             <if test="newSortOrder != null">`new_sort_order` = #{newSortOrder}</if>
         </set>
         where id = #{id}

+ 16 - 52
kmall-admin/src/main/resources/mybatis/mapper/GoodsDao.xml

@@ -6,11 +6,11 @@
     <resultMap type="com.kmall.admin.entity.GoodsEntity" id="goodsMap">
         <result property="id" column="id"/>
         <result property="merchSn" column="merch_sn"/>
-        <result property="categoryId" column="category_id"/>
+        <!--<result property="categoryId" column="category_id"/>-->
         <result property="goodsSn" column="goods_sn"/>
         <result property="name" column="name"/>
-        <result property="brandId" column="brand_id"/>
-        <result property="freightId" column="freight_id"/>
+        <!--<result property="brandId" column="brand_id"/>-->
+        <!--<result property="freightId" column="freight_id"/>-->
         <result property="brand" column="brand"/>
         <result property="goodsNumber" column="goods_number"/>
         <result property="keywords" column="keywords"/>
@@ -20,7 +20,7 @@
         <result property="addTime" column="add_time"/>
         <result property="sortOrder" column="sort_order"/>
         <result property="isDelete" column="is_delete"/>
-        <result property="attributeCategory" column="attribute_category"/>
+        <!--<result property="attributeCategory" column="attribute_category"/>-->
         <result property="counterPrice" column="counter_price"/>
         <result property="extraPrice" column="extra_price"/>
         <result property="isNew" column="is_new"/>
@@ -78,12 +78,12 @@
 
     <select id="queryObjectByProdBarcodeAndBizType" resultType="com.kmall.admin.entity.GoodsEntity">
         SELECT
-            a.id,a.sku,a.goods_sn,a.name,a.list_pic_url,a.prod_barcode,r.market_price storeRetailPrice,r.retail_price storeMarketPrice,r.stock_num,s.store_name,r.product_id,s.id 'storeId'
+            a.id,a.sku,a.goods_sn,a.name,a.list_pic_url,a.prod_barcode,r.market_price storeMarketPrice,r.retail_price storeRetailPrice ,r.stock_num,s.store_name,r.product_id,s.id 'storeId'
         FROM
             mall_goods a
         LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
         inner join mall_store s on r.store_id=s.id
-        where a.prod_barcode = #{prodBarcode} and a.goods_biz_type = 11
+        where a.prod_barcode = #{prodBarcode} and a.goods_biz_type = 11 and r.store_id = #{storeId}
     </select>
 
     <select id="queryObjectByProdBarcode" resultType="com.kmall.admin.entity.GoodsEntity">
@@ -114,23 +114,20 @@
     <select id="queryList" resultType="com.kmall.admin.entity.GoodsEntity">
         select
         mall_goods.*,
-        mall_category.name category_name,
-        mall_brand.name brand_name,
-        mall_freight.name freight_name,
         case when mall_goods_group.id > 0 then 2 else 0 end as goodsType,
         m.merch_name merchName
         from mall_goods
         left join mall_merch m on mall_goods.merch_sn = m.merch_sn
-        LEFT JOIN mall_category ON mall_goods.category_id = mall_category.id
-        LEFT JOIN mall_brand ON mall_brand.id = mall_goods.brand_id
         left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
-        left join mall_freight on mall_goods.freight_id = mall_freight.id
         WHERE 1=1
         <!--  数据过滤  -->
         ${filterSql}
         <if test="merchSn != null and merchSn.trim() != ''">
             AND mall_goods.merch_sn = #{merchSn}
         </if>
+        <if test="prodBarcode != null and prodBarcode.trim() != ''">
+            AND mall_goods.prod_barcode = #{prodBarcode}
+        </if>
         <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
             AND mall_goods.third_party_merch_code = #{thirdPartyMerchCode}
         </if>
@@ -140,7 +137,7 @@
         <if test="name != null and name != ''">
             AND mall_goods.name LIKE concat('%',#{name},'%')
         </if>
-        <if test="freightId != null and freightId != ''">
+        <!--<if test="freightId != null and freightId != ''">
             AND mall_goods.freight_id = #{freightId}
         </if>
         <if test="brandId != null and brandId != ''">
@@ -148,16 +145,16 @@
         </if>
         <if test="categoryId != null and categoryId != ''">
             AND mall_goods.category_id = #{categoryId}
-        </if>
+        </if>-->
         <if test="sku != null and sku != ''">
             AND mall_goods.sku LIKE concat('%',#{sku},'%')
         </if>
-        <if test="category != null and category != ''">
+        <!--<if test="category != null and category != ''">
             AND mall_goods.category_id IN (select id from mall_category where parent_id = #{category})
         </if>
         <if test="categoryTwo != null and categoryTwo != ''">
             AND mall_goods.category_id = #{categoryTwo}
-        </if>
+        </if>-->
         <if test="isDelete != null">
             AND mall_goods.is_Delete = #{isDelete}
         </if>
@@ -167,9 +164,9 @@
         <if test="goodsBizType != null and goodsBizType != ''">
             AND mall_goods.goods_biz_type = #{goodsBizType}
         </if>
-        <!--<if test="storeId != null and storeId != ''">-->
-            <!--AND mall_goods.id not in (select goods_id from mall_product_store_rela where store_id = #{storeId})-->
-        <!--</if>-->
+        <if test="storeId != null and storeId != ''">
+            AND mall_goods.id not in (select goods_id from mall_product_store_rela where store_id = #{storeId})
+        </if>
 
         <choose>
             <when test="sidx != null and sidx.trim() != ''">
@@ -187,15 +184,9 @@
     <select id="querySame" resultType="com.kmall.admin.entity.GoodsEntity">
         select
         mall_goods.*,
-        mall_category.name category_name,
-        mall_brand.name brand_name,
-        mall_freight.name freight_name,
         case when mall_goods_group.id > 0 then 2 else 0 end as goodsType
         from mall_goods
-        LEFT JOIN mall_category ON mall_goods.category_id = mall_category.id
-        LEFT JOIN mall_brand ON mall_brand.id = mall_goods.brand_id
         left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
-        left join mall_freight on mall_goods.freight_id = mall_freight.id
         WHERE 1=1
         <!--  数据过滤  -->
         ${filterSql}
@@ -234,24 +225,9 @@
         <if test="name != null and name != ''">
             AND mall_goods.name LIKE concat('%',#{name},'%')
         </if>
-        <if test="freightId != null and freightId != ''">
-            AND mall_goods.freight_id = #{freightId}
-        </if>
-        <if test="brandId != null and brandId != ''">
-            AND mall_goods.brand_id = #{brandId}
-        </if>
-        <if test="categoryId != null and categoryId != ''">
-            AND mall_goods.category_id = #{categoryId}
-        </if>
         <if test="sku != null and sku != ''">
             AND mall_goods.sku LIKE concat('%',#{sku},'%')
         </if>
-        <if test="category != null and category != ''">
-            AND mall_goods.category_id IN (select id from mall_category where parent_id = #{category})
-        </if>
-        <if test="categoryTwo != null and categoryTwo != ''">
-            AND mall_goods.category_id = #{categoryTwo}
-        </if>
         <if test="isDelete != null and isDelete != ''">
             AND mall_goods.is_Delete = #{isDelete}
         </if>
@@ -261,7 +237,6 @@
         insert into mall_goods(
             `merch_sn`,
             third_party_merch_code,
-			`category_id`,
             `supplier_id`,
 			`goods_sn`,
 			`prod_barcode`,
@@ -269,9 +244,7 @@
 			`goods_biz_type`,
 			`name`,
 			`unit_code`,
-			`brand_id`,
 			`brand`,
-			`freight_id`,
 			`goods_number`,
 			`keywords`,
 			`goods_brief`,
@@ -285,7 +258,6 @@
 			`add_time`,
 			`sort_order`,
 			`is_delete`,
-			`attribute_category`,
 			`counter_price`,
 			`extra_price`,
 			`is_new`,
@@ -310,7 +282,6 @@
 		values(
 			#{merchSn},
             #{thirdPartyMerchCode},
-			#{categoryId},
             #{supplierId},
 			#{goodsSn},
 			#{prodBarcode},
@@ -318,9 +289,7 @@
 			#{goodsBizType},
 			#{name},
 			#{unitCode},
-			#{brandId},
 			#{brand},
-			#{freightId},
 			#{goodsNumber},
 			#{keywords},
 			#{goodsBrief},
@@ -334,7 +303,6 @@
 			#{addTime},
 			#{sortOrder},
 			#{isDelete},
-			#{attributeCategory},
 			#{counterPrice},
 			#{extraPrice},
 			#{isNew},
@@ -363,7 +331,6 @@
         <set>
             <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
             <if test="thirdPartyMerchCode != null">`third_party_merch_code` = #{thirdPartyMerchCode}, </if>
-            <if test="categoryId != null">`category_id` = #{categoryId}, </if>
             <if test="supplierId != null">`supplier_id` = #{supplierId}, </if>
             <if test="goodsSn != null">`goods_sn` = #{goodsSn}, </if>
             <if test="prodBarcode != null">`prod_barcode` = #{prodBarcode}, </if>
@@ -371,9 +338,7 @@
             <if test="goodsBizType != null">`goods_biz_type` = #{goodsBizType}, </if>
             <if test="name != null">`name` = #{name}, </if>
             <if test="unitCode != null">`unit_code` = #{unitCode}, </if>
-            <if test="brandId != null">`brand_id` = #{brandId}, </if>
             <if test="brand != null">`brand` = #{brand}, </if>
-            <if test="freightId != null">`freight_id` = #{freightId}, </if>
             <if test="goodsNumber != null">`goods_number` = #{goodsNumber}, </if>
             <if test="keywords != null">`keywords` = #{keywords}, </if>
             <if test="goodsBrief != null">`goods_brief` = #{goodsBrief}, </if>
@@ -387,7 +352,6 @@
             <if test="addTime != null">`add_time` = #{addTime}, </if>
             <if test="sortOrder != null">`sort_order` = #{sortOrder}, </if>
             <if test="isDelete != null">`is_delete` = #{isDelete}, </if>
-            <if test="attributeCategory != null">`attribute_category` = #{attributeCategory}, </if>
             <if test="counterPrice != null">`counter_price` = #{counterPrice}, </if>
             <if test="extraPrice != null">`extra_price` = #{extraPrice}, </if>
             <if test="isNew != null">`is_new` = #{isNew}, </if>

+ 1 - 0
kmall-admin/src/main/resources/mybatis/mapper/OrderGoodsDao.xml

@@ -18,6 +18,7 @@
         <result property="isReal" column="is_real"/>
         <result property="goodsSpecificationIds" column="goods_specification_ids"/>
         <result property="listPicUrl" column="list_pic_url"/>
+        <result property="sku" column="sku"/>
     </resultMap>
 
     <select id="queryObject" resultType="com.kmall.admin.entity.OrderGoodsEntity">

+ 2 - 2
kmall-admin/src/main/resources/mybatis/mapper/ProductDao.xml

@@ -26,11 +26,11 @@
 		where id = #{id}
 	</select>
 
-    <select id="queryObjectBySn" resultType="com.kmall.admin.entity.ProductEntity">
+    <select id="queryObjectByGoodsId" resultType="com.kmall.admin.entity.ProductEntity">
         select
         *
         from mall_product
-        where goods_sn = #{goodsSn}
+        where goods_id = #{goodsId}
     </select>
 
     <select id="queryList" resultType="com.kmall.admin.entity.ProductEntity">

+ 139 - 24
kmall-admin/src/main/resources/mybatis/mapper/ProductStoreRelaDao.xml

@@ -31,6 +31,12 @@
         <result column="list_pic_url" property="listPicUrl" />
         <result column="merch_name" property="merchName" />
         <result column="goods_merch_sn" property="goodsMerchSn" />
+
+        <result column="category_id" property="categoryId" />
+        <result column="attribute_category" property="attributeCategory" />
+        <result column="brand_id" property="brandId" />
+        <result column="freight_id" property="freightId" />
+
     </resultMap>
 
     <select id="queryObject" resultType="com.kmall.admin.entity.ProductStoreRelaEntity">
@@ -57,12 +63,16 @@
             b.NAME goodsName,
             cg.NAME categoryName,
             s.store_name storeName,
-            gs.value as specification
+            gs.value as specification,
+            a.category_id,
+            a.attribute_category,
+            a.brand_id,
+            a.freight_id
         FROM
             mall_product_store_rela a
             LEFT JOIN mall_goods b ON a.goods_id = b.id
             LEFT JOIN mall_product c ON a.product_id = c.id
-            LEFT JOIN mall_category cg ON b.category_id = cg.id
+            LEFT JOIN mall_category cg ON a.category_id = cg.id
             LEFT JOIN mall_store s ON a.store_id = s.id
             left join mall_goods_specification gs on gs.goods_id = a.goods_id
 		where a.id = #{id}
@@ -70,30 +80,55 @@
 
     <select id="queryByStoreIdProductId" resultType="com.kmall.admin.entity.ProductStoreRelaEntity">
         select
-        a.`id`,
-        a.`store_id`,
-        a.`merch_sn`,
-        a.`product_id`,
-        a.`stock_num`,
-        a.`goods_id`,
-        a.`retail_price`,
-        a.`market_price`,
-        a.`stock_price`,
-        a.`sell_volume`,
-        a.sku,a.goods_biz_type, a.creater_sn, a.create_time, a.moder_sn, a.mod_time, a.tstm,
-        b.goods_sn goodsSn,
-        c.goods_sn productSn,
-        b.name goodsName,
-        cg.name categoryName,
-        s.store_name storeName
+            a.`id`,
+            a.`store_id`,
+            a.`merch_sn`,
+            a.`product_id`,
+            a.`stock_num`,
+            a.`goods_id`,
+            a.`retail_price`,
+            a.`market_price`,
+            a.`stock_price`,
+            a.`sell_volume`,
+            a.sku,a.goods_biz_type, a.creater_sn, a.create_time, a.moder_sn, a.mod_time, a.tstm,
+            b.goods_sn goodsSn,
+            c.goods_sn productSn,
+            b.name goodsName,
+            cg.name categoryName,
+            s.store_name storeName,
+            a.category_id,
+            a.attribute_category,
+            a.brand_id,
+            a.freight_id
         from mall_product_store_rela a
         left join mall_goods b on a.goods_id = b.id
         left join mall_product c on a.product_id = c.id
-        LEFT JOIN mall_category cg ON b.category_id = cg.id
+        LEFT JOIN mall_category cg ON a.category_id = cg.id
         left join mall_store s on a.store_id = s.id
         where a.store_id = #{storeId} and a.product_id = #{productId}
     </select>
 
+    <select id="queryObjectByStoreAndGoodsId" resultType="com.kmall.admin.entity.ProductStoreRelaEntity">
+        select
+            a.`id`,
+            a.`store_id`,
+            a.`merch_sn`,
+            a.`product_id`,
+            a.`stock_num`,
+            a.`goods_id`,
+            a.`retail_price`,
+            a.`market_price`,
+            a.`stock_price`,
+            a.`sell_volume`,
+            a.sku,a.goods_biz_type, a.creater_sn, a.create_time, a.moder_sn, a.mod_time, a.tstm,
+            a.category_id,
+            a.attribute_category,
+            a.brand_id,
+            a.freight_id
+        from mall_product_store_rela a
+        where a.store_id = #{storeId} and a.goods_id = #{goodsId}
+    </select>
+
     <select id="queryList" resultType="com.kmall.admin.entity.ProductStoreRelaEntity">
         select
         a.`id`,
@@ -114,14 +149,30 @@
         cg.name categoryName,
         s.store_name storeName,
         m.merch_name,
-        b.merch_sn goods_merch_sn
+        b.merch_sn goods_merch_sn,
+        a.category_id,
+        a.attribute_category,
+        a.brand_id,
+        a.freight_id
         from mall_product_store_rela a
         left join mall_goods b on a.goods_id = b.id
         left join mall_merch m on a.merch_sn = m.merch_sn
         left join mall_product c on a.product_id = c.id
-        LEFT JOIN mall_category cg ON b.category_id = cg.id
+        LEFT JOIN mall_category cg ON a.category_id = cg.id
         left join mall_store s on a.store_id = s.id
         WHERE 1=1 and b.is_delete = 0
+        <if test="categoryId != null and categoryId != '' ">
+            AND a.category_id = #{categoryId}
+        </if>
+        <if test="brandId != null and brandId != '' ">
+            AND a.brand_id = #{brandId}
+        </if>
+        <if test="category != null and category != ''">
+            AND a.category_id IN (select id from mall_category where parent_id = #{category})
+        </if>
+        <if test="categoryTwo != null and categoryTwo != ''">
+            AND a.category_id = #{categoryTwo}
+        </if>
         <if test="storeId != null and storeId != '' ">
             AND a.store_id = #{storeId}
         </if>
@@ -179,16 +230,32 @@
         c.goods_sn productSn,
         b.name goodsName,
         cg.name categoryName,
-        s.store_name storeName
+        s.store_name storeName,
+        a.category_id,
+        a.attribute_category,
+        a.brand_id,
+        a.freight_id
         from mall_product_store_rela a
         left join mall_goods b on a.goods_id = b.id
         left join mall_product c on a.product_id = c.id
-        LEFT JOIN mall_category cg ON b.category_id = cg.id
+        LEFT JOIN mall_category cg ON a.category_id = cg.id
         left join mall_store s on a.store_id = s.id
         WHERE 1=1 and b.is_delete = 0
         <if test="goodsId != null">
             AND b.id = #{goodsId}
         </if>
+        <if test="categoryId != null and categoryId != '' ">
+            AND a.category_id = #{categoryId}
+        </if>
+        <if test="brandId != null and brandId != '' ">
+            AND a.brand_id = #{brandId}
+        </if>
+        <if test="category != null and category != ''">
+            AND a.category_id IN (select id from mall_category where parent_id = #{category})
+        </if>
+        <if test="categoryTwo != null and categoryTwo != ''">
+            AND a.category_id = #{categoryTwo}
+        </if>
         <if test="storeId != null and storeId != '' ">
             AND a.store_id = #{storeId}
         </if>
@@ -216,12 +283,24 @@
         from mall_product_store_rela a
         left join mall_goods b on a.goods_id = b.id
         left join mall_product c on a.product_id = c.id
-        LEFT JOIN mall_category cg ON b.category_id = cg.id
+        LEFT JOIN mall_category cg ON a.category_id = cg.id
         left join mall_store s on a.store_id = s.id
         WHERE 1=1 and b.is_delete = 0
         <if test="storeId != null and storeId != '' ">
             AND a.store_id = #{storeId}
         </if>
+        <if test="categoryId != null and categoryId != '' ">
+            AND a.category_id = #{categoryId}
+        </if>
+        <if test="brandId != null and brandId != '' ">
+            AND a.brand_id = #{brandId}
+        </if>
+        <if test="category != null and category != ''">
+            AND a.category_id IN (select id from mall_category where parent_id = #{category})
+        </if>
+        <if test="categoryTwo != null and categoryTwo != ''">
+            AND a.category_id = #{categoryTwo}
+        </if>
         <if test="merchSn != null and merchSn.trim() != '' ">
             AND a.merch_sn = #{merchSn}
         </if>
@@ -267,6 +346,18 @@
         <if test="goodsBizType != null" >
             goods_biz_type,
         </if>
+        <if test="categoryId != null" >
+            category_id,
+        </if>
+        <if test="attributeCategory != null" >
+            attribute_category,
+        </if>
+        <if test="brandId != null" >
+            brand_id,
+        </if>
+        <if test="freightId != null" >
+            freight_id,
+        </if>
         <if test="createrSn != null" >
             creater_sn,
         </if>
@@ -297,6 +388,18 @@
         <if test="goodsBizType != null" >
             #{goodsBizType,jdbcType=CHAR},
         </if>
+        <if test="categoryId != null" >
+            #{categoryId,jdbcType=CHAR},
+        </if>
+        <if test="attributeCategory != null" >
+            #{attributeCategory,jdbcType=CHAR},
+        </if>
+        <if test="brandId != null" >
+            #{brandId,jdbcType=CHAR},
+        </if>
+        <if test="freightId != null" >
+            #{freightId,jdbcType=CHAR},
+        </if>
         <if test="createrSn != null" >
             #{createrSn,jdbcType=VARCHAR},
         </if>
@@ -331,6 +434,18 @@
             <if test="goodsBizType != null" >
                 goods_biz_type = #{goodsBizType,jdbcType=CHAR},
             </if>
+            <if test="categoryId != null" >
+                category_id = #{categoryId,jdbcType=CHAR},
+            </if>
+            <if test="attributeCategory != null" >
+                attribute_category = #{attributeCategory,jdbcType=CHAR},
+            </if>
+            <if test="brandId != null" >
+                brand_id = #{brandId,jdbcType=CHAR},
+            </if>
+            <if test="freightId != null" >
+                freight_id = #{freightId,jdbcType=CHAR},
+            </if>
             <if test="createrSn != null" >
                 creater_sn = #{createrSn,jdbcType=VARCHAR},
             </if>

+ 9 - 2
kmall-admin/src/main/webapp/WEB-INF/page/shop/brand.html

@@ -39,10 +39,17 @@
                 </i-select>
             </Form-item>
             <Form-item label="门店" prop="storeId">
-                <i-select v-model="brand.storeId" filterable placeholder="门店" label-in-value>
+                <i-select v-model="brand.storeId" filterable placeholder="门店" @on-change="getCategoryByStore" label-in-value>
                     <i-option v-for="store in storeList" :value="store.id" :key="store.id">{{store.storeName}}</i-option>
                 </i-select>
-            </Form-item>
+            </Form-item><Form-item label="商品类型" prop="categoryId" style="height: 30px;">
+            <i-select v-model="brand.categoryId" placeholder="商品分类"
+                      label-in-value style="width: 268px;height: 30px;">
+                <i-option v-for="category in categories" :value="category.id"
+                          :key="category.id">{{category.name}}
+                </i-option>
+            </i-select>
+        </Form-item>
             <Form-item label="品牌名称" prop="name">
                 <i-input v-model="brand.name" placeholder="品牌名称"/>
             </Form-item>

+ 21 - 58
kmall-admin/src/main/webapp/WEB-INF/page/shop/goods.html

@@ -67,13 +67,23 @@
                     <i-input v-model="q.goodsSn" @on-enter="query" placeholder="商品编码"/>
                 </i-col>
                 <i-col span="3">
+                    <i-input v-model="q.prodBarcode" @on-enter="query" placeholder="产品条码"/>
+                </i-col>
+                <i-col span="3">
                     <i-input v-model="q.name" @on-enter="query" placeholder="名称"/>
                 </i-col>
                 <i-col span="3">
+                    <i-select v-model="q.goodsBizType" placeholder="货品业务类型"
+                              label-in-value>
+                        <i-option v-for="macro in macros" :value="macro.value" :key="macro.id">{{macro.name}}
+                        </i-option>
+                    </i-select>
+                </i-col><!--
+                <i-col span="3">
                     <i-select v-model="q.category" placeholder="商品分类" filterable @on-change="changeQueryCategories"
                               label-in-value>
                         <i-option v-for="category in queryCategories" :value="category.id"
-                                  :key="category.id">{{category.name}}
+                                  :key="categoqry.id">{{category.name}}
                         </i-option>
                     </i-select>
                 </i-col>
@@ -83,7 +93,7 @@
                                   :key="category.id">{{category.name}}
                         </i-option>
                     </i-select>
-                </i-col>
+                </i-col>-->
                 <i-button @click="query">查询</i-button>
                 <i-button @click="reloadSearch">重置</i-button>
             </div>
@@ -121,8 +131,8 @@
                 </i-col>
                 #end
                 &nbsp;&nbsp;&nbsp;&nbsp;
-                <a href="file/goods_export_yyyy_mm_dd_v1.0.0.xls">商品模板下载</a>&nbsp;&nbsp;&nbsp;&nbsp;
-                <a href="file/general_goods_export_yyyy_mm_dd_v1.0.0.xls">普货商品模板下载</a>
+                <a href="../statics/file/goods_export_yyyy_mm_dd_v1.0.0.xls">商品模板下载</a>&nbsp;&nbsp;&nbsp;&nbsp;
+                <a href="../statics/file/general_goods_export_yyyy_mm_dd_v1.0.0.xls">普货商品模板下载</a>
             </div>
         </Row>
         <table id="jqGrid"></table>
@@ -150,21 +160,6 @@
                         <i-option v-for="thirdMerchant in thirdMerchantBizList" :value="thirdMerchant.thirdPartyMerchCode" :key="thirdMerchant.thirdPartyMerchCode">{{thirdMerchant.thirdPartyMerchName}}</i-option>
                     </i-select>
                 </Form-item>
-                    <Form-item label="商品类型" prop="categoryId" style="height: 30px;">
-                        <!--<i-input v-model="goods.categoryName" @on-click="categoryTree" icon="eye" readonly="readonly" placeholder="商品类型"/>-->
-                        <i-select v-model="goods.attributeCategory" placeholder="商品分类" @on-change="changeCategories"
-                                  label-in-value style="width: 268px;height: 30px;">
-                            <i-option v-for="category in categories" :value="category.id"
-                                      :key="category.id">{{category.name}}
-                            </i-option>
-                        </i-select>
-                        <i-select v-model="goods.categoryId" placeholder="商品二级分类" @on-change="getAttributes"
-                                  label-in-value style="width: 268px;height: 30px;">
-                            <i-option v-for="category in categoriesTwo" :value="category.id"
-                                      :key="category.id">{{category.name}}
-                            </i-option>
-                        </i-select>
-                    </Form-item>
                     <Form-item label="商品编码" prop="goodsSn">
                         <i-input v-model="goods.goodsSn" placeholder="商品编码"/>
                     </Form-item>
@@ -193,13 +188,6 @@
                             </i-option>
                         </i-select>
                     </Form-item>
-                    <Form-item label="品牌" prop="brandId">
-                        <i-select v-model="goods.brandId" placeholder="品牌"
-                                  label-in-value style="width: 268px;">
-                            <i-option v-for="brand in brands" :value="brand.id" :key="brand.id">{{brand.name}}
-                            </i-option>
-                        </i-select>
-                    </Form-item>
                 <Form-item label="供应商" prop="supplierId">
                     <i-select v-model="goods.supplierId" placeholder="供应商"
                               label-in-value style="width: 268px;">
@@ -207,13 +195,13 @@
                         </i-option>
                     </i-select>
                 </Form-item>
-                    <Form-item label="运费模版" prop="freightId">
+                    <!--<Form-item label="运费模版" prop="freightId">
                         <i-select v-model="goods.freightId" placeholder="运费模版"
                                   label-in-value style="width: 268px;">
                             <i-option v-for="freight in freights" :value="freight.id" :key="freight.id">{{freight.name}}
                             </i-option>
                         </i-select>
-                    </Form-item>
+                    </Form-item>-->
                     <!--<Form-item label="市场价" prop="marketPrice">-->
                         <!--<Input-number :min="0.01" :step="0.01" v-model="goods.marketPrice" placeholder="市场价" style="width: 268px;"/>-->
                     <!--</Form-item>-->
@@ -417,36 +405,11 @@
                 </template>
                 <div id="goodsDesc"></div>
             </Tab-Pane>
-            <Tab-Pane label="参数" name="name5">
-                <!--<i-form ref="formValidate" :model="goods" :rules="ruleValidate" :label-width="80">-->
-                    <div v-for="(item,index) in attributeEntityList" v-show="item.isDelete==0">
-                        <div class="row">
-                            <div class="col-md-3">
-                                <label class="ivu-form-item-label">属性:</label>
-                                <div class="col-md-7 input-icon right">
-                                    <i-select v-model="item.attributeId" filterable>
-                                        <i-option v-for="attribute in attributes" :value="attribute.id"
-                                                  :key="attribute.id">{{attribute.name}}
-                                        </i-option>
-                                    </i-select>
-                                </div>
-                            </div>
-                            <div class="col-md-3">
-                                <label class="ivu-form-item-label">属性值:</label>
-                                <div class="col-md-7 input-icon right">
-                                    <i-input type="text" v-model="item.value"/>
-                                </div>
-                            </div>
-                            <button v-if="index == 0" class="btn btn-primary btn-sm" type="button" @click="addAttrRow">
-                                <i class="fa fa-plus"></i>
-                            </button>
-                            <button class="btn red btn-sm" type="button" @click="delAttrRow(index)">
-                                <i class="fa fa-trash-o"></i>
-                            </button>
-                        </div>
-                    </div>
-                <!--</i-form>-->
-            </Tab-Pane>
+            <!--<Tab-Pane label="参数" name="name5">-->
+                <!--&lt;!&ndash;<i-form ref="formValidate" :model="goods" :rules="ruleValidate" :label-width="80">&ndash;&gt;-->
+                    <!---->
+                <!--&lt;!&ndash;</i-form>&ndash;&gt;-->
+            <!--</Tab-Pane>-->
             <Tab-Pane label="其他信息" name="name6">
                 <!--<i-form ref="formValidate" :model="goods" :rules="ruleValidate" :label-width="80">-->
                     <Form-item label="排序" prop="sortOrder">

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

@@ -51,19 +51,41 @@
     <div v-show="showList">
         <Row :gutter="16">
             <div class="search-group">
-                <i-col span="4">
+                <i-col span="3">
                     <i-select v-model="q.storeId" placeholder="门店" filterable label-in-value>
                         <i-option v-for="store in stores" :value="store.id"
                                   :key="store.id">{{store.storeName}}
                         </i-option>
                     </i-select>
                 </i-col>
-                <i-col span="4">
+                <i-col span="3">
                     <i-input v-model="q.goodsName" @on-enter="query" placeholder="名称"/>
                 </i-col>
-                <i-col span="4">
+                <i-col span="3">
                     <i-input v-model="q.goodsSn" @on-enter="query" placeholder="商品编码"/>
                 </i-col>
+                <i-col span="3">
+                    <i-select v-model="q.category" placeholder="商品分类" filterable @on-change="changeQueryCategories"
+                              label-in-value>
+                        <i-option v-for="category in queryCategories" :value="category.id"
+                                  :key="category.id">{{category.name}}
+                        </i-option>
+                    </i-select>
+                </i-col>
+                <i-col span="3">
+                    <i-select v-model="q.categoryTwo" placeholder="商品二级分类" filterable label-in-value>
+                        <i-option v-for="category in queryCategoriesTwo" :value="category.id"
+                                  :key="category.id">{{category.name}}
+                        </i-option>
+                    </i-select>
+                </i-col>
+                <i-col span="3">
+                    <i-select v-model="q.goodsBizType" placeholder="货品业务类型"
+                              label-in-value>
+                        <i-option v-for="macro in macros" :value="macro.value" :key="macro.id">{{macro.name}}
+                        </i-option>
+                    </i-select>
+                </i-col>
                 <!--<i-col span="4">
                     <i-input v-model="q.productSn" @on-enter="query" placeholder="规格编码"/>
                 </i-col>-->
@@ -114,19 +136,74 @@
                 <Input-number :min="0" :step="1" v-model="productStoreRela.stockNum" placeholder="总库存"
                               style="width: 268px;"/>
             </Form-item>
+            <Form-item v-if="showInput" label="商品类型" prop="categoryId" style="height: 30px;">
+                <!--<i-input v-model="goods.categoryName" @on-click="categoryTree" icon="eye" readonly="readonly" placeholder="商品类型"/>-->
+                <i-select v-model="productStoreRela.attributeCategory" placeholder="商品分类" @on-change="changeCategories"
+                          label-in-value style="width: 268px;height: 30px;">
+                    <i-option v-for="category in categories" :value="category.id"
+                              :key="category.id">{{category.name}}
+                    </i-option>
+                </i-select>
+                <i-select v-model="productStoreRela.categoryId" placeholder="商品二级分类" @on-change="getAttributes"
+                          label-in-value style="width: 268px;height: 30px;">
+                    <i-option v-for="category in categoriesTwo" :value="category.id"
+                              :key="category.id">{{category.name}}
+                    </i-option>
+                </i-select>
+            </Form-item>
+            <Form-item v-if="showInput" label="品牌" prop="brandId">
+                <i-select v-model="productStoreRela.brandId" placeholder="品牌"
+                          label-in-value style="width: 268px;">
+                    <i-option v-for="brand in brands" :value="brand.id" :key="brand.id">{{brand.name}}
+                    </i-option>
+                </i-select>
+            </Form-item>
+            <Form-item v-if="showInput" label="运费模版" prop="freightId">
+                <i-select v-model="productStoreRela.freightId" placeholder="运费模版"
+                          label-in-value style="width: 268px;">
+                    <i-option v-for="freight in freights" :value="freight.id" :key="freight.id">{{freight.name}}
+                    </i-option>
+                </i-select>
+            </Form-item>
             <Form-item v-if="showInputSpecification" label="规格" prop="specification">
-                <i-input v-model="productStoreRela.specification" placeholder="规格"/>
+                <i-input v-model="specification" placeholder="规格" style="width: 268px;"/>
             </Form-item>
             <Form-item  v-if="showInput" label="零售价" prop="retailPrice">
                 <Input-number :min="0.01" :step="0.01" v-model="productStoreRela.retailPrice" placeholder="零售价格"
                               style="width: 268px;"/>
             </Form-item>
-            <Form-item  v-if="showInput" label="市场价" prop="marketPrice">
+            <Form-item v-if="showInput" label="市场价" prop="marketPrice">
                 <Input-number :min="0.01" :step="0.01" v-model="productStoreRela.marketPrice" placeholder="市场价"
                               style="width: 268px;"/>
             </Form-item>
+            <div v-if="showInput" v-for="(item,index) in attributeEntityList" v-show="item.isDelete==0" style="margin-left: 16px;">
+                <div class="row">
+                    <div class="col-md-3">
+                        <label class="ivu-form-item-label">属性:</label>
+                        <div class="col-md-7 input-icon right">
+                            <i-select v-model="item.attributeId" filterable>
+                                <i-option v-for="attribute in attributes" :value="attribute.id"
+                                          :key="attribute.id">{{attribute.name}}
+                                </i-option>
+                            </i-select>
+                        </div>
+                    </div>
+                    <div class="col-md-3">
+                        <label class="ivu-form-item-label">属性值:</label>
+                        <div class="col-md-7 input-icon right">
+                            <i-input type="text" v-model="item.value"/>
+                        </div>
+                    </div>
+                    <button v-if="index == 0" class="btn btn-primary btn-sm" type="button" @click="addAttrRow">
+                        <i class="fa fa-plus"></i>
+                    </button>
+                    <button class="btn red btn-sm" type="button" @click="delAttrRow(index)">
+                        <i class="fa fa-trash-o"></i>
+                    </button>
+                </div>
+            </div>
         </i-form>
-        <div style="padding-left: 20px">
+        <div style="padding-left: 20px;padding-top: 20px">
             <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
             <i-button type="warning" @click="reload" style="margin-left: 8px"/>
             返回</i-button>

+ 12 - 1
kmall-admin/src/main/webapp/js/shop/brand.js

@@ -7,6 +7,7 @@ $(function () {
         },
             {label: '所属商户', name: 'merchName', index: 'merchName', width: 100, align: 'center'},
             {label: '所属门店', name: 'storeName', index: 'storeName', width: 80, align: 'center'},
+            {label: '所属分类', name: 'categoryName', index: 'categoryName', width: 60, align: 'center'},
             {
             label: '品牌名称', name: 'name', index: 'name', width: 80
         }, {
@@ -104,7 +105,8 @@ var vm = new Vue({
             name: ''
         },
         storeList: [],
-        merchList: []
+        merchList: [],
+        categories: []//一级分类
     },
     methods: {
         query: function () {
@@ -186,11 +188,20 @@ var vm = new Vue({
                 vm.storeList = r.list;
             });
         },
+        getCategoryByStore: function (opt) {
+            var value = opt.value;
+            vm.getCategories(value);
+        },
         getMerchList: function() {
             $.get("../merch/queryAll", function (r) {
                 vm.merchList = r.list;
             });
         },
+        getCategories: function (storeId) {
+            $.get("../category/getCategorySelect?isShow=1&storeId=" + storeId, function (r) {
+                vm.categories = r.list;
+            });
+        },
         reload: function (event) {
             vm.showList = true;
             var page = $("#jqGrid").jqGrid('getGridParam', 'page');

+ 47 - 42
kmall-admin/src/main/webapp/js/shop/goods.js

@@ -8,7 +8,8 @@ $(function () {
             {label: '第三方商户编号', name: 'thirdPartyMerchCode', index: 'thirdPartyMerchCode', width: 60, align: 'center'},
             {label: '商品编码', name: 'goodsSn', index: 'goods_Sn', width: 60, align: 'center'},
             {label: 'SKU', name: 'sku', index: 'sku', width: 80, align: 'center'},
-            {label: '商品类型', name: 'categoryName', index: 'category_id', width: 40, align: 'center'},
+            {label: '产品条码', name: 'prodBarcode', index: 'prod_barcode', width: 60, align: 'center'},
+            // {label: '商品类型', name: 'categoryName', index: 'category_id', width: 40, align: 'center'},
             {label: '名称', name: 'name', index: 'name', width: 160, align: 'center'},
             {
                 label: '货品业务类型', name: 'goodsBizType', index: 'goods_biz_type', width: 70, align: 'center',
@@ -31,12 +32,12 @@ $(function () {
                     return transIsNot(value);
                 }
             },
-            /*{
+            {
                 label: '热销', name: 'isHot', index: 'is_hot', width: 80, formatter: function (value) {
                 return transIsNot(value);
             }
             },
-            {
+            /*{
                 label: '活动', name: 'goodsType', index: 'goodsType', width: 80,
                 formatter: function (value) {
                     if (value == 2) {
@@ -124,22 +125,22 @@ var vm = new Vue({
                 {required: true, message: '名称不能为空', trigger: 'blur'}
             ]*/
         },
-        q: {name: '', goodsSn: '', category: '', categoryTwo: '', merchSn: ''},
+        q: {name: '', goodsSn: '', prodBarcode: '',goodsBizType:'', merchSn: ''},
         attributes: [],
         attributeEntityList: [{'id': '', 'goodsId': '', 'attributeId': '', 'value': '', 'isDelete': 0}],
         productEntityList: [{'id': '', 'goodsId': '', 'goodsSpecificationIds': '', 'goodsSpecificationNameValue': '', 'goodsSn': '', 'goodsNumber': '', 'isDelete': 0, 'goodsDefault': 0}],
-        queryCategories: [],//一级分类
-        queryCategoriesTwo: [],
+        /*queryCategories: [],//一级分类
+        queryCategoriesTwo: [],*/
         queryMerch: [],
-        categories: [],//一级分类
-        categoriesTwo: [],
+        /*categories: [],//一级分类
+        categoriesTwo: [],*/
         macros: [],//商品单位
-        attributeCategories: [],//属性类别
+        // attributeCategories: [],//属性类别
         specifications: [],
-        brands: [],
-        freights: [],
+        // brands: [],
+        // freights: [],
         showInput: true,
-        categoryId: '',
+        // categoryId: '',
         cusUnitCodeList: [],
         cusNationCodeList: [],
         merchList: [],
@@ -161,7 +162,7 @@ var vm = new Vue({
             }
             vm.productEntityList.push({'id': '', 'goodsId': '', 'goodsSpecificationIds': '', 'goodsSpecificationNameValue': '', 'goodsSn': '', 'goodsNumber': '', 'isDelete': 0, 'goodsDefault': 0});
         },
-        delAttrRow: function (index) {
+        /*delAttrRow: function (index) {
             //最后一行时禁止删除
             if (vm.attributeEntityList.length == 1) {
                 return;
@@ -174,13 +175,13 @@ var vm = new Vue({
                 goodsId = vm.goods.id;
             }
             vm.attributeEntityList.push({'id': '', 'goodsId': goodsId, 'attributeId': '', 'value': '', 'isDelete': 0});
-        },
+        },*/
         reloadSearch: function () {
             vm.q = {
                 name: '',
                 goodsSn: '',
-                category: '',
-                categoryTwo: '',
+                prodBarcode: '',
+                goodsBizType: '',
                 merchSn: ''
             }
         },
@@ -196,10 +197,10 @@ var vm = new Vue({
             vm.getCategory();
             vm.macros = [];
             vm.brands = [];
-            vm.freights = [];
+            // vm.freights = [];
             vm.cusUnitCodeList = [];
             vm.cusNationCodeList = [];
-            vm.attributeEntityList = [{'id': '', 'goodsId': '', 'attributeId': '', 'value': '', 'isDelete': 0}];
+            // vm.attributeEntityList = [{'id': '', 'goodsId': '', 'attributeId': '', 'value': '', 'isDelete': 0}];
             vm.getMacro();
             vm.getCusUnitCodeList();
             vm.getCusNationCode();
@@ -214,12 +215,12 @@ var vm = new Vue({
             vm.showList = false;
             vm.title = "修改";
             vm.uploadList = [];
-            vm.getInfo(id);
+            vm.getInfo(id);/*
             var opt = {};
             opt.value = vm.goods.categoryId;
             opt.flag = 1;
+            vm.getAttributes(opt);*/
             vm.thirdMerchantBizList = [];
-            vm.getAttributes(opt);
             vm.getMacro();
             vm.getCusUnitCodeList();
             vm.getCusNationCode();
@@ -235,12 +236,12 @@ var vm = new Vue({
             $.get("../sys/macro/queryMacrosByValue?value=goodsBizType", function (r) {
                 vm.macros = r.list;
             });
-        },
+        },/*
         getBrand: function (merchSn) {
             $.get("../brand/queryAll?merchSn=" + merchSn, function (r) {
                 vm.brands = r.list;
             });
-        },
+        },*/
         getSuppliers: function (merchSn) {
             $.get("../supplier/queryAll?merchSn=" + merchSn, function (r) {
                 vm.suppliers = r.list;
@@ -255,12 +256,12 @@ var vm = new Vue({
             $.get("../syscusnationcode/queryAll", function (r) {
                 vm.cusNationCodeList = r.list;
             });
-        },
+        },/*
         getFreights: function(merchSn) {
             $.get("../freight/queryAll?merchSn=" + merchSn, function (r) {
                 vm.freights = r.list;
             });
-        },
+        },*/
         getGoodsGallery: function (id) {//获取商品顶部轮播图
             $.get("../goodsgallery/queryAll?goodsId=" + id, function (r) {
                 vm.uploadList = r.list;
@@ -280,7 +281,7 @@ var vm = new Vue({
             var url = vm.goods.id == null ? "../goods/save" : "../goods/update";
             vm.goods.goodsDesc = $('#goodsDesc').editable('getHTML');
             vm.goods.goodsImgList = vm.uploadList;
-            vm.goods.attributeEntityList = vm.attributeEntityList;
+            // vm.goods.attributeEntityList = vm.attributeEntityList;
             vm.goods.productEntityList = vm.productEntityList;
             $.ajax({
                 type: "POST",
@@ -394,7 +395,7 @@ var vm = new Vue({
         getInfo: function (id) {
             $.get("../goods/info/" + id, function (r) {
                 vm.goods = r.goods;
-                vm.categoryId = r.goods.categoryId;
+                /*vm.categoryId = r.goods.categoryId;
                 // vm.getCategory();
                 var opt = {};
                 opt.value = vm.goods.attributeCategory;
@@ -408,7 +409,7 @@ var vm = new Vue({
                     vm.productEntityList = r.goods.productEntityList;
                 } else {
                     vm.productEntityList = [{'id': '', 'goodsId': '', 'goodsSpecificationIds': '', 'goodsSpecificationNameValue': '', 'goodsSn': '', 'goodsNumber': '', 'isDelete': 0, 'goodsDefault': 0}];
-                }
+                }*/
 
                 $('#goodsDesc').editable('setHTML', vm.goods.goodsDesc);
             });
@@ -423,8 +424,8 @@ var vm = new Vue({
                 postData: {
                     'name': vm.q.name,
                     'goodsSn': vm.q.goodsSn,
-                    'category': vm.q.category,
-                    'categoryTwo': vm.q.categoryTwo,
+                    'prodBarcode': vm.q.prodBarcode,
+                    'goodsBizType': vm.q.goodsBizType,
                     'merchSn': vm.q.merchSn
                 },
                 page: page
@@ -478,7 +479,7 @@ var vm = new Vue({
             this.imgName = name;
             this.visible = true;
         },
-        changeQueryCategories: function (opt) {
+        /*changeQueryCategories: function (opt) {
             var value = opt.value;
             $.get("../category/getCategorySelectByParent?parentId=" + value, function (r) {
                 vm.queryCategoriesTwo = r.list;
@@ -512,9 +513,9 @@ var vm = new Vue({
             $.get("../category/getCategorySelectByParent?isShow=1&parentId=" + value, function (r) {
                 vm.categoriesTwo = r.list;
             });
-        },
+        },*/
         uploadExcelSuccess: function (data) {
-            console.log(data);
+            // console.log(data);
             if(data.code==0){
                 alert('导入成功', function (index) {
                     $("#jqGrid").trigger("reloadGrid");
@@ -613,26 +614,30 @@ var vm = new Vue({
         },
         showMerchInfo:function(opt){
             var merchSn = opt.value;
-            vm.getCategories(merchSn);
-            vm.getFreights(merchSn);
-            vm.getBrand(merchSn);
+            // vm.getCategories(merchSn);
+            // vm.getFreights(merchSn);
+            // vm.getBrand(merchSn);
             vm.getSuppliers(merchSn);
             vm.getThirdMerchantBizList(merchSn);
         },
-        getCategories: function (merchSn) {
-            $.get("../category/getCategorySelect?isShow=1&merchSn=" + merchSn, function (r) {
-                vm.categories = r.list;
-            });
-        },
+        // getCategories: function (merchSn) {
+        //     $.get("../category/getCategorySelect?isShow=1&merchSn=" + merchSn, function (r) {
+        //         vm.categories = r.list;
+        //     });
+        // }
     },
     mounted() {
         // this.uploadList = this.$refs.upload.fileList;
-        $.get("../category/getCategorySelect", function (r) {
+        /*$.get("../category/getCategorySelect", function (r) {
             vm.queryCategories = r.list;
-        });
+        });*/
         $.get("../merch/queryAll", function (r) {
             vm.queryMerch = r.list;
         });
 
+        $.get("../sys/macro/queryMacrosByValue?value=goodsBizType", function (r) {
+            vm.macros = r.list;
+        });
+
     }
 });

+ 7 - 7
kmall-admin/src/main/webapp/js/shop/scannShop.js

@@ -12,7 +12,7 @@ $(function () {
                 {name : 'storeName',index : 'storeName',width : 90, align: 'center'},
                 {name: 'sku', index: 'sku', width: 80, align: 'center'},
                 {name: 'goodsName', index: 'name', width: 160, align: 'center'},
-                {name: 'retailPrice', index: 'retailPrice', width: 60, align: 'center'},
+                {name: 'storeRetailPrice', index: 'storeRetailPrice', width: 60, align: 'center'},
                 {name: 'number', index: 'nums', width: 60, align: 'center'},
                 {name: 'stockNum', index: 'stockNum', width: 60, align: 'center'},
                 {name: 'listPicUrl', index: 'listPicUrl', width: 80, align: 'center'}
@@ -28,7 +28,7 @@ $(function () {
     //         {label: '门店', name: 'storeName', index: 'storeName', width: 60, align: 'center'},
     //         {label: 'SKU', name: 'sku', index: 'sku', width: 80, align: 'center'},
     //         {label: '名称', name: 'goodsName', index: 'goodsName', width: 160, align: 'center'},
-    //         {label: '零售价格', name: 'retailPrice', index: 'retail_price', width: 80, align: 'center'},
+    //         {label: '零售价格', name: 'storeRetailPrice', index: 'retail_price', width: 80, align: 'center'},
     //         {label: '数量', name: 'number', index: 'number', width: 80, align: 'center'},
     //         {label: '库存', name: 'stockNum', index: 'stockNum', width: 80, align: 'center'},
     //         {
@@ -79,8 +79,8 @@ var vm = new Vue({
         showList: true,
         title: null,
         uploadList: [],
-        offlineCartList: [{'id': '', 'prodBarcode': '', 'storeName': '', 'SKU': '', 'goodsName': '', 'retailPrice':'', 'number':'','stockNum':'','listPicUrl':''}],
-        offlineCart:{'id': '', 'prodBarcode': '', 'storeName': '', 'SKU': '', 'goodsName': '', 'retailPrice':'', 'number':'','stockNum':'','listPicUrl':''},
+        offlineCartList: [{'id': '', 'prodBarcode': '', 'storeName': '', 'SKU': '', 'goodsName': '', 'storeRetailPrice':'', 'number':'','stockNum':'','listPicUrl':''}],
+        offlineCart:{'id': '', 'prodBarcode': '', 'storeName': '', 'SKU': '', 'goodsName': '', 'storeRetailPrice':'', 'number':'','stockNum':'','listPicUrl':''},
         imgName: '',
         visible: false,
         ruleValidate: {
@@ -110,7 +110,7 @@ var vm = new Vue({
             for(var i = 0;i < ids.length ;i ++) {
                 var rowData = $("#jqGrid").jqGrid('getRowData', ids[i]);
                 vm.offlineCartList.push(rowData);
-                totalPrice = (rowData.number * rowData.retailPrice)+totalPrice;
+                totalPrice = (rowData.number * rowData.storeRetailPrice)+totalPrice;
             }
             totalPrice = totalPrice.toFixed(2);
             vm.goodsTotalPrice = totalPrice;
@@ -154,7 +154,7 @@ var vm = new Vue({
                 if (r.code === 0) {
                     vm.goods = r.goods;
                     var mydata = {id : vm.goods.id,prodBarcode : vm.goods.prodBarcode,storeName:vm.goods.storeName,sku : vm.goods.sku,goodsName : vm.goods.name,
-                            retailPrice : vm.goods.retailPrice,number:1,stockNum : vm.goods.stockNum,listPicUrl : transImg(vm.goods.listPicUrl)};
+                        storeRetailPrice : vm.goods.storeRetailPrice,number:1,stockNum : vm.goods.stockNum,listPicUrl : transImg(vm.goods.listPicUrl)};
                     vm.count = vm.count+1;
                     // var ids = $("#jqGrid").jqGrid('getDataIDs');
                     // if(ids!=""){
@@ -267,7 +267,7 @@ var vm = new Vue({
             // var ids = $("#jqGrid").jqGrid('getGridParam', 'selarrrow');//获取 多行数据
             // for(var i = 0;i < ids.length ;i ++) {
             //     var rowData = $("#jqGrid").jqGrid('getRowData', ids[i]);
-            //     totalPrice = (rowData.nums * rowData.retailPrice)+totalPrice;
+            //     totalPrice = (rowData.nums * rowData.storeRetailPrice)+totalPrice;
             // }
             // vm.goodsTotalPrice = totalPrice;
             // vm.applyPrice = totalPrice;

+ 156 - 13
kmall-admin/src/main/webapp/js/shop/storeProductStock.js

@@ -114,7 +114,7 @@ var vm = new Vue({
         uploadList: [],
         imgName: '',
         visible: false,
-        productStoreRela: { stockNum: '', retailPrice: '', marketPrice: '' },
+        productStoreRela: { stockNum: '', retailPrice: '', marketPrice: '', categoryId:'', brandId:'', specification:'', storeId:'', goodsBizType:'' },
         ruleValidate: {
             /*storeId: [
                 {required: true, message: '门店不能为空'}
@@ -124,14 +124,26 @@ var vm = new Vue({
             storeId: '',
             goodsName: '',
             productSn: '',
-            goodsSn: ''
+            goodsSn: '', category: '', categoryTwo: '', goodsBizType:''
         },
         stores: [],
         macros: [],//商品单位
         goodss: {},
         products: [],
         showInput: false,
-        showInputSpecification: false
+        showInputSpecification: false,
+        categories: [],//一级分类
+        categoriesTwo: [],
+        brands: [],
+        attributeEntityList: [{'id': '', 'goodsId': '', 'attributeId': '', 'value': '', 'isDelete': 0}],
+        attributes: [],
+        queryCategories: [],//一级分类
+        queryCategoriesTwo: [],
+        categoryId: '',
+        freights: [],
+        storeId: 0,
+        specification: '',
+        isOperator: ''
     },
     methods: {
         changeGoods: function (opt) {
@@ -142,22 +154,47 @@ var vm = new Vue({
                     // console.log(r.goods.goodsBizType);
                     if (r.goods.goodsBizType == 11) {
                         vm.showInputSpecification = true;
-                    }else{
+                    } else {
                         vm.showInputSpecification = false;
                     }
-                    // console.log(r.goods.retailPrice);
-                    // console.log(r.goods.marketPrice);
-                    // vm.productStoreRela.retailPrice = r.goods.retailPrice;
-                    // vm.productStoreRela.marketPrice = r.goods.marketPrice;
                 });
+                // $.get("../productstorerela/infoByGoodsId?goodsId=" + goodsId + "&storeId=" + vm.storeId, function (r) {
+                //     vm.productStoreRela = r.productStoreRela;
+                //     vm.showInput = true;
+                //     if (r.productStoreRela.goodsBizType == 11) {
+                //         vm.showInputSpecification = true;
+                //     }else{
+                //         vm.showInputSpecification = false;
+                //     }
+                //
+                //     vm.categoryId = r.productStoreRela.categoryId;
+                //     var opt = {};
+                //     opt.value = vm.productStoreRela.attributeCategory;
+                //     vm.changeCategories(opt);
+                //     // if (r.productStoreRela.attributeEntityList.length > 0) {
+                //     //     vm.attributeEntityList = r.productStoreRela.attributeEntityList;
+                //     // } else {
+                //     //     vm.attributeEntityList = [{'id': '', 'goodsId': '', 'attributeId': '', 'value': '', 'isDelete': 0}];
+                //     // }
+                //     // console.log(r.goods.retailPrice);
+                //     // console.log(r.goods.marketPrice);
+                //     // vm.productStoreRela.retailPrice = r.goods.retailPrice;
+                //     // vm.productStoreRela.marketPrice = r.goods.marketPrice;
+                // });
             }
         },
+        changeQueryCategories: function (opt) {
+            var value = opt.value;
+            $.get("../category/getCategorySelectByParent?parentId=" + value, function (r) {
+                vm.queryCategoriesTwo = r.list;
+            });
+        },
         reloadSearch: function () {
             vm.q = {
                 storeId: '',
                 goodsName: '',
                 productSn: '',
-                goodsSn: ''
+                goodsSn: '', category: '', categoryTwo: '', goodsBizType:''
             }
             vm.reload();
         },
@@ -167,8 +204,12 @@ var vm = new Vue({
         add: function (event) {
             vm.showList = false;
             vm.title = "新增";
+            vm.isOperator = 'add';
             vm.uploadList = [];
-            vm.productStoreRela = { stockNum: '', retailPrice: '', marketPrice: '' };
+            vm.freights = [];
+            vm.brands = [];
+            vm.productStoreRela = { stockNum: '', retailPrice: '', marketPrice: '', categoryId:'', brandId:'',specification:'', storeId:'' };
+            vm.attributeEntityList = [{'id': '', 'goodsId': '', 'attributeId': '', 'value': '', 'isDelete': 0}];
             vm.getMacro();
             vm.showInput = false;
             vm.showInputSpecification = false;
@@ -180,8 +221,13 @@ var vm = new Vue({
             }
             vm.showList = false;
             vm.title = "修改";
+            vm.isOperator = 'update';
             vm.uploadList = [];
             vm.getInfo(id);
+            var opt = {};
+            opt.value = vm.productStoreRela.categoryId;
+            opt.flag = 1;
+            vm.getAttributes(opt);
             vm.getMacro();
             if (vm.productStoreRela.goodsBizType == 11) {
                 vm.showInput = true;
@@ -201,6 +247,8 @@ var vm = new Vue({
         },
         saveOrUpdate: function (event) {
             var url = vm.productStoreRela.id == null ? "../productstorerela/save" : "../productstorerela/update";
+            console.log(vm.attributeEntityList);
+            vm.productStoreRela.attributeEntityList = vm.attributeEntityList;
             $.ajax({
                 type: "POST",
                 url: url,
@@ -243,6 +291,18 @@ var vm = new Vue({
         getInfo: function (id) {
             $.get("../productstorerela/info/" + id, function (r) {
                 vm.productStoreRela = r.productStoreRela;
+                vm.categoryId = r.productStoreRela.categoryId;
+                // vm.getCategory();
+                var opt = {};
+                opt.value = vm.productStoreRela.attributeCategory;
+                vm.changeCategories(opt);
+                if (r.productStoreRela.attributeEntityList.length > 0) {
+                    vm.attributeEntityList = r.productStoreRela.attributeEntityList;
+                } else {
+                    vm.attributeEntityList = [{'id': '', 'goodsId': '', 'attributeId': '', 'value': '', 'isDelete': 0}];
+                }
+                vm.specification = vm.productStoreRela.specification;
+                vm.storeId = vm.productStoreRela.storeId;
             });
         },
         getGoods: function (opt) {
@@ -252,11 +312,88 @@ var vm = new Vue({
                 if(vm.stores[i].id == storeId)
                     merchSn = vm.stores[i].merchSn;
             }
+            vm.storeId = storeId;
 
-            $.get("../goods/queryAll?merchSn=" + merchSn + "&storeId=" +storeId, function (r) {
-                vm.goodss = r.list;
+            console.log(vm.isOperator);
+            if(vm.isOperator == 'add'){
+                $.get("../goods/queryAll?merchSn=" + merchSn + "&storeId=" +storeId, function (r) {
+                    vm.goodss = r.list;
+                });
+            }else{
+                $.get("../goods/queryAll?merchSn=" + merchSn, function (r) {
+                    vm.goodss = r.list;
+                });
+            }
+            vm.getCategories(storeId);
+            vm.getFreights(storeId);
+        },
+        changeCategories: function (opt) {
+            var value = opt.value;
+            vm.getBrand(value);
+            if(value){
+                $.get("../category/getCategorySelectByParent?isShow=1&parentId=" + value, function (r) {
+                    vm.categoriesTwo = r.list;
+                });
+            }
+        },
+        getCategoryByStore: function (opt) {
+            var value = opt.value;
+            vm.getCategories(value);
+            vm.getFreights(value);
+        },
+        getCategories: function (storeId) {
+            $.get("../category/getCategorySelect?isShow=1&storeId=" + storeId, function (r) {
+                vm.categories = r.list;
             });
         },
+        getBrand: function (categoryId) {
+            $.get("../brand/queryAll?categoryId=" + categoryId, function (r) {
+                vm.brands = r.list;
+            });
+        },
+        getAttributes: function (opt) {
+            var value = opt.value;
+            if(value){
+                $.get("../attribute/query?attributeCategoryId=" + value + "&storeId="+vm.storeId, function (r) {
+                    vm.attributes = r.list;
+                });
+
+                if (opt.flag != 1 && !(value === vm.categoryId)) {
+                    if (vm.attributeEntityList.length > 0 && vm.attributeEntityList[0].attributeId != '') {
+                        for (var i = 0; i < vm.attributeEntityList.length; i++) {
+                            if (!(vm.attributeEntityList[0].attributeId === '')) {
+                                vm.attributeEntityList[i].isDelete = 1;
+                            }
+                        }
+
+                        var goodsId = '';
+                        if (vm.goodss) {
+                            goodsId = vm.goodss.id;
+                        }
+                        vm.attributeEntityList.unshift({'id': '', 'goodsId': goodsId, 'attributeId': '', 'value': '', 'isDelete': 0});
+                    }
+                }
+            }
+        },
+        getFreights: function(storeId) {
+            $.get("../freight/queryAll?storeId=" + storeId, function (r) {
+                vm.freights = r.list;
+            });
+        },
+        addAttrRow: function () {
+            let goodsId = '';
+            if (vm.goods) {
+                goodsId = vm.goods.id;
+            }
+            vm.attributeEntityList.push({'id': '', 'goodsId': goodsId, 'attributeId': '', 'value': '', 'isDelete': 0});
+        },
+        delAttrRow: function (index) {
+            //最后一行时禁止删除
+            if (vm.attributeEntityList.length == 1) {
+                return;
+            }
+            vm.attributeEntityList[index].isDelete = 1;
+        },
         reload: function (event) {
             vm.showList = true;
             var page = $("#jqGrid").jqGrid('getGridParam', 'page');
@@ -265,7 +402,7 @@ var vm = new Vue({
                     storeId: vm.q.storeId,
                     goodsName: vm.q.goodsName,
                     goodsSn: vm.q.goodsSn,
-                    productSn: vm.q.productSn
+                    productSn: vm.q.productSn, category: vm.q.category, categoryTwo: vm.q.categoryTwo, goodsBizType:vm.q.goodsBizType
                 },
                 page: page
             }).trigger("reloadGrid");
@@ -363,8 +500,14 @@ var vm = new Vue({
         }
     },
     mounted() {
+        $.get("../category/getCategorySelect", function (r) {
+            vm.queryCategories = r.list;
+        });
         $.get("../store/queryAll", function (r) {
             vm.stores = r.list;
         });
+        $.get("../sys/macro/queryMacrosByValue?value=goodsBizType", function (r) {
+            vm.macros = r.list;
+        });
     }
 });

BIN
kmall-admin/src/main/webapp/WEB-INF/page/shop/file/general_goods_export_yyyy_mm_dd_v1.0.0.xls → kmall-admin/src/main/webapp/statics/file/general_goods_export_yyyy_mm_dd_v1.0.0.xls


BIN
kmall-admin/src/main/webapp/WEB-INF/page/shop/file/goods_export_yyyy_mm_dd_v1.0.0.xls → kmall-admin/src/main/webapp/statics/file/goods_export_yyyy_mm_dd_v1.0.0.xls