Browse Source

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

张创标 4 years ago
parent
commit
6d0b9e44ab

+ 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

@@ -40,6 +40,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;
@@ -840,8 +842,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());
                     }

+ 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

@@ -152,17 +152,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"

+ 20 - 0
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,
@@ -608,6 +610,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 ;
@@ -629,6 +644,11 @@ let vm = new Vue({
                 return ;
             }
 
+            //将手机号与姓名身份证号进行绑定,下次填写手机号即可
+            let userInfoBindingKey = this.userInfo.customPhone;
+            let userInfoBindingValue = this.userInfo.customName+this.userInfo.customIDCard;
+            this.userInfoBinding[userInfoBindingKey] = userInfoBindingValue;
+
             if(this.userInfo.couponSn){
                 var coupon = vm.coupons.get(this.userInfo.couponSn);
                 if(coupon == null){

BIN
kmall-admin/src/main/webapp/statics/file/goods_export_yyyy_mm_dd_v1.0.0.xls