Browse Source

商品详情区分资质机构商品详情/普通机构商品详情

zhijiezhao 3 years ago
parent
commit
24548b0ef7

+ 2 - 0
src/main/java/com/caimei/modules/product/dao/ProductDao.java

@@ -172,4 +172,6 @@ public interface ProductDao extends CrudDao<Product> {
     List<Product> findProductImage(Product product);
 
     void insertProductDetailInfo(ProductDetailInfo productDetailInfo);
+
+    String findProductDetail(Integer productID);
 }

+ 22 - 2
src/main/java/com/caimei/modules/product/entity/Product.java

@@ -81,7 +81,7 @@ public class Product extends DataEntity<Product> {
     private String actCreateTimeStr;
     private String recommendType; //相关推荐类型 0自动选择; 1手动推荐
     private Integer combinationID;//商品组合Id
-
+    private String productDetail; //普通机构商品详情1同资质机构商品详情,2用普通机构商品详情
     //-----------------  虚拟字段 ----
     private boolean customClass = false;  //是否有自定义分类
     private String brandName;//品牌名称
@@ -181,9 +181,13 @@ public class Product extends DataEntity<Product> {
      */
     private String machineType;
     /**
-     * 商品详情信息
+     * 资质机构商品详情信息
      */
     private String detailInfo;
+    /**
+     * 普通机构商品详情
+     */
+    private String detailInfo2;
     /**
      * 服务详情
      */
@@ -203,6 +207,22 @@ public class Product extends DataEntity<Product> {
      */
     private Integer searchType;
 
+    public String getProductDetail() {
+        return productDetail;
+    }
+
+    public void setProductDetail(String productDetail) {
+        this.productDetail = productDetail;
+    }
+
+    public String getDetailInfo2() {
+        return detailInfo2;
+    }
+
+    public void setDetailInfo2(String detailInfo2) {
+        this.detailInfo2 = detailInfo2;
+    }
+
     public List<ProductLadderPrice> getLadderPriceList() {
         return ladderPriceList;
     }

+ 13 - 1
src/main/java/com/caimei/modules/product/entity/ProductDetailInfo.java

@@ -19,9 +19,13 @@ public class ProductDetailInfo implements Serializable {
     private String propValueImages;
 
     /**
-     * 商品详情信息
+     * 资质机构商品详情信息
      */
     private String detailInfo;
+    /**
+     * 普通机构商品详情信息
+     */
+    private String detailInfo2;
 
     private String detailInfoTxt;
 
@@ -43,6 +47,14 @@ public class ProductDetailInfo implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
+    public String getDetailInfo2() {
+        return detailInfo2;
+    }
+
+    public void setDetailInfo2(String detailInfo2) {
+        this.detailInfo2 = detailInfo2;
+    }
+
     public Integer getProductDetailInfoID() {
         return productDetailInfoID;
     }

+ 5 - 0
src/main/java/com/caimei/modules/product/service/ProductService.java

@@ -364,6 +364,7 @@ public class ProductService extends CrudService<ProductDao, Product> {
     public void saveProduct(Product product, ProductDetailInfo productDetailInfo) {
         String detailInfo = product.getDetailInfo();
         String orderInfo = product.getOrderInfo();
+        String detailInfo2 = product.getDetailInfo2();
         String serviceInfo = product.getServiceInfo();
         List<ProductLadderPrice> ladderPriceList = product.getLadderPriceList();
         // 上传商品图片
@@ -458,4 +459,8 @@ public class ProductService extends CrudService<ProductDao, Product> {
         productPage.setList(productList);
         return productPage;
     }
+
+    public String findProductDetail(Integer productID) {
+        return productDao.findProductDetail(productID);
+    }
 }

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

@@ -253,8 +253,10 @@ public class ProductNewController extends BaseController {
                 product.setDetailInfo(productDetailInfo.getDetailInfo());
                 product.setServiceInfo(productDetailInfo.getServiceInfo());
                 product.setOrderInfo(productDetailInfo.getOrderInfo());
+                product.setDetailInfo2(productDetailInfo.getDetailInfo2());
             }
             product.setLadderPriceList(ladderPriceList);
+            product.setProductDetail(productService.findProductDetail(product.getProductID()));
         }
         product.setCommodityType(StringUtils.isEmpty(product.getCommodityType()) ? "0" : product.getCommodityType());
         List<CmBrand> brandList = productService.findBrandList();

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

@@ -1380,6 +1380,9 @@
   <update id="updateByPrimaryKeySelective" parameterType="com.caimei.modules.product.entity.Product">
     update product
     <set>
+	  <if test="productDetail != null and productDetail != ''">
+		  productDetail = #{productDetail},
+      </if>
       <if test="brandID != null and brandID != ''">
         brandID = #{brandID},
       </if>
@@ -1616,6 +1619,9 @@
       <if test="detailInfo != null">
         detailInfo = #{detailInfo},
       </if>
+	  <if test="detailInfo2 != null">
+			detailInfo2 = #{detailInfo2},
+	  </if>
       <if test="detailInfoTxt != null">
         detailInfoTxt = #{detailInfoTxt},
       </if>
@@ -1829,5 +1835,7 @@
 			</otherwise>
 		</choose>
 	</select>
-
+	<select id="findProductDetail" resultType="java.lang.String">
+		select productDetail from product where productID = #{productID}
+	</select>
 </mapper>

+ 28 - 1
src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp

@@ -370,13 +370,28 @@
             </td>
         </tr>
         <tr>
-            <th><span class="red">*</span>商品详细信息:</th>
+            <th><span class="red">*</span>资质机构商品详细信息:</th>
             <td colspan="3">
                 <form:textarea path="detailInfo"  htmlEscape="false" class="input-xlarge required hide" />
                 <!-- 富文本编辑器 -->
                 <div id="detailInfoEditor">${product.detailInfo}</div>
             </td>
         </tr>
+        <tr>
+            <th><span class="red">*</span>商品详情选择:</th>
+            <td colspan="3">
+                <label><input type="radio" name="productDetail" value="1" ${product.productDetail == "1" ? "checked" : ""} />同资质机构商品详情<b class="line">|</b></label>
+                <label><input type="radio" name="productDetail" value="2" ${product.productDetail == "2" || product.productDetail == null ? "checked" : ""} />不同于资质机构商品详情(即使用以下编辑内容)</label>
+            </td>
+        </tr>
+        <tr>
+            <th><span class="red">*</span>普通机构商品详细信息:</th>
+            <td colspan="3">
+                <form:textarea path="detailInfo2"  htmlEscape="false" class="input-xlarge required hide" />
+                <!-- 富文本编辑器 -->
+                <div id="detailInfoEditor2">${product.detailInfo2}</div>
+            </td>
+        </tr>
         <tr>
             <th>订购方案:</th>
             <td colspan="3">
@@ -611,6 +626,16 @@
         }).catch(function(error){
             console.log(error);
         });
+        //富文本框
+        ClassicEditor.create(document.querySelector('#detailInfoEditor2'), {
+            ckfinder: {
+                uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
+            }
+        }).then(function(editor) {
+            window.detailInfoEditor2 = editor;
+        }).catch(function(error){
+            console.log(error);
+        });
         ClassicEditor.create(document.querySelector('#orderInfoEditor'), {
             ckfinder: {
                 uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
@@ -635,6 +660,8 @@
     function checkInfo(){
         var detailInfo=detailInfoEditor.getData();
         $("#detailInfo").val(detailInfo);
+        var detailInfo2=detailInfoEditor2.getData();
+        $("#detailInfo2").val(detailInfo2);
         console.log(detailInfo);
         var orderInfo=orderInfoEditor.getData();
         $("#orderInfo").val(orderInfo);