Browse Source

Merge remote-tracking branch 'origin/developerF' into developerF

Duan_xu 3 years ago
parent
commit
04cdfe3859

+ 3 - 1
src/main/java/com/caimei/modules/product/dao/ProductDao.java

@@ -180,9 +180,11 @@ public interface ProductDao extends CrudDao<Product> {
 
     List<Integer> getProductIdByBrandId(String brandId);
 
-    List<Shop> findSepcialShopList();
+    List<CmShop> findSepcialShopList();
 
     void updateMainImage(Product product);
 
     String getSplitCodeByProductId(Integer productID);
+
+    List<CmSplitCode> findSplitCodesByShopId(Integer shopID);
 }

+ 12 - 1
src/main/java/com/caimei/modules/product/entity/CmShop.java

@@ -3,6 +3,7 @@ package com.caimei.modules.product.entity;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * shop
@@ -12,7 +13,10 @@ import java.math.BigDecimal;
 
 public class CmShop implements Serializable {
     private Integer shopID;
-
+    /**
+     * 虚拟字段,页面使用
+     */
+    private List<CmSplitCode> splitCodes;
     /**
      * 对应的userId
      */
@@ -361,6 +365,13 @@ public class CmShop implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
+    public List<CmSplitCode> getSplitCodes() {
+        return splitCodes;
+    }
+
+    public void setSplitCodes(List<CmSplitCode> splitCodes) {
+        this.splitCodes = splitCodes;
+    }
 
     public Integer getShopID() {
         return shopID;

+ 6 - 1
src/main/java/com/caimei/modules/product/service/ProductService.java

@@ -7,6 +7,7 @@ import com.caimei.modules.common.utils.UploadUtils;
 import com.caimei.modules.product.dao.*;
 import com.caimei.modules.product.entity.*;
 import com.caimei.modules.sys.utils.UploadImageUtils;
+import com.caimei.modules.user.entity.SplitCode;
 import com.caimei.po.ProductImage;
 import com.caimei.po.ProductLadderPrice;
 import com.caimei.po.Shop;
@@ -552,7 +553,11 @@ public class ProductService extends CrudService<ProductDao, Product> {
         return productDao.findProductDescribe(productID);
     }
 
-    public List<Shop> findSepcialShopList() {
+    public List<CmShop> findSepcialShopList() {
         return productDao.findSepcialShopList();
     }
+
+    public List<CmSplitCode> getCodes(Integer shopId) {
+        return productDao.findSplitCodesByShopId(shopId);
+    }
 }

+ 9 - 2
src/main/java/com/caimei/modules/product/web/ProductNewController.java

@@ -251,7 +251,7 @@ public class ProductNewController extends BaseController {
     @RequestMapping(value = "productAdd")
     public String addProduct(Product product, Model model) {
         List<CmBrand> brandList = productService.findBrandList();
-        List<Shop> shopList = productService.findSepcialShopList();
+        List<CmShop> shopList = productService.findSepcialShopList();
         //解析商品搜索关键字(搜索关键词目前最多只能5个)
         String searchKey = product.getSearchKey();
         List<String> searchKeyList = new ArrayList<String>(5);
@@ -284,6 +284,12 @@ public class ProductNewController extends BaseController {
         return "modules/product-new/cmNewProductForm";
     }
 
+    @RequestMapping(value = "getCodes")
+    @ResponseBody
+    public List<CmSplitCode> getCodes(Integer shopId) {
+        return productService.getCodes(shopId);
+    }
+
     @RequiresPermissions("product:product:view")
     @RequestMapping(value = "productEdit")
     public String editProduct(Product product, Model model) {
@@ -312,10 +318,11 @@ public class ProductNewController extends BaseController {
             product.setBigTypeID(0);
             product.setSmallTypeID(0);
             product.setTinyTypeID(0);
+            product.setShopType(2);
         }
         product.setCommodityType(StringUtils.isEmpty(product.getCommodityType()) ? "0" : product.getCommodityType());
         List<CmBrand> brandList = productService.findBrandList();
-        List<Shop> shopList = productService.findSepcialShopList();
+        List<CmShop> shopList = productService.findSepcialShopList();
         Map<String, Object> classify = productService.findClassify();
         List<Province> provinceList = areaService.loadProvince();
         List<CmProductCombination> combinationList = cmProductCombinationService.findProductCombinationList();

+ 5 - 5
src/main/java/com/caimei/modules/user/entity/NewCmShop.java

@@ -82,7 +82,7 @@ public class NewCmShop extends DataEntity<NewCmShop> {
     private String socialCreditCode; //统一社会信用代码
     private Integer shopType;//供应商类别,普通1,新品供应商2,二手供应商3
     private String cardNumber; //收款卡号
-    private Integer commIssion;
+    private Integer chargeSupport;//线上支付手续费:默认1采美承担,2供应商承担
     /**
      * 非持久化字段
      **/
@@ -1056,11 +1056,11 @@ public class NewCmShop extends DataEntity<NewCmShop> {
         this.wxApplets = wxApplets;
     }
 
-    public Integer getCommIssion() {
-        return commIssion;
+    public Integer getChargeSupport() {
+        return chargeSupport;
     }
 
-    public void setCommIssion(Integer commIssion) {
-        this.commIssion = commIssion;
+    public void setChargeSupport(Integer chargeSupport) {
+        this.chargeSupport = chargeSupport;
     }
 }

+ 0 - 2
src/main/java/com/caimei/modules/user/web/NewCmShopController.java

@@ -573,8 +573,6 @@ public class NewCmShopController extends BaseController {
     @RequestMapping(value = "save")
     public String save(NewCmShop newCmShop, Model model, RedirectAttributes redirectAttributes) {
         NewCmShop newCmShops = cmOperationalLogService.shoplist(newCmShop.getShopID());
-        System.out.println("修改前》》》》》"+newCmShop);
-        System.out.println("修改后》》》》》"+newCmShops);
         ArrayList<String> list = new ArrayList();
 
         CmOperationalLogs sysLog = new CmOperationalLogs();

+ 9 - 2
src/main/resources/mappings/modules/product/ProductMapper.xml

@@ -1888,10 +1888,17 @@
 	<select id="findProductDescribe" resultType="java.lang.String">
 		select productDescribe from product where productID = #{productID}
 	</select>
-	<select id="findSepcialShopList" resultType="com.caimei.po.Shop">
-		select name,shopId from shop where shopType=2
+	<select id="findSepcialShopList" resultType="com.caimei.modules.product.entity.CmShop">
+		select name,shopID
+		from shop
+		where shopType=2
 	</select>
     <select id="getSplitCodeByProductId" resultType="java.lang.String">
 		select splitCode from product where productID = #{productID}
 	</select>
+	<select id="findSplitCodesByShopId" resultType="com.caimei.modules.product.entity.CmSplitCode">
+		select shopId,commercialCode as splitCode,codeDetail as codeName,email
+		from cm_shop_splitcode
+		where shopId = #{shopID}
+	</select>
 </mapper>

+ 6 - 2
src/main/resources/mappings/modules/user/NewCmShopMapper.xml

@@ -59,7 +59,7 @@
 		u.source AS "source",
 		a.shopType AS "shopType",
 		a.cardNumber AS "cardNumber",
-        a.commIssion AS "commIssion",
+		a.chargeSupport AS "chargeSupport",
 		d.name AS "province",c.name AS "city",b.name AS "town"
 	</sql>
 
@@ -275,11 +275,15 @@
 	<update id="update">
 		UPDATE shop
 		<set>
+			<if test="name != null and name != ''" >
 			name = #{name},
+			</if>
 		    website = #{website},
 			wxOfficialAccount = #{wxOfficialAccount},
 			wxApplets = #{wxApplets},
-			commIssion=#{commIssion},
+			<if test="chargeSupport != null" >
+				chargeSupport=#{chargeSupport},
+			</if>
 			<if test="sname != null and sname != ''" >
 				sname = #{sname},
 			</if>

+ 40 - 7
src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp

@@ -149,7 +149,12 @@
 <body>
 <ul class="nav nav-tabs">
     <li><a href="${ctx}/product/new/list">商品信息列表</a></li>
-    <li class="active"><a href="${ctx}/product/new/productEdit?id=${product.id}">商品信息编辑</a></li>
+    <c:if test="${not empty product.id}">
+        <li class="active"><a href="${ctx}/product/new/productEdit?id=${product.id}">商品信息编辑</a></li>
+    </c:if>
+    <c:if test="${empty product.id}">
+        <li class="active"><a href="${ctx}/product/new/productEdit?id=${product.id}">发布特殊供应商商品</a></li>
+    </c:if>
 </ul>
 <form:form id="inputForm" modelAttribute="product"
            action="${ctx}/product/new/productSave?searchShopID=${product.searchShopID}&searchShopName=${product.searchShopName}&searchBigTypeID=${product.searchBigTypeID}&searchSmallTypeID=${product.searchSmallTypeID}&searchTinyTypeID=${product.searchTinyTypeID}&searchValidFlag=${product.searchValidFlag}&searchActStatus=${product.searchActStatus}&searchProductType=${product.searchProductType}&searchBrandID=${product.searchBrandID}&searchPreferredFlag=${product.searchPreferredFlag}&searchProductCategory=${product.searchProductCategory}&editFlag=${product.editFlag}&shopType=${product.shopType}"
@@ -234,11 +239,13 @@
         </tr>
         <c:if test="${product.shopType == 2}">
         <tr>
-                <th><span style="color: red">*</span>供应商:</th>
+            <th><span style="color: red">*</span>供应商:</th>
             <td colspan="3">
-                <form:select path="shopID" class="input-small required">
+                <form:select path="shopID" class="input-small required" onchange="getCodes(this.value)">
                     <form:option value="" label="请选择"/>
-                    <form:options items="${shopList}" itemLabel="name" itemValue="shopID" htmlEscape="false"/>
+                    <c:forEach items="${shopList}" var="shop" varStatus="index">
+                            <form:option value="${shop.shopID}" label="${shop.name}"/>
+                    </c:forEach>
                 </form:select>
             </td>
         </tr>
@@ -499,13 +506,19 @@
         <tr>
             <th>线上分账账号:</th>
             <td colspan="3">
-                <form:select path="splitCode" class="select-ele input-medium required">
+                <c:if test="${not empty product.productID}">
+                <form:select path="splitCode" class="select-ele input-medium">
                     <form:option value="" label="请选择"/>
                     <c:forEach items="${splitCodeList}" var="splitCodeList" varStatus="index">
-                        <form:option value="${splitCodeList.splitCode}" label="${splitCodeList.splitCode} ${splitCodeList.codeRemark}"/>
+                        <form:option value="${splitCodeList.splitCode}" label="${splitCodeList.codeRemark}"/>
                     </c:forEach>
                 </form:select>
-<%--                <form:input path="splitCode" type="text" id="splitCode" maxlength="15"/>--%>
+                </c:if>
+                <c:if test="${empty product.productID}">
+                    <form:select path="splitCode" class="select-ele input-medium" id="getCode">
+                        <form:option value="" label="请选择"/>
+                    </form:select>
+                </c:if>
             </td>
         </tr>
         <tr id="taxPointDiv">
@@ -894,6 +907,26 @@
     <%--    });--%>
     <%--});--%>
 
+    function getCodes(data){
+
+        var opts = "<option value=''>请选择</option>";
+        $.ajax({
+            type: "POST",
+            url: "${ctx}/product/new/getCodes",
+            data: {"shopId": data},
+            success: function (res) {
+                console.log("data------------------->"+res)
+                for (let i = 0; i < res.length; i++) {
+                    opts += "<option value='" + res[i].splitCode + "'>" + res[i].codeName + "</option>";
+                }
+                console.log(opts);
+                $("#getCode").html('').append(opts);
+                },
+            error: function (res) {
+            }
+        });
+    }
+
     //图片初始化
     if(${product.shopType == 2}){
     $(function () {

+ 25 - 27
src/main/webapp/WEB-INF/views/modules/user/cmNewProductShopEdit.jsp

@@ -29,7 +29,9 @@
 <body>
 <ul class="nav nav-tabs">
     <li><a href="${ctx}/user/newCmShop/special/new">新品供应商</a></li>
-    <li class="active"><a href="${ctx}/user/newCmShop/special/new/edit?id=${newCmShop.shopID}&shopType=${newCmshop.shopType}">${not empty newCmShop.shopID?'编辑':'添加'}特殊供应商</a></li>
+    <li class="active"><a
+            href="${ctx}/user/newCmShop/special/new/edit?id=${newCmShop.shopID}&shopType=${newCmshop.shopType}">${not empty newCmShop.shopID?'编辑':'添加'}特殊供应商</a>
+    </li>
 </ul>
 <br/>
 <form:form id="inputForm" modelAttribute="newCmShop" action="${ctx}/user/newCmShop/special/new/save" method="post"
@@ -55,7 +57,7 @@
                 ${newCmShop.linkMan}
             </c:if>
             <c:if test="${newCmShop.shopType eq 2}">
-            <form:input path="linkMan" htmlEscape="false" maxlength="6" class="input-xlarge required"/>
+                <form:input path="linkMan" htmlEscape="false" maxlength="6" class="input-xlarge required"/>
             </c:if>
         </div>
     </div>
@@ -66,20 +68,21 @@
                 ${newCmShop.contractMobile}
             </c:if>
             <c:if test="${newCmShop.shopType eq 2}">
-            <form:input path="contractMobile" htmlEscape="false" type="number" maxlength="11" class="input-xlarge required"/>
+                <form:input path="contractMobile" htmlEscape="false" type="number" maxlength="11"
+                            class="input-xlarge required"/>
             </c:if>
         </div>
     </div>
     <div class="control-group">
         <c:if test="${newCmShop.shopType eq 2}">
-        <label class="control-label"><font color="red">*</font>状态:</label>
-        <div class="controls">
-            <form:select path="status" class="input-xlarge required">
-                <form:option value="" label="请选择"/>
-                <form:option value="90" label="已上线" selected="selected" htmlEscape="false"/>
-                <form:option value="91" label="已下线" htmlEscape="false"/>
-            </form:select>
-        </div>
+            <label class="control-label"><font color="red">*</font>状态:</label>
+            <div class="controls">
+                <form:select path="status" class="input-xlarge required">
+                    <form:option value="" label="请选择"/>
+                    <form:option value="90" label="已上线" selected="selected" htmlEscape="false"/>
+                    <form:option value="91" label="已下线" htmlEscape="false"/>
+                </form:select>
+            </div>
         </c:if>
         <c:if test="${newCmShop.shopType eq 3}">
             <label class="control-label"><font color="red">*</font>收款卡号:</label>
@@ -88,6 +91,13 @@
             </div>
         </c:if>
     </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>线上支付手续费:</label>
+        <div class="controls">
+            <form:radiobutton path="chargeSupport" value="1" label="采美承担" checked="true"/>
+            <form:radiobutton path="chargeSupport" value="2" label="供应商承担"/>
+        </div>
+    </div>
     <div class="control-group">
         <tr>
             <th><b>分账商户号:</b></th>
@@ -114,19 +124,7 @@
                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button
                     class="addParams" onclick="return false">添加分帐号
             </button>
-        </td>
-<td>
-</br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-    <strong>线上支付手续费:</strong>
-
-    <c:if test="${empty newCmShop.commIssion || newCmShop.commIssion==0}">
-        <input type="radio" checked="checked" name="commIssion" value="0"  class="required" />采美承担
-        <input type="radio" name="commIssion" value="1" class="required" />供应商承担
-    </c:if>
-    <c:if test="${newCmShop.commIssion==1}">
-        <input type="radio"  name="commIssion" value="0"  class="required" />采美承担
-        <input type="radio" checked="checked" name="commIssion" value="1" class="required" />供应商承担
-    </c:if></td>
+            </td>
         </tr>
     </div>
 
@@ -144,9 +142,9 @@
         // alertx("+++++"+val.length)         splitCodes[${varIndex.index}].splitCode
         productParametersIndex++;
         var html = '<div id="paramsItem" class="paramsItem">';
-        html += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="splitCodes[' + [productParametersIndex] + '].splitCode" id="splitCode" maxlength="8" placeholder="请输入分帐商户号" type="text" class="input-small"/>&nbsp;';
-        html += '<input name="splitCodes[' + [productParametersIndex] + '].email" id="email" maxlength="10" placeholder="请输入对应邮箱号"  type="text"   class="input-small"/>&nbsp;';
-        html += '<input name="splitCodes[' + [productParametersIndex] + '].codeRemark" id="codeRemark" maxlength="10" placeholder="请输入账户备注"  type="text"   class="input-small"/>&nbsp;';
+        html += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="splitCodes[' + [productParametersIndex] + '].splitCode" id="splitCode" maxlength="15" placeholder="请输入分帐商户号" type="text" class="input-small"/>&nbsp;';
+        html += '<input name="splitCodes[' + [productParametersIndex] + '].email" id="email" maxlength="15" placeholder="请输入对应邮箱号"  type="text"   class="input-small"/>&nbsp;';
+        html += '<input name="splitCodes[' + [productParametersIndex] + '].codeRemark" id="codeRemark" maxlength="15" placeholder="请输入账户备注"  type="text"   class="input-small"/>&nbsp;';
         html += '<span type="button" style="cursor: pointer;color: #0B61A4" onclick="deleteParams(this)"">删除</span>';
         html += '</div>';
         $("#addParamsItems").append(html).show();

+ 14 - 25
src/main/webapp/WEB-INF/views/modules/user/newCmShopForm.jsp

@@ -11,7 +11,6 @@
                 //$("#name").focus();
                 $("#inputForm").validate({
                     submitHandler: function (form) {
-                        debugger
                         var bindMobile = $("#contractMobile").val();
                         var userID = $("#userID").val();
                         $.post("${ctx}/new/user/agency/checkMobile?bindMobile=" + bindMobile + "&userID=" + userID, function (data) {
@@ -780,6 +779,13 @@
             </tr>
         </table>
     </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>线上支付手续费:</label>
+        <div class="controls">
+            <form:radiobutton path="chargeSupport" value="1" label="采美承担" checked="true"/>
+            <form:radiobutton path="chargeSupport" value="2" label="供应商承担"/>
+        </div>
+    </div>
     <div class="control-group">
         <tr>
             <th><b>分账商户号:</b></th>
@@ -792,36 +798,19 @@
                         <div id="paramsItem" class="paramsItem">
                             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<form:input
                                 path="splitCodes[${varIndex.index}].splitCode" id="paramsName"
-                                maxlength="8" placeholder="请输入分帐商户号" class="input-small"/>
+                                maxlength="15" placeholder="请输入分帐商户号" class="input-small"/>
                             <form:input path="splitCodes[${varIndex.index}].email" id="email"
-                                        maxlength="10" placeholder="请输入对应邮箱号" class="input-small"/>
+                                        maxlength="15" placeholder="请输入对应邮箱号" class="input-small"/>
                             <form:input path="splitCodes[${varIndex.index}].codeRemark" id="paramsContent"
-                                        maxlength="10" placeholder="请输入账户备注"
+                                        maxlength="15" placeholder="请输入账户备注"
                                         class="input-small"/>
                             <span type="button" style="cursor: pointer;color: #0B61A4"
                                   onclick="deleteParams(this)">删除</span>
                         </div>
                     </c:forEach>
                 </div>
-                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button
-                    class="addParams" onclick="return false">添加分帐号
-            </button>
-     &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp; &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp; &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
-
-                <strong>线上支付手续费:</strong>
-
-                <c:if test="${empty newCmShop.commIssion || newCmShop.commIssion==0}">
-                    <input type="radio" checked="checked" name="commIssion" value="0"  class="required" />采美承担
-                    <input type="radio" name="commIssion" value="1" class="required" />供应商承担
-                </c:if>
-                <c:if test="${newCmShop.commIssion==1}">
-                    <input type="radio"  name="commIssion" value="0"  class="required" />采美承担
-                    <input type="radio" checked="checked" name="commIssion" value="1" class="required" />供应商承担
-                </c:if>
-
-
+                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button class="addParams" onclick="return false">添加分帐号</button>
             </td>
-
         </tr>
     </div>
     <div class="control-group">
@@ -1219,9 +1208,9 @@
         <%--alertx("+++++"+val.length)         splitCodes[${varIndex.index}].splitCode--%>
         productParametersIndex++;
         var html = '<div id="paramsItem" class="paramsItem">';
-        html += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="splitCodes[' + [productParametersIndex] + '].splitCode" id="splitCode" maxlength="8" placeholder="请输入分帐商户号" type="text" class="input-small"/>&nbsp;';
-        html += '<input name="splitCodes[' + [productParametersIndex] + '].email" id="email"maxlength="10" placeholder="请输入对应邮箱号" class="input-small"/>&nbsp;'
-        html += '<input name="splitCodes[' + [productParametersIndex] + '].codeRemark" id="codeRemark" maxlength="10" placeholder="请输入账户备注"  type="text"   class="input-small"/>&nbsp;';
+        html += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="splitCodes[' + [productParametersIndex] + '].splitCode" id="splitCode" maxlength="15" placeholder="请输入分帐商户号" type="text" class="input-small"/>&nbsp;';
+        html += '<input name="splitCodes[' + [productParametersIndex] + '].email" id="email"maxlength="15" placeholder="请输入对应邮箱号" class="input-small"/>&nbsp;'
+        html += '<input name="splitCodes[' + [productParametersIndex] + '].codeRemark" id="codeRemark" maxlength="15" placeholder="请输入账户备注"  type="text"   class="input-small"/>&nbsp;';
         html += '<span type="button" style="cursor: pointer;color: #0B61A4" onclick="deleteParams(this)"">删除</span>';
         html += '</div>';
         $("#addParamsItems").append(html).show();