Browse Source

发布商品增加培训

plf 4 years ago
parent
commit
0b624be679

+ 16 - 0
src/main/java/com/caimei365/commodity/model/dto/ProductDto.java

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
+import java.math.BigDecimal;
 
 
 /**
 /**
  * Description
  * Description
@@ -181,5 +182,20 @@ public class ProductDto implements Serializable {
      */
      */
     @ApiModelProperty("相关参数与商品图片Json")
     @ApiModelProperty("相关参数与商品图片Json")
     private String params;
     private String params;
+    /**
+     * 仪器培训方式:1线上培训,2线下培训
+     */
+    @ApiModelProperty("仪器培训方式:1线上培训,2线下培训")
+    private Integer trainingMethod;
+    /**
+     * 售价是否包含:1售价未包含,2售价已包含
+     */
+    @ApiModelProperty("售价是否包含:1售价未包含,2售价已包含")
+    private Integer trainingType;
+    /**
+     * 培训费用(售价未包含)
+     */
+    @ApiModelProperty("培训费用(售价未包含)")
+    private BigDecimal trainingFee;
 
 
 }
 }

+ 16 - 3
src/main/java/com/caimei365/commodity/model/po/ProductPo.java

@@ -1,10 +1,9 @@
 package com.caimei365.commodity.model.po;
 package com.caimei365.commodity.model.po;
 
 
-import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
-import java.lang.Double;
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.Date;
 
 
 /**
 /**
@@ -16,7 +15,9 @@ import java.util.Date;
 @Data
 @Data
 public class ProductPo implements Serializable {
 public class ProductPo implements Serializable {
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
-    /** 商品productID */
+    /**
+     * 商品productID
+     */
     private Integer productId;
     private Integer productId;
     /**
     /**
      * 品牌Id
      * 品牌Id
@@ -214,5 +215,17 @@ public class ProductPo implements Serializable {
      * 下架时间
      * 下架时间
      */
      */
     private Date offlineTime;
     private Date offlineTime;
+    /**
+     * 仪器培训方式:1线上培训,2线下培训
+     */
+    private Integer trainingMethod;
+    /**
+     * 售价是否包含:1售价未包含,2售价已包含
+     */
+    private Integer trainingType;
+    /**
+     * 培训费用(售价未包含)
+     */
+    private BigDecimal trainingFee;
 
 
 }
 }

+ 13 - 0
src/main/java/com/caimei365/commodity/model/vo/ProductDetailVo.java

@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModel;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -281,4 +282,16 @@ public class ProductDetailVo implements Serializable {
      * 是否复购 0否 1是
      * 是否复购 0否 1是
      */
      */
     private Integer repurchaseFlag;
     private Integer repurchaseFlag;
+    /**
+     * 仪器培训方式:1线上培训,2线下培训
+     */
+    private Integer trainingMethod;
+    /**
+     * 售价是否包含:1售价未包含,2售价已包含
+     */
+    private Integer trainingType;
+    /**
+     * 培训费用(售价未包含)
+     */
+    private BigDecimal trainingFee;
 }
 }

+ 16 - 2
src/main/java/com/caimei365/commodity/model/vo/ProductFormVo.java

@@ -4,10 +4,10 @@ import com.caimei365.commodity.model.po.ProductDetailInfoPo;
 import com.caimei365.commodity.model.po.ProductImagePo;
 import com.caimei365.commodity.model.po.ProductImagePo;
 import com.caimei365.commodity.model.po.ProductParameterPo;
 import com.caimei365.commodity.model.po.ProductParameterPo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -96,7 +96,9 @@ public class ProductFormVo implements Serializable {
      * 启用阶梯价格标识 0否 1是
      * 启用阶梯价格标识 0否 1是
      */
      */
     private Integer ladderPriceFlag;
     private Integer ladderPriceFlag;
-    /** 活动状态:1有效,0失效 */
+    /**
+     * 活动状态:1有效,0失效
+     */
     private Integer actStatus;
     private Integer actStatus;
     /**
     /**
      * 成本价
      * 成本价
@@ -244,4 +246,16 @@ public class ProductFormVo implements Serializable {
      * 订购方案
      * 订购方案
      */
      */
     private String orderInfo;
     private String orderInfo;
+    /**
+     * 仪器培训方式:1线上培训,2线下培训
+     */
+    private Integer trainingMethod;
+    /**
+     * 售价是否包含:1售价未包含,2售价已包含
+     */
+    private Integer trainingType;
+    /**
+     * 培训费用(售价未包含)
+     */
+    private BigDecimal trainingFee;
 }
 }

