yujian
2019-05-15 7d3ceb65d62a74773e0b21214dafa2fc00bc1282
过滤重复足迹、重复商品
4个文件已修改
48 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/BrandController.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/brand/TaoBaoShopHistoryMapper.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoShopMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/src/main/java/org/yeshi/utils/DateUtil.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/BrandController.java
@@ -275,6 +275,25 @@
                int needCount = pageSize- listGoodsBrief.size();
                List<TaoBaoGoodsBrief> listGoods = taoBaoGoodsBriefService.listByShopId(0, needCount, sid);
                if (listGoods != null && listGoods.size() > 0) {
                    if (listGoodsBrief.size() > 0) {
                        for (int i = 0; i< listGoods.size(); i ++) {
                            long id = listGoods.get(i).getAuctionId();
                            boolean isRepeat = false;
                            for (TaoBaoGoodsBrief goodsBrief: listGoodsBrief) {
                                long auctionId = goodsBrief.getAuctionId();
                                if (auctionId == id) {
                                    isRepeat = true;
                                    break;
                                }
                            }
                            if(isRepeat) {
                                listGoods.remove(i);
                                i--;
                            }
                        }
                    }
                    listGoodsBrief.addAll(listGoods);
                }
            }
fanli/src/main/java/com/yeshi/fanli/mapping/brand/TaoBaoShopHistoryMapper.xml
@@ -65,38 +65,44 @@
  <select id="getByUid" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_taobao_shop_history h 
    WHERE h.tsh_uid = #{uid} AND h.tsh_shop_id = #{shopId}
    ORDER BY  h.tsh_update_time DESC
    LIMIT 1
  </select>
  
  <select id="getByDevice" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_taobao_shop_history h 
    WHERE  h.tsh_device = #{device} AND h.tsh_shop_id = #{shopId}
    ORDER BY  h.tsh_update_time DESC
    LIMIT 1
  </select>
  
  <select id="listByUid" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_taobao_shop_history h
    SELECT * FROM (SELECT `tsh_id` FROM yeshi_ec_taobao_shop_history
        WHERE tsh_uid = #{uid} AND tsh_state = 0
        GROUP BY `tsh_shop_id`) A
    LEFT JOIN yeshi_ec_taobao_shop_history h on  A.tsh_id = h.tsh_id
    LEFT JOIN `yeshi_ec_taobao_shop_info` p ON h.`tsh_shop_id` = p.`tsi_id`
    WHERE h.tsh_uid = #{uid} AND tsh_state = 0
    ORDER BY  h.tsh_update_time DESC
    LIMIT ${start},${count}
  </select>
  
  <select id="countByUid" resultType="Long">
      SELECT IFNULL(COUNT(tsh_id),0) FROM yeshi_ec_taobao_shop_history
      SELECT IFNULL(COUNT(DISTINCT tsh_shop_id),0) FROM yeshi_ec_taobao_shop_history
    WHERE tsh_uid = #{uid} AND tsh_state = 0
  </select>
  
   <select id="listByDevice" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_taobao_shop_history h
      SELECT * FROM (SELECT `tsh_id` FROM yeshi_ec_taobao_shop_history
        WHERE tsh_device = #{device} AND tsh_state = 0
        GROUP BY `tsh_shop_id`) A
    LEFT JOIN yeshi_ec_taobao_shop_history h on  A.tsh_id = h.tsh_id
      LEFT JOIN `yeshi_ec_taobao_shop_info` p ON h.`tsh_shop_id` = p.`tsi_id`
    WHERE h.tsh_device = #{device} AND tsh_state = 0
    ORDER BY h.tsh_update_time DESC
    LIMIT ${start},${count}
  </select>
  
   <select id="countByDevice" resultType="Long">
      SELECT IFNULL(COUNT(tsh_id),0) FROM yeshi_ec_taobao_shop_history
      SELECT IFNULL(COUNT(DISTINCT tsh_shop_id),0) FROM yeshi_ec_taobao_shop_history
    WHERE tsh_device = #{device} AND tsh_state = 0
  </select>
  
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoShopMapper.xml
@@ -173,7 +173,8 @@
        SELECT tt.*,tg.* FROM 
            (SELECT COUNT(t.`id`) AS totalGoods,t.`sellerId` FROM `yeshi_ec_taobao_goods` t 
            LEFT JOIN `yeshi_ec_brand_class_shop` p ON t.`sellerId` = p.bcs_shop_id
            WHERE p.`bcs_id` IS NOT NULL AND p.`bcs_state` = 1 <if test="cid != null">AND p.`bcs_cid` =#{cid}</if>
            WHERE p.`bcs_id` IS NOT NULL AND p.`bcs_state` = 1 AND t.`couponAmount` > 0
                <if test="cid != null">AND p.`bcs_cid` =#{cid}</if>
            GROUP BY t.`sellerId` HAVING totalGoods<![CDATA[>]]> 2
            ORDER BY p.`bcs_top`,p.`bcs_create_time` DESC
            LIMIT ${start},${count}
@@ -189,7 +190,8 @@
    <select id="countBrandShopinfo"  resultType="Long">
        SELECT IFNULL(COUNT(*),0) FROM (SELECT COUNT(t.`id`) AS totalGoods FROM `yeshi_ec_taobao_goods` t 
            LEFT JOIN `yeshi_ec_brand_class_shop` p ON t.`sellerId` = p.bcs_shop_id
            WHERE p.`bcs_id` IS NOT NULL AND p.`bcs_state` = 1 <if test="cid != null">AND p.`bcs_cid` =#{cid}</if>
            WHERE p.`bcs_id` IS NOT NULL AND p.`bcs_state` = 1 AND t.`couponAmount` > 0
                <if test="cid != null">AND p.`bcs_cid` =#{cid}</if>
            GROUP BY t.`sellerId` HAVING totalGoods<![CDATA[>]]> 2)a
    </select>
    
utils/src/main/java/org/yeshi/utils/DateUtil.java
@@ -253,10 +253,11 @@
    /**
     * 随机减去几分钟
     * @param date
     * @param min 随机添加的分钟数
     * @return
     */
    public static Date reduceRandomMinute(Date date) {
        long rand = (long) (Math.random() * 60 * 8);
    public static Date reduceRandomMinute(Date date , int min) {
        long rand = (long) (Math.random() * 1000 * 60 * min);
        long time = date.getTime() - rand;
        return new Date(time);
    }