浏览代码

Merge remote-tracking branch 'origin/developer' into developerA

chao 3 年之前
父节点
当前提交
8b418c3125

+ 11 - 2
src/main/java/com/caimei365/commodity/components/PriceUtilService.java

@@ -107,8 +107,17 @@ public class PriceUtilService {
         price.setActStatus(0);
         // 用户身份: 2-会员机构, 4-普通机构
         price.setUserIdentity(identity);
-        // 设置价格标志(协销|价格公开|仅对医美机构公开|仅对会员机构公开)
-        boolean setFlag = identity == 1 || priceFlag == 0 || (priceFlag == 3 && clubType == 1) || (priceFlag == 2 && (identity == 2 || isSuperVip));
+        //是否是供应商自己的商品
+        boolean isShopOwn = false;
+        if (identity == 3){
+            // 根据用户Id查询供应商Id
+            Integer shopId = priceMapper.getShopIdByUserId(userId);
+            if (null != shopId && shopId.equals(price.getShopId())){
+                isShopOwn = true;
+            }
+        }
+        // 设置价格标志(协销|价格公开|仅对医美机构公开|仅对会员机构公开|供应商自己的商品)
+        boolean setFlag = identity == 1 || priceFlag == 0 || (priceFlag == 3 && clubType == 1) || (priceFlag == 2 && (identity == 2 || isSuperVip)) || isShopOwn;
         if (setFlag) {
             // 设置划线价
             price.setOriginalPrice(price.getPrice());

+ 1 - 1
src/main/java/com/caimei365/commodity/controller/ProductPageApi.java

@@ -134,7 +134,7 @@ public class ProductPageApi {
     }
 
     /**
-     * 活动专题楼层数据(美博会)
+     * 活动专题楼层数据(美博会
      *
      * @param pageId 页面id
      * @param userId 用户id

+ 4 - 0
src/main/java/com/caimei365/commodity/mapper/PriceMapper.java

@@ -65,4 +65,8 @@ public interface PriceMapper {
      * 会员机构类型:1医美,2生美
      */
     Integer getClubTypeById(Integer userId);
+    /**
+     * 根据用户Id查询供应商Id
+     */
+    Integer getShopIdByUserId(Integer userId);
 }

+ 1 - 1
src/main/java/com/caimei365/commodity/service/PageService.java

@@ -68,7 +68,7 @@ public interface PageService {
     ResponseJson<Map<String, Object>> getPageFloors(Integer pageId, Integer source);
 
     /**
-     * 活动专题楼层数据(美博会)
+     * 活动专题楼层数据(美博会
      *
      * @param pageId 页面id
      * @param userId 用户id

+ 2 - 2
src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java

@@ -351,13 +351,13 @@ public class PageServiceImpl implements PageService {
     }
 
     /**
-     * 活动专题楼层数据(美博会)
+     * 活动专题楼层数据(美博会
      *
      * @param pageId 页面id
      * @param userId 用户id
      * @param source 来源 : 1 网站 ; 2 小程序
      */
-    @Cacheable(value = "getPageBeautyData", key = "#userId +'-'+ #pageId +'-'+ #source", unless = "#result == null")
+    @Cacheable(value = "activityData", key = "#userId +'-'+ #pageId +'-'+ #source", unless = "#result == null")
     @Override
     public ResponseJson<Map<String, Object>> getPageBeautyData(Integer pageId, Integer userId, Integer source) {
         if (pageId == null) {

+ 9 - 5
src/main/resources/mapper/CouponMapper.xml

@@ -8,8 +8,8 @@
         cc.`id` AS "couponId",
         cc.`couponAmount`,
         cc.`touchPrice`,
-        a.`createDate` as `startDate`,
-        date_add(a.createDate,interval cc.usePeriod DAY) as `endDate`,
+        if(cc.vipFlag = 1,cc.startDate,a.createDate) as startDate,
+        if(cc.vipFlag = 1,cc.endDate,date_add(a.createDate,interval cc.usePeriod day)) as endDate,
         cc.`couponType`,
         cc.`userId`,
         cc.`shopId`,
@@ -24,14 +24,18 @@
         AND a.userId = #{userId}
         <if test="status == 1">
             AND a.status = 1
-            AND NOW() <![CDATA[ < ]]> date_add(a.createDate,interval cc.usePeriod DAY)
+            AND if(cc.vipFlag = 1,
+                NOW() BETWEEN cc.startDate AND cc.endDate,
+                NOW() <![CDATA[ < ]]> date_add(a.createDate,interval cc.usePeriod DAY))
         </if>
         <if test="status == 2">
             AND a.status = 2
         </if>
         <if test="status == 3">
             AND a.status = 1
-            AND NOW() <![CDATA[ > ]]> date_add(a.createDate,interval cc.usePeriod DAY)
+            AND if(cc.vipFlag = 1,
+                NOW() > cc.endDate,
+                NOW() <![CDATA[ > ]]> date_add(a.createDate,interval cc.usePeriod DAY))
         </if>
         AND cc.status != 2
         ORDER BY
@@ -166,7 +170,7 @@
         SELECT `id` AS "couponId",
                `couponAmount`,
                `touchPrice`,
-               if(#{registerTime} <![CDATA[ > ]]> startDate,#{registerTime},startDate),
+               if(#{registerTime} <![CDATA[ > ]]> startDate,#{registerTime},startDate) as startDate,
                if(receiveFlag=1,endDate,date_add(if(#{registerTime} <![CDATA[ > ]]> startDate,#{registerTime},startDate),
                    interval receivePeriod day)) as endDate,
                date_add(NOW(),interval usePeriod day ) as usePeriod,

+ 3 - 0
src/main/resources/mapper/PriceMapper.xml

@@ -140,4 +140,7 @@
     <select id="getClubTypeById" resultType="java.lang.Integer">
         SELECT firstClubType FROM club WHERE userID = #{userId}
     </select>
+    <select id="getShopIdByUserId" resultType="java.lang.Integer">
+        SELECT shopID FROM shop WHERE userID = #{userId}
+    </select>
 </mapper>

+ 0 - 1
src/main/resources/mapper/SearchMapper.xml

@@ -127,7 +127,6 @@
         s.businessScope as s_business,
         s.townID as s_town_id,
         CONCAT(p.name, c.name) as s_address,
-        s.sortIndex as s_sort,
         s.status as s_valid
     </sql>
     <sql id="Supplier_Joins">