Browse Source

二手商品新优化版本发布商品

jun.li@caimei365.com 4 years ago
parent
commit
06c43c2531

+ 11 - 1
base-module/src/main/java/com/caimei/module/base/entity/po/Product.java

@@ -599,5 +599,15 @@ public class Product implements Serializable {
      */
     private Integer combinationSort;
 
+    /**
+     * 商品的类别:1正常商品(默认),2二手商品
+     */
+    private String productCategory;
+
+    /**
+     * 审核原因
+     */
+    private String auditReason;
+
     private static final long serialVersionUID = 1L;
-}
+}

+ 167 - 0
base-module/src/main/java/com/caimei/module/base/entity/po/SeconHandProduct.java

@@ -0,0 +1,167 @@
+package com.caimei.module.base.entity.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 二手商品详细信息
+ *
+ * @author : Charles
+ * @date : 2020/7/15
+ */
+
+@Data
+public class SeconHandProduct extends Product implements Serializable {
+    private static final long serialVersionUID = -2976754435288893250L;
+
+
+    private Integer id;
+    /**
+     * 是否已售 0和空未出售,1已出售
+     */
+    private String sold;
+        /**
+     * 二手商品分类,1二手仪1器,2临期产品,3其他
+     */
+    private String secondHandType;
+        /**
+         * 二手仪器分类的类型,1轻光电、2重光电、3耗材配件(仅适用于二手仪器分类多个用英文逗号分分隔)
+         */
+    private String instrumentType;
+        /**
+         * 出厂日期格式:2020年6月
+         */
+    private String fixedYears;
+        /**
+         * 产品到期日格式:2020年6月(仅适用于临期产品)
+         */
+    private String maturityYears;
+        /**
+         * 公司名称
+         */
+    private String companyName;
+        /**
+         * 是否启用详聊,1不开启,2开启(开启详聊不展示交易价)
+         */
+    private String detailTalkFlag;
+        /**
+         * 采购价/原价(该二手原始购买价格)
+         */
+    private Double originalPrice;
+
+        /**
+     * 采购价/原价(该二手原始购买价格)千分位串
+     */
+    private String originalPriceStr;
+    /**
+     * 交易价字符串千分位
+     */
+    private String price1Str;
+    /**
+     * 市场价价字符串千分位
+     */
+    private String normalPriceStr;
+        /**
+         * 联系人名字
+         */
+    private String contactName;
+        /**
+         * 联系方式
+         */
+    private String contactMobile;
+        /**
+         * 设备类型:1医美、2非医美
+         */
+    private String secondProductType;
+        /**
+         * 省市区(地址前部分)
+         */
+    private String provinceCityDistrict;
+        /**
+         * 详细联系地址
+         */
+    private String address;
+        /**
+         * 是否已售 0和空未出售,1已出售
+         */
+    private String productQuality;
+        /**
+         * 付款状态1:待支付、2已付款
+         */
+    private String payStatus;
+        /**
+         * 支付金额
+         */
+    private Double payAmount;
+        /**
+         * 线上支付回调返回数据存档
+         */
+    private String payFormData;
+        /**
+         * 付款方式 0后台付款、1:支付宝、2微信 、12PC-B2B网银、13PC-微信支付、14PC-支付宝、15小程序-微信支付
+         */
+    private String payType;
+        /**
+         * 线上付款时间
+         */
+    private Date payDate;
+        /**
+         * 提交时间
+         */
+    private Date submitDate;
+        /**
+         * 审核时间'
+         */
+    private Date reviewedDate;
+        /**
+         * 上架时间(审核时上架变化、自动下架后再上架变化、手动下架后上架如果不在有效期内才变化)
+         */
+    private Date onLineDate;
+    /**
+     * 商品图片信息
+     */
+    private String image1;
+	private String image2;
+	private String image3;
+	private String image4;
+	private String image5;
+    /**
+     * 商品详情信息(补充信息)
+     */
+	private String productDetails;
+
+    /**
+     * 区Id
+     */
+	private Integer townId;
+
+    /**
+     * 浏览量
+     */
+    private Integer viewingNum;
+
+     /**
+     * //是否新上架 0非新上架,1新上架
+     */
+    private String newAdded;
+
+    /**
+     * 二手商品列表图片数据集合
+     */
+    private List<String> imageList;
+
+    /**
+     * 品牌名称
+     */
+    private String brandName;
+
+    /**
+     * 商品类型(二手仪器-重光电)
+     */
+    private String typeStr;
+
+}

