浏览代码

Merge branch 'master' of http://git.ds-bay.com/project/kmall-pt-general

 Conflicts:
	kmall-admin/src/main/webapp/js/sale/sale.js
zcb 4 年之前
父节点
当前提交
f55faf39db

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

@@ -109,6 +109,8 @@ public class GoodsDto implements Serializable {
 
     private String supplierName;
 
+    private String supplierFlag;
+
     private String defaultFreight;
     //上架
     private String isOnSaleStr;
@@ -432,6 +434,14 @@ public class GoodsDto implements Serializable {
         this.supplierName = supplierName;
     }
 
+    public String getSupplierFlag() {
+        return supplierFlag;
+    }
+
+    public void setSupplierFlag(String supplierFlag) {
+        this.supplierFlag = supplierFlag;
+    }
+
     public String getDefaultFreight() {
         return defaultFreight;
     }

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

@@ -41,6 +41,8 @@ import java.util.stream.Collectors;
 @Service("goodsService")
 public class GoodsServiceImpl implements GoodsService {
     @Autowired
+    private MerchDao merchDao;
+    @Autowired
     private GoodsDao goodsDao;
     @Autowired
     private ProductDao productDao;
@@ -848,8 +850,23 @@ public class GoodsServiceImpl implements GoodsService {
                 if(thirdMerchantBizEntity != null) {
                     SupplierEntity supplierEntity = supplierDao.queryObjectByName(goodsDto.getSupplierName(), thirdMerchantBizEntity.getMerchSn(),thirdMerchantBizEntity.getThirdPartyMerchCode());
                     if (supplierEntity == null) {
-                        isFail = true;
-                        failSuppGoodsSnList.add(goodsDto.getGoodsSn());
+                        //导入没有查到供货商,执行新增
+                        MerchEntity merchEntity = merchDao.findByMerchSn(thirdMerchantBizEntity.getMerchSn());
+                        if(null == merchEntity || !StringUtils.isNotEmpty(goodsDto.getSupplierFlag())){
+                            isFail = true;
+                            failSuppGoodsSnList.add(goodsDto.getGoodsSn());
+                        }
+
+                        supplierEntity = new SupplierEntity();
+                        supplierEntity.setLevelMerchSn(merchEntity.getMerchSn());
+                        supplierEntity.setLevelMerchFlag(merchEntity.getMerchShortName());
+                        supplierEntity.setThirdPartyMerchCode(thirdMerchantBizEntity.getThirdPartyMerchCode());
+                        supplierEntity.setChildSupplierName(goodsDto.getSupplierName());
+                        supplierEntity.setChildSupplierFlag(goodsDto.getSupplierFlag());
+                        supplierEntity.setIsShow("0");
+
+                        supplierDao.save(supplierEntity);
+                        goodsEntity.setSupplierId(supplierEntity.getId());
                     } else {
                         goodsEntity.setSupplierId(supplierEntity.getId());
                     }

+ 71 - 20
kmall-admin/src/main/java/com/kmall/admin/service/impl/ProductStoreRelaServiceImpl.java

@@ -149,12 +149,12 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
             }
 
             //商品配置校验
-            if(!StringUtils.isNotEmpty(goodsEntity.getListPicUrl())){
-                throw new RRException("该商品列表图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品列表图信息,再来操作门店商品数据");
-            }
-            if(!StringUtils.isNotEmpty(goodsEntity.getPrimaryPicUrl())){
-                throw new RRException("该商品主图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品主图信息,再来操作门店商品数据");
-            }
+//            if(!StringUtils.isNotEmpty(goodsEntity.getListPicUrl())){
+//                throw new RRException("该商品列表图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品列表图信息,再来操作门店商品数据");
+//            }
+//            if(!StringUtils.isNotEmpty(goodsEntity.getPrimaryPicUrl())){
+//                throw new RRException("该商品主图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品主图信息,再来操作门店商品数据");
+//            }
 //            List<GoodsGalleryEntity> galleryEntityList = goodsGalleryDao.queryObjectByGoodId(goodsEntity.getId());
 //            if (galleryEntityList == null || galleryEntityList.size() <= 0) {
 //                throw new RRException("该商品轮播图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品详情轮播图信息,再来操作门店商品数据");
@@ -851,24 +851,38 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
                     throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]未录入系统");
                 }
                 CategoryEntity parentCategoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getCategoryName(), store.getMerchSn(),0);
