喻健
2018-11-14 ed0921d4c7e4556002c8079eeb9f3218b6357872
搜索接口添加筛选比例范围
5个文件已修改
59 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/SearchController.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/lable/QualityFactoryMapper.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/lable/QualityGoodsServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/lable/QualityGoodsService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/SearchController.java
@@ -422,7 +422,7 @@
     */
    @RequestMapping(value = "searchgoods")
    public void searchgoods(AcceptData acceptData, String kw, int page, String filter, String order, String startprice,
            String endprice, String fastFilter, PrintWriter out) {
            String endprice, Double startTkRate, Double endTkRate, String fastFilter, PrintWriter out) {
        String bid = getHistorySearchBid(acceptData);
@@ -467,10 +467,10 @@
        JSONObject data = null;
        if (!recommend) {
            // 淘宝接口请求
            data = searchGoods(kw, page, filter, order, startprice, endprice);
            data = searchGoods(kw, page, filter, order, startprice, endprice, startTkRate, endTkRate);
        } else {
            // 推荐:精选库
            data = searchQualityGoods(kw, page, filter, order, startprice, endprice);
            data = searchQualityGoods(kw, page, filter, order, startprice, endprice, startTkRate, endTkRate);
        }
        // 获取推荐词
@@ -501,7 +501,7 @@
     * @return
     */
    private JSONObject searchGoods(String kw, int page, String filter, String order, String startprice,
            String endprice) {
            String endprice, Double startTkRate, Double endTkRate) {
        page = page + 1;
        SearchFilter sf = new SearchFilter();
@@ -515,6 +515,20 @@
        if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(endprice)) {
            sf.setEndPrice(new BigDecimal(endprice));
        }
        if (startTkRate != null && startTkRate != 0 && !startTkRate.equals(0)) {
            BigDecimal b = new BigDecimal(startTkRate/2);
            double df = b.setScale(2, BigDecimal.ROUND_FLOOR).doubleValue();
            int tkRate = (int) (df * 100);
            sf.setStartTkRate(tkRate);
        }
        if (endTkRate != null && endTkRate != 0 && !endTkRate.equals(0)) {
            BigDecimal b = new BigDecimal(endTkRate/2);
            double df = b.setScale(2, BigDecimal.ROUND_FLOOR).doubleValue();
            int tkRate = (int) (df * 100);
            sf.setEndTkRate(tkRate);
        }
        if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(order)) {
@@ -679,7 +693,7 @@
     * @return
     */
    private JSONObject searchQualityGoods(String key, int page, String filter, String order, String startprice,
            String endprice) {
            String endprice, Double startTkRate, Double endTkRate) {
        Integer hasQuan = null;
        Integer userType = null;
@@ -731,7 +745,7 @@
        int pageSize = Constant.PAGE_SIZE;
        List<QualityFactory> listQuery = qualityGoodsService.listRecommendBykey(page * pageSize, pageSize, key, hasQuan,
                userType, start_Price, end_Price, sort);
                userType, start_Price, end_Price, startTkRate, endTkRate, sort);
        List<TaoBaoGoodsBriefExtra> listExtra = new ArrayList<TaoBaoGoodsBriefExtra>();
        Map<String, String> map = manageService.convertMap();
@@ -767,7 +781,7 @@
            }
        }
        long count = qualityGoodsService.countRecommendBykey(key, hasQuan, userType, start_Price, end_Price);
        long count = qualityGoodsService.countRecommendBykey(key, hasQuan, userType, start_Price, end_Price, startTkRate, endTkRate);
        // 设置发货地址
        TaoBaoSearchNav nav = new TaoBaoSearchNav();
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/lable/QualityFactoryMapper.java
@@ -337,10 +337,13 @@
    List<QualityFactory> listRecommendBykey(@Param("start") long start, @Param("count") int count, 
            @Param("key") String key,@Param("hasQuan") Integer hasQuan,  @Param("userType") Integer userType,
            @Param("startprice") Double startprice, @Param("endprice") Double endprice,
            @Param("startTkRate") Double startTkRate, @Param("endTkRate") Double endTkRate,
            @Param("sort") Integer sort);
    
    long countRecommendBykey(@Param("key") String key, @Param("hasQuan") Integer hasQuan,  
            @Param("userType") Integer userType,@Param("startprice") Double startprice, @Param("endprice") Double endprice);
            @Param("userType") Integer userType,@Param("startprice") Double startprice,
            @Param("endprice") Double endprice,@Param("startTkRate") Double startTkRate,
            @Param("endTkRate") Double endTkRate);
    List<QualityFactory> listQueryBylabIDs(@Param("start") long start, @Param("count") int count, 
fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml
@@ -1077,6 +1077,13 @@
          <if test='endprice != null'>
               AND <![CDATA[  tb.`zkPrice` <= #{endprice}]]>
        </if>
        <!-- 返利比范围  -->
         <if test='startTkRate != null'>
               AND <![CDATA[  tb.`tkRate` >= #{startTkRate}]]>
         </if>
          <if test='endTkRate != null'>
               AND <![CDATA[  tb.`tkRate` <= #{endTkRate}]]>
        </if>
        <!-- 有券  -->
        <if test='hasQuan != null'>
               AND <![CDATA[  tb.`couponLeftCount` > 1]]>
@@ -1130,6 +1137,13 @@
          <if test='endprice != null'>
               AND <![CDATA[  tb.`zkPrice` <= #{endprice}]]>
        </if>
        <!-- 返利比范围  -->
         <if test='startTkRate != null'>
               AND <![CDATA[  tb.`tkRate` >= #{startTkRate}]]>
         </if>
          <if test='endTkRate != null'>
               AND <![CDATA[  tb.`tkRate` <= #{endTkRate}]]>
        </if>
        <!-- 有券  -->
        <if test='hasQuan != null'>
               AND <![CDATA[  tb.`couponLeftCount` > 1]]>
fanli/src/main/java/com/yeshi/fanli/service/impl/lable/QualityGoodsServiceImpl.java
@@ -244,15 +244,15 @@
    
    @Override
    public List<QualityFactory> listRecommendBykey(long start, int count, String key, Integer hasQuan,
            Integer userType, Double startprice, Double endprice, Integer sort) {
            Integer userType, Double startprice, Double endprice, Double startTkRate, Double endTkRate, Integer sort) {
        return qualityFactoryMapper.listRecommendBykey(start, count, key, hasQuan, userType,
                startprice, endprice, sort);
                startprice, endprice, startTkRate, endTkRate, sort);
    }
    @Override
    public long countRecommendBykey(String key, Integer hasQuan, Integer userType,
            Double startprice, Double endprice) {
        return qualityFactoryMapper.countRecommendBykey(key, hasQuan, userType, startprice, endprice);
            Double startprice, Double endprice, Double startTkRate, Double endTkRate) {
        return qualityFactoryMapper.countRecommendBykey(key, hasQuan, userType, startprice, endprice, startTkRate, endTkRate);
    }
    
    
fanli/src/main/java/com/yeshi/fanli/service/inter/lable/QualityGoodsService.java
@@ -156,10 +156,10 @@
     * @return
     */
    public List<QualityFactory> listRecommendBykey(long start, int count, String key, Integer hasQuan,
            Integer userType, Double startprice, Double endprice, Integer sort);
            Integer userType, Double startprice, Double endprice, Double startTkRate, Double endTkRate, Integer sort);
    
    public long countRecommendBykey(String key, Integer hasQuan, Integer userType, 
            Double startprice, Double endprice);
            Double startprice, Double endprice, Double startTkRate, Double endTkRate);
    
    
    /**