+ 16 - 0
product/src/main/java/com/caimei/module/product/dao/ProductModuleDao.java

@@ -1,5 +1,7 @@
 package com.caimei.module.product.dao;
 
+import com.caimei.module.base.entity.po.CmBrand;
+import com.caimei.module.base.entity.po.SeconHandProduct;
 import com.caimei.module.base.entity.vo.*;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -32,6 +34,8 @@ public interface ProductModuleDao {
 
     List<ProductImageVo> findProductImage(Integer productID);
 
+    List<String> findImageByProductId(Integer productID);
+
     List<String> findProductImageString(Integer productID);
 
     ShopVo findProductShopById(Integer shopID);
@@ -57,4 +61,16 @@ public interface ProductModuleDao {
     List<ProductVo> getDeFaultRecommend(Integer tinyTypeID);
 
     void deleteAllSearchHistory(Integer userId);
+
+    AddressVo getAddressInfo(Integer townId);
+
+    void saveSencondHandProduct(SeconHandProduct seconHandProduct);
+
+    List<SeconHandProduct> getSeconHandProductList(SeconHandProduct seconHandProduct);
+
+    SeconHandProduct getSencondHandProductDetail(Integer productId);
+
+    List<CmBrand> getBrandList();
+
+    void updateViewingNum(SeconHandProduct sencondHandProductDetail);
 }

+ 12 - 4
product/src/main/java/com/caimei/module/product/service/ProductModuleService.java

@@ -1,10 +1,8 @@
 package com.caimei.module.product.service;
 
 import com.caimei.module.base.entity.bo.PageVo;
-import com.caimei.module.base.entity.vo.BigtypeVo;
-import com.caimei.module.base.entity.vo.LadderPriceVo;
-import com.caimei.module.base.entity.vo.ProductVo;
-import com.caimei.module.base.entity.vo.SearchHistoryVo;
+import com.caimei.module.base.entity.po.SeconHandProduct;
+import com.caimei.module.base.entity.vo.*;
 
 import java.util.List;
 
@@ -71,4 +69,14 @@ public interface ProductModuleService {
      * 相关推荐-根据id
      */
     List<ProductVo> getRecommended(Integer productID);
+
+    /**
+     * 二手商品通过地址ID获取详细省市区
+     */
+     AddressVo getAddressInfo(Integer townId);
+
+    /**
+     * 二手商品数据保存操作
+     */
+    void saveSencondHandProduct(SeconHandProduct seconHandProduct);
 }

+ 11 - 0
product/src/main/java/com/caimei/module/product/service/impl/ProductModuleServiceImpl.java

@@ -1,6 +1,7 @@
 package com.caimei.module.product.service.impl;
 
 import com.caimei.module.base.entity.bo.PageVo;
+import com.caimei.module.base.entity.po.SeconHandProduct;
 import com.caimei.module.base.entity.vo.*;
 import com.caimei.module.product.dao.ProductModuleDao;
 import com.caimei.module.product.service.ProductModuleService;
@@ -144,6 +145,16 @@ public class ProductModuleServiceImpl implements ProductModuleService {
         return productList;
     }
 
+    @Override
+    public AddressVo getAddressInfo(Integer townId){
+        return productModuleDao.getAddressInfo(townId);
+    }
+
+    @Override
+    public void saveSencondHandProduct(SeconHandProduct seconHandProduct) {
+        productModuleDao.saveSencondHandProduct(seconHandProduct);
+    }
+
     /**
      * 商品搜索历史记录
      */

+ 121 - 0
product/src/main/resources/com-caimei-module-product/ProductModuleMapper.xml

@@ -143,6 +143,14 @@
         where productID = #{productID,jdbcType=INTEGER}
         ORDER BY mainFlag DESC
     </select>
+    <select id="findImageByProductId" resultType="String">
+        select
+        image
+        from productimage
+        where productID = #{productID,jdbcType=INTEGER}
+        ORDER BY mainFlag DESC
+    </select>
+
     <select id="findProductImageString" resultType="string">
         select
         image
@@ -196,6 +204,11 @@
         </set>
         where id = #{id,jdbcType=BIGINT}
     </update>
+    <update id="updateViewingNum">
+        UPDATE cm_second_hand_detail SET
+        viewingNum = #{viewingNum}
+        WHERE id = #{id}
+    </update>
     <insert id="insertSearchHistory" keyColumn="id" keyProperty="id" parameterType="com.caimei.module.base.entity.vo.SearchHistoryVo">
         insert into user_search_history
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -227,6 +240,67 @@
           </if>
         </trim>
     </insert>
+
+    <insert id="saveSencondHandProduct"  parameterType="com.caimei.module.base.entity.po.SeconHandProduct"  keyProperty="id" useGeneratedKeys="true">
+        INSERT INTO cm_second_hand_detail(
+			productID,
+			sold,
+			secondHandType,
+			instrumentType,
+			fixedYears,
+			maturityYears,
+			companyName,
+			detailTalkFlag,
+			originalPrice,
+			contactName,
+			contactMobile,
+			secondProductType,
+			townId,
+			brandName,
+			provinceCityDistrict,
+			address,
+			productQuality,
+			productDetails,
+			viewingNum,
+			payStatus,
+			payAmount,
+			payFormData,
+			payType,
+			payDate,
+			submitDate,
+			reviewedDate,
+			onLineDate
+		) VALUES (
+			#{productID},
+			#{sold},
+			#{secondHandType},
+			#{instrumentType},
+			#{fixedYears},
+			#{maturityYears},
+			#{companyName},
+			#{detailTalkFlag},
+			#{originalPrice},
+			#{contactName},
+			#{contactMobile},
+			#{secondProductType},
+			#{townId},
+			#{brandName},
+			#{provinceCityDistrict},
+			#{address},
+			#{productQuality},
+			#{productDetails},
+			#{viewingNum},
+			#{payStatus},
+			#{payAmount},
+			#{payFormData},
+			#{payType},
+			#{payDate},
+			#{submitDate},
+			#{reviewedDate},
+			#{onLineDate}
+		)
+    </insert>
+
     <!--删除大于10条的历史记录-->
     <delete id="deleteSearchHistoryByUserId">
         DELETE FROM user_search_history
@@ -237,6 +311,17 @@
             ) AS temp
         )
     </delete>