+ 18 - 16
src/main/java/com/caimei365/commodity/service/impl/ShopServiceImpl.java

@@ -18,6 +18,7 @@ import com.caimei365.commodity.utils.ImageUtils;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -44,6 +45,7 @@ public class ShopServiceImpl implements ShopService {
     private PriceUtilService priceUtilService;
     private PriceUtilService priceUtilService;
     @Value("${caimei.wwwDomain}")
     @Value("${caimei.wwwDomain}")
     private String domain;
     private String domain;
+
     /**
     /**
      * 供应商-主推商品
      * 供应商-主推商品
      *
      *
@@ -61,10 +63,10 @@ public class ShopServiceImpl implements ShopService {
         List<Integer> visibilityList = new ArrayList<>();
         List<Integer> visibilityList = new ArrayList<>();
         if (identity == 1 || identity == 2) {
         if (identity == 1 || identity == 2) {
             // 协销 | 会员机构 | 综合供应商
             // 协销 | 会员机构 | 综合供应商
-            visibilityList.addAll(Arrays.asList(1,2,3));
+            visibilityList.addAll(Arrays.asList(1, 2, 3));
         } else if (identity == 4) {
         } else if (identity == 4) {
             // 普通机构
             // 普通机构
-            visibilityList.addAll(Arrays.asList(2,3));
+            visibilityList.addAll(Arrays.asList(2, 3));
         } else {
         } else {
             // 游客|所有人
             // 游客|所有人
             visibilityList.add(3);
             visibilityList.add(3);
@@ -82,17 +84,17 @@ public class ShopServiceImpl implements ShopService {
     /**
     /**
      * 供应商-我的商品列表
      * 供应商-我的商品列表
      *
      *
-     * @param shopId       供应商Id
-     * @param name         商品名称
-     * @param productCode  货号
-     * @param validFlag    状态:0逻辑删除,1待审核,2已上架,3已下架,8审核未通过,9已隐身,10已冻结
-     * @param featuredFlag 是否主推:0否,1是
+     * @param shopId        供应商Id
+     * @param name          商品名称
+     * @param productCode   货号
+     * @param validFlag     状态:0逻辑删除,1待审核,2已上架,3已下架,8审核未通过,9已隐身,10已冻结
+     * @param featuredFlag  是否主推:0否,1是
      * @param commodityType 商品属性:1产品,2仪器
      * @param commodityType 商品属性:1产品,2仪器
-     * @param bigTypeId    一级分类Id
-     * @param smallTypeId  二级分类Id
+     * @param bigTypeId     一级分类Id
+     * @param smallTypeId   二级分类Id
      * @param tinyTypeId    三级级分类Id
      * @param tinyTypeId    三级级分类Id
-     * @param pageNum      页码
-     * @param pageSize     每页数量
+     * @param pageNum       页码
+     * @param pageSize      每页数量
      * @return Map<String, Object>
      * @return Map<String, Object>
      */
      */
     @Override
     @Override
@@ -216,7 +218,7 @@ public class ShopServiceImpl implements ShopService {
         String current = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
         String current = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
         //保存或修改商品
         //保存或修改商品
         ProductPo product = new ProductPo();
         ProductPo product = new ProductPo();
-        if (null != productDto.getProductId()) {
+/*        if (null != productDto.getProductId()) {
             product.setProductId(productDto.getProductId());
             product.setProductId(productDto.getProductId());
         }
         }
         product.setShopId(productDto.getShopId());
         product.setShopId(productDto.getShopId());
@@ -249,7 +251,8 @@ public class ShopServiceImpl implements ShopService {
         product.setInvoiceType(productDto.getInvoiceType());
         product.setInvoiceType(productDto.getInvoiceType());
         product.setTaxPoint(productDto.getTaxPoint());
         product.setTaxPoint(productDto.getTaxPoint());
         product.setAllAreaFlag(productDto.getAllAreaFlag());
         product.setAllAreaFlag(productDto.getAllAreaFlag());
-        product.setProvinceIds(productDto.getProvinceIds());
+        product.setProvinceIds(productDto.getProvinceIds());*/
+        BeanUtils.copyProperties(productDto,product);
         product.setUpdateTime(current);
         product.setUpdateTime(current);
         product.setValidFlag(1);
         product.setValidFlag(1);
         product.setProductCategory(1);
         product.setProductCategory(1);
@@ -482,7 +485,6 @@ public class ShopServiceImpl implements ShopService {
         return ResponseJson.success(brandPage);
         return ResponseJson.success(brandPage);
 
 
 
 
-
     }
     }
 
 
     /**
     /**
@@ -505,7 +507,7 @@ public class ShopServiceImpl implements ShopService {
         if (null == featuredDto.getFeaturedFlag()) {
         if (null == featuredDto.getFeaturedFlag()) {
             return ResponseJson.error("参数异常:供应商主推商品标志不能为空!");
             return ResponseJson.error("参数异常:供应商主推商品标志不能为空!");
         }
         }
-        if (1 == featuredDto.getFeaturedFlag()){
+        if (1 == featuredDto.getFeaturedFlag()) {
             int featuredCount = shopMapper.getMainProductsCount(featuredDto.getShopId());
             int featuredCount = shopMapper.getMainProductsCount(featuredDto.getShopId());
             if (featuredCount >= 4) {
             if (featuredCount >= 4) {
                 return ResponseJson.error("主推商品已经上限了!");
                 return ResponseJson.error("主推商品已经上限了!");
@@ -514,7 +516,7 @@ public class ShopServiceImpl implements ShopService {
         int flag = shopMapper.updateProductFeatured(featuredDto.getProductId(), featuredDto.getShopId(), featuredDto.getFeaturedFlag());
         int flag = shopMapper.updateProductFeatured(featuredDto.getProductId(), featuredDto.getShopId(), featuredDto.getFeaturedFlag());
         if (flag > 0) {
         if (flag > 0) {
             return ResponseJson.success();
             return ResponseJson.success();
-        } else{
+        } else {
             return ResponseJson.error("供应商主推商品标志更新失败!");
             return ResponseJson.error("供应商主推商品标志更新失败!");
         }
         }
     }
     }

+ 2 - 1
src/main/resources/mapper/PageMapper.xml

@@ -144,7 +144,8 @@
             brandID as brandId,  productType, tags, unit, normalPrice, price1 as price, includedTax, minBuyNumber,
             brandID as brandId,  productType, tags, unit, normalPrice, price1 as price, includedTax, minBuyNumber,
             productCategory, serviceNumber, taxPoint, supplierTaxPoint, price1TextFlag as priceFlag, actFlag, ladderPriceFlag,
             productCategory, serviceNumber, taxPoint, supplierTaxPoint, price1TextFlag as priceFlag, actFlag, ladderPriceFlag,
             addTime, hasSkuFlag, sellNumber, sortIndex, featuredFlag, costCheckFlag, recommendType, machineType,
             addTime, hasSkuFlag, sellNumber, sortIndex, featuredFlag, costCheckFlag, recommendType, machineType,
-            productCode, updateTime, validFlag, searchKey, allAreaFlag, step, costPrice, provinceIds, qualificationImg
+            productCode, updateTime, validFlag, searchKey, allAreaFlag, step, costPrice, provinceIds, qualificationImg,
+            trainingMethod, trainingType ,trainingFee
         from product
         from product
         where productID = #{productId}
         where productID = #{productId}
     </select>
     </select>

+ 29 - 1
src/main/resources/mapper/ShopMapper.xml

@@ -74,6 +74,15 @@
             <if test="invoiceType != null and  invoiceType != ''">
             <if test="invoiceType != null and  invoiceType != ''">
                 invoiceType,
                 invoiceType,
             </if>
             </if>
+            <if test="trainingMethod != null">
+                trainingMethod,
+            </if>
+            <if test="trainingType != null">
+                trainingType,
+            </if>
+            <if test="trainingFee != null">
+                trainingFee,
+            </if>
             updateTime, validFlag
             updateTime, validFlag
         ) values (
         ) values (
             #{shopId}, #{name}, #{aliasName}, #{commodityType}, #{bigTypeId}, #{smallTypeId}, #{tinyTypeId}, #{mainImage},
             #{shopId}, #{name}, #{aliasName}, #{commodityType}, #{bigTypeId}, #{smallTypeId}, #{tinyTypeId}, #{mainImage},
@@ -146,6 +155,15 @@
             </if>
             </if>
             <if test="invoiceType != null and  invoiceType != ''">
             <if test="invoiceType != null and  invoiceType != ''">
                 #{invoiceType},
                 #{invoiceType},
+            </if>
+            <if test="trainingMethod != null">
+                #{trainingMethod},
+            </if>
+            <if test="trainingType != null">
+                #{trainingType},
+            </if>
+            <if test="trainingFee != null">
+                #{trainingFee},
             </if>
             </if>
              #{updateTime}, #{validFlag}
              #{updateTime}, #{validFlag}
         )
         )
@@ -225,6 +243,15 @@
             <if test="invoiceType != null and  invoiceType != ''">
             <if test="invoiceType != null and  invoiceType != ''">
                 invoiceType = #{invoiceType},
                 invoiceType = #{invoiceType},
             </if>
             </if>
+            <if test="trainingMethod != null">
+                trainingMethod = #{trainingMethod},
+            </if>
+            <if test="trainingType != null">
+                trainingType = #{trainingType},
+            </if>
+            <if test="trainingFee != null">
+                trainingFee = #{trainingFee},
+            </if>
             updateTime = #{updateTime}, validFlag = #{validFlag}
             updateTime = #{updateTime}, validFlag = #{validFlag}
         where productID = #{productId}
         where productID = #{productId}
     </update>
     </update>
@@ -445,7 +472,8 @@
             brandID as brandId,  productType, tags, unit, normalPrice, price1 as price, includedTax, minBuyNumber,
             brandID as brandId,  productType, tags, unit, normalPrice, price1 as price, includedTax, minBuyNumber,
             productCategory, serviceNumber, supplierTaxPoint, price1TextFlag as priceFlag, actFlag, ladderPriceFlag,
             productCategory, serviceNumber, supplierTaxPoint, price1TextFlag as priceFlag, actFlag, ladderPriceFlag,
             addTime, hasSkuFlag, sellNumber, sortIndex, featuredFlag, costCheckFlag, recommendType, machineType,
             addTime, hasSkuFlag, sellNumber, sortIndex, featuredFlag, costCheckFlag, recommendType, machineType,
-            productCode, updateTime, validFlag, searchKey, allAreaFlag, step, costPrice, provinceIds, qualificationImg
+            productCode, updateTime, validFlag, searchKey, allAreaFlag, step, costPrice, provinceIds, qualificationImg,
+            trainingMethod, trainingType ,trainingFee
         from product
         from product
         where productID = #{productId}
         where productID = #{productId}
     </select>
     </select>