+                CategoryEntity categoryEntity;//二级分类
                 if (parentCategoryEntity != null) {
-                    storeRelaEntity.setCategoryId(parentCategoryEntity.getId());
-                    CategoryEntity categoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getAttributeCategory(), store.getMerchSn(),parentCategoryEntity.getId());
-                    if (categoryEntity != null) {
-                        storeRelaEntity.setAttributeCategory(categoryEntity.getId());
-                    }else{
-                        throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的二级类别输入有误");
+                    categoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getAttributeCategory(), store.getMerchSn(),parentCategoryEntity.getId());
+                    if (categoryEntity == null) {
+                        categoryEntity = initSaveCategoryEntity(storeGoodsDto.getAttributeCategory(), store.getMerchSn(), parentCategoryEntity.getId());
+                        categoryDao.save(categoryEntity);
+                        categoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getAttributeCategory(), store.getMerchSn(),parentCategoryEntity.getId());
                     }
                 }else{
-                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的一级类别输入有误");
+//                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的一级类别输入有误");
+                    // 如果没有一级分类就自动创建一二级分类
+                    parentCategoryEntity = initSaveCategoryEntity(storeGoodsDto.getCategoryName(), store.getMerchSn(),0);
+                    categoryDao.save(parentCategoryEntity);
+                    // 保存后再查出来
+                    parentCategoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getCategoryName(), store.getMerchSn(),0);
+                    categoryEntity = initSaveCategoryEntity(storeGoodsDto.getAttributeCategory(),store.getMerchSn(),parentCategoryEntity.getId());
+                    categoryDao.save(categoryEntity);
+                    categoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getAttributeCategory(), store.getMerchSn(),parentCategoryEntity.getId());
                 }
 
+                storeRelaEntity.setCategoryId(parentCategoryEntity.getId());
+                storeRelaEntity.setAttributeCategory(categoryEntity.getId());
+
                 BrandEntity brandEntity = brandDao.queryObjectByName(storeGoodsDto.getBrandName(), store.getMerchSn(),storeRelaEntity.getAttributeCategory());
-                if (brandEntity != null) {
-                    storeRelaEntity.setBrandId(brandEntity.getId());
-                }else{
-                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的品牌输入有误");
+                if (brandEntity == null) {
+                    // throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的品牌输入有误");
+                    brandEntity = initSaveBrandEntity(storeGoodsDto.getBrandName(), store.getMerchSn(),storeRelaEntity.getAttributeCategory());
+                    brandDao.save(brandEntity);
+                    brandEntity = brandDao.queryObjectByName(storeGoodsDto.getBrandName(), store.getMerchSn(),storeRelaEntity.getAttributeCategory());
                 }
+
+                storeRelaEntity.setBrandId(brandEntity.getId());
                 /*FreightEntity freightEntity = freightDao.queryFreightByFreightNameAndStoreId(storeGoodsDto.getFreightName(), store.getId());
                 if (freightEntity != null) {
                     storeRelaEntity.setFreightId(freightEntity.getId());
@@ -876,9 +890,9 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
                     throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的运费模板输入有误");
                 }*/
                 // 如果底线价大于零售价
-                if (new BigDecimal(storeGoodsDto.getBottomLinePrice()).compareTo(new BigDecimal(storeGoodsDto.getRetailPrice())) == 1) {
-                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的底线价不可以大于零售价");
-                }
+//                if (new BigDecimal(storeGoodsDto.getBottomLinePrice()).compareTo(new BigDecimal(storeGoodsDto.getRetailPrice())) == 1) {
+//                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的底线价不可以大于零售价");
+//                }
                 // 查询批次号是否存在
 //                GoodsBatchEntity goodsBatchEntity = goodsBatchDao.queryByBatchSnAndSku(storeGoodsDto.getBatchSn(), goodsEntity.getSku());
 //                if (goodsBatchEntity!=null){
@@ -901,5 +915,42 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
         return 1;
     }
 
+    private BrandEntity initSaveBrandEntity(String brandName, String merchSn, Integer categroyId) {
+        BrandEntity brandEntity = new BrandEntity();
+        brandEntity.setName(brandName);
+        brandEntity.setMerchSn(merchSn);
+        brandEntity.setCategoryId(categroyId);
+        brandEntity.setSimpleDesc(brandName);
+        brandEntity.setIsShow(1);
+        brandEntity.setIsNew(0);
+        // 图片随便填
+        brandEntity.setListPicUrl("http://120.76.26.84:80/group1/M00/00/58/rBJEdV-X_ReANxuzAABXBxj7KoY326.jpg");
+        brandEntity.setPicUrl("http://120.76.26.84:80/group1/M00/00/58/rBJEdV-X_ReANxuzAABXBxj7KoY326.jpg");
+        brandEntity.setAppListPicUrl("http://120.76.26.84:80/group1/M00/00/58/rBJEdV-X_ReANxuzAABXBxj7KoY326.jpg");
+        brandEntity.setNewPicUrl("http://120.76.26.84:80/group1/M00/00/58/rBJEdV-X_ReANxuzAABXBxj7KoY326.jpg");
+        return brandEntity;
+    }
+
+
+    private CategoryEntity initSaveCategoryEntity(String categoryName, String merchSn, Integer parentId){
+        CategoryEntity saveCategoryEntity = new CategoryEntity();
+        saveCategoryEntity.setName(categoryName);
+        saveCategoryEntity.setParentId(parentId);
+        saveCategoryEntity.setIsShow(1);
+        saveCategoryEntity.setFrontDesc(categoryName);
+        saveCategoryEntity.setMerchSn(merchSn);
+        // 如果是一级分类
+        if (parentId.intValue()==0){
+            saveCategoryEntity.setLevel("L1");
+        }else{
+            saveCategoryEntity.setLevel("L2");
+        }
+        saveCategoryEntity.setType(0);
+        // 给个默认图片即可
+        saveCategoryEntity.setIconUrl("http://120.76.26.84:80/group1/M00/00/54/rBJEdV9hfU2AVyZHAAAK_hSw3F0952.png");
+        saveCategoryEntity.setWapBannerUrl("http://120.76.26.84:80/group1/M00/00/54/rBJEdV9hfU2AVyZHAAAK_hSw3F0952.png");
+        return saveCategoryEntity;
+    }
+
 
 }

+ 5 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/SupplierServiceImpl.java

@@ -53,6 +53,11 @@ public class SupplierServiceImpl implements SupplierService {
             }else{
                 throw new RRException("商户编号不存在,请先维护用户商户编号信息再来操作");
             }
+
+            SupplierEntity supplierEntity = supplierDao.queryObjectByName(supplier.getChildSupplierName(), supplier.getLevelMerchSn(), supplier.getThirdPartyMerchCode());
+            if(null != supplierEntity){
+                throw new RRException("该供货商名称已存在");
+            }
         }
         return supplierDao.save(supplier);
     }

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

@@ -12,23 +12,24 @@
                 <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="6">GoodsDto.supplierFlag</mapping>
+                <mapping row="1" col="7">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="8">GoodsDto.isOnSaleStr</mapping>
+                <mapping row="1" col="9">GoodsDto.goodsUnit</mapping>
+                <mapping row="1" col="10">GoodsDto.isHotStr</mapping>
+                <mapping row="1" col="11">GoodsDto.cusGoodsCode</mapping>
+                <mapping row="1" col="12">GoodsDto.ciqProdModel</mapping>
+                <mapping row="1" col="13">GoodsDto.goodsRate</mapping>
                 <!--<mapping row="1" col="16">GoodsDto.marketPrice</mapping>-->
                 <!--<mapping row="1" col="17">GoodsDto.retailPrice</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>
-                <mapping row="1" col="18">GoodsDto.goodsNumber</mapping>
+                <mapping row="1" col="14">GoodsDto.brand</mapping>
+                <mapping row="1" col="15">GoodsDto.unitName</mapping>
+                <mapping row="1" col="16">GoodsDto.oriCntName</mapping>
+                <mapping row="1" col="17">GoodsDto.cusDeclEle</mapping>
+                <mapping row="1" col="18">GoodsDto.cusRecCode</mapping>
+                <mapping row="1" col="19">GoodsDto.goodsNumber</mapping>
             </section>
             <loopbreakcondition>
                 <rowcheck offset="0">

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

@@ -101,7 +101,7 @@
 		</if>
 	</select>
 	 
-	<insert id="save" parameterType="com.kmall.admin.entity.SupplierEntity">
+	<insert id="save" parameterType="com.kmall.admin.entity.SupplierEntity" useGeneratedKeys="true" keyProperty="id">
 		insert into mall_supplier(
 			`level_merch_sn`,
 			`level_merch_flag`,

+ 5 - 5
kmall-admin/src/main/webapp/WEB-INF/page/sale/sale.html

@@ -153,17 +153,17 @@
                                     <div class="modal-body">
                                         <form>
                                             <div class="form-group">
+                                                <label for="customPhone" class="control-label">手机号:</label>
+                                                <input type="text" class="form-control" ref="customPhone" id="customPhone" @blur="customPhoneBlur" />
+                                            </div>
+                                            <div class="form-group">
                                                 <label for="customName" class="control-label">姓名:</label>
-                                                <input type="text" class="form-control"  ref="customName"  id="customName">
+                                                <input type="text" class="form-control"  ref="customName"  id="customName" />
                                             </div>
                                             <div class="form-group">
                                                 <label for="customIDCard" class="control-label">身份证:</label>
                                                 <input type="text" class="form-control"  ref="customIDCard"  id="customIDCard" />
                                             </div>
-                                            <div class="form-group">
-                                                <label for="customPhone" class="control-label">手机号:</label>
-                                                <input type="text" class="form-control" ref="customPhone" id="customPhone" />
-                                            </div>
                                             <div v-if="coupons.size > 0" class="form-group">
                                                 <label for="couponSn" class="control-label">优惠券码:</label>
                                                 <input type="text" class="form-control" ref="couponSn" id="couponSn" />

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

@@ -151,7 +151,7 @@
                         <i-button type="ghost" icon="ios-cloud-upload-outline">商品导入</i-button>
                     </Upload>
                 </i-col>
-                #end 0
+                #end
                 #if($shiro.hasPermission("goods:generalGoodsUpload"))
                 <i-col style="display: inline-grid;">
                     <Upload :show-upload-list="false" :on-success="uploadExcelSuccess" :on-error="uploadExcelError" :on-format-error="uploadExcelFormatError"

+ 23 - 1
kmall-admin/src/main/webapp/js/sale/sale.js

@@ -301,6 +301,8 @@ let vm = new Vue({
         goodsList:[],
         orderInfo:[],
         userInfo:{},
+        //user信息绑定集合
+        userInfoBinding: {},
         sysUserInfo:{},
         storeName:null,
         prodBarcode:null,
@@ -573,7 +575,7 @@ let vm = new Vue({
 
         },
         getIDCardInfo: function(){
-            $.post("http://127.0.0.1:21600/idcard/read", function (r){
+            $.post("http://127.0.0.1:8000/idcard/read", function (r){
                 // var dataR = JSON.parse(r);
                 // console.log(dataR)
                 console.log(r)
@@ -602,6 +604,19 @@ let vm = new Vue({
             });
 
         },
+        customPhoneBlur:function (){
+            let customPhone = this.$refs.customPhone.value;
+            if(customPhone){
+                for(let key in this.userInfoBinding){
+                    if(customPhone == key){
+                        let userInfoBindingValue = this.userInfoBinding[key];
+                        this.$refs.customName.value = userInfoBindingValue.substring(0, userInfoBindingValue.length-18);
+                        this.$refs.customIDCard.value = userInfoBindingValue.substring(userInfoBindingValue.length-18);
+                        break;
+                    }
+                }
+            }
+        },
         submitCustomInfo:function(){
             this.userInfo.customName = this.$refs.customName.value ;
             this.userInfo.customIDCard =  this.$refs.customIDCard.value ;
@@ -622,8 +637,15 @@ let vm = new Vue({
                 alert("手机号码有误,请重填");
                 return ;
             }
+            //将手机号与姓名身份证号进行绑定,下次填写手机号即可
+            let userInfoBindingKey = this.userInfo.customPhone;
+            let userInfoBindingValue = this.userInfo.customName+this.userInfo.customIDCard;
+            this.userInfoBinding[userInfoBindingKey] = userInfoBindingValue;
+
             console.log(this.userInfo.couponSn);
             if(this.userInfo.couponSn && this.userInfo.couponSn != ""){
+
+
                 var coupon = vm.coupons.get(this.userInfo.couponSn);
                 if(coupon == null){
                     alert("请输入正确的优惠券码");

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

@@ -475,10 +475,10 @@ var vm = new Vue({
                 alert("底线价不能为空!");
                 return;
             }
-            if(psr.retailPrice<psr.bottomLinePrice){
-                alert("零售价不能低于底线价,请修改价格!");
-                return;
-            }
+            // if(psr.retailPrice<psr.bottomLinePrice){
+            //     alert("零售价不能低于底线价,请修改价格!");
+            //     return;
+            // }
             var url = vm.productStoreRela.id == null ? "../productstorerela/save" : "../productstorerela/update";
             vm.productStoreRela.attributeEntityList = vm.attributeEntityList;
             $.ajax({

二进制
kmall-admin/src/main/webapp/statics/file/goods_export_yyyy_mm_dd_v1.0.0.xls