+
+    <select id="getAddressInfo" resultType="com.caimei.module.base.entity.vo.AddressVo">
+		SELECT a.name as "province"
+		,b.name as "city"
+		,c.name as "town"
+		,c.townId as "townID"
+		FROM province a
+			RIGHT JOIN city b ON a.provinceId = b.provinceId
+			RIGHT JOIN town c ON b.cityId = c.cityId WHERE c.townId = #{townId}
+	</select>
+
     <delete id="deleteAllSearchHistory">
         DELETE FROM
             user_search_history
@@ -279,4 +364,40 @@
         order by sellNumber desc,onlineTime desc
         limit 7
     </select>
+
+
+    <select id="getSeconHandProductList" resultType="com.caimei.module.base.entity.po.SeconHandProduct">
+        SELECT
+	        *,IF(p.brandID != 161,cb.name ,cshd.brandName) as "brandName"
+        FROM
+            product p
+        LEFT JOIN cm_second_hand_detail cshd ON p.productID = cshd.productID
+        left join cm_brand cb on cb.id = p.brandID
+        WHERE
+            p.productCategory = 2
+        AND p.validFlag = 2
+        <if test="secondHandType != null and secondHandType != ''">
+            and cshd.secondHandType = #{secondHandType}
+        </if>
+        <if test="instrumentType != null and instrumentType != '' and instrumentType != '0'  and instrumentType != 0">
+            and cshd.instrumentType like CONCAT('%',#{instrumentType},'%')
+        </if>
+        ORDER BY cshd.onLineDate DESC
+    </select>
+    <select id="getSencondHandProductDetail" resultType="com.caimei.module.base.entity.po.SeconHandProduct">
+        SELECT
+	        *,cb.name as "brandName"
+        FROM
+            product p
+        LEFT JOIN cm_second_hand_detail cshd ON p.productID = cshd.productID
+        left join cm_brand cb on cb.id = p.brandID
+        WHERE
+            p.productCategory = 2
+        AND p.productID = #{productId}
+    </select>
+    <select id="getBrandList" resultType="com.caimei.module.base.entity.po.CmBrand">
+        select b.id AS id, b.name AS name from cm_brand b
+		where b.status = '1' and b.delFlag = '0' and b.description is not null and b.description != '' and b.id not in (161)
+		order by b.sort
+    </select>
 </mapper>