admin
2019-08-15 4e61ba25544cbcc04f523505696cb7cce8e106bf
京东商品过滤,用户被封上级邀请订单失效
10个文件已修改
192 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/JingDongControllerV2.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2Mapper.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/jd/JDPingouInfo.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2Mapper.xml 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/JDCommonTemplateContentServiceImpl.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/jd/JDGoodsServiceImpl.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/hongbao/HongBaoV2Service.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/tag/PageEntity.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/JingDongControllerV2.java
@@ -28,6 +28,7 @@
import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
import com.yeshi.fanli.util.jd.JDApiUtil;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
import net.sf.json.JSONArray;
@@ -70,9 +71,9 @@
    @Resource
    private JDGoodsService jdGoodsService;
    
    /**
     * 京东专题分类
     *
     * @param acceptData
     * @param out
     */
@@ -87,6 +88,7 @@
    
    /**
     * 京东专题 + 商品列表
     *
     * @param acceptData
     * @param out
     */
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2Mapper.java
@@ -141,7 +141,6 @@
    Long countInviteOrderCountByUidAndSettleTime(@Param("uid") Long uid, @Param("state") int state,
            @Param("minDate") Date minDate, @Param("maxDate") Date maxDate);
    
    /**
     * 根据用户ID,订单状态和结算时间统计分享赚的订单数量
     * 
@@ -173,8 +172,31 @@
    
    /**
     * 最近30天内产生过分享订单的用户
     *
     * @return
     */
    List<Long> getUidByNear30DayShareSucceed();
    
    /**
     * 根据父用户ID,状态,类型查询
     *
     * @param uid
     * @param typeList
     * @param stateList
     * @return
     */
    List<HongBaoV2> listByParentUidAndTypeAndState(@Param("uid") Long uid, @Param("typeList") List<Integer> typeList,
            @Param("stateList") List<Integer> stateList, @Param("start") long start, @Param("count") int count);
    /**
     * 根据父用户ID,状态,类型查询数量
     *
     * @param uid
     * @param typeList
     * @param stateList
     * @return
     */
    long countByParentUidAndTypeAndState(@Param("uid") Long uid, @Param("typeList") List<Integer> typeList,
            @Param("stateList") List<Integer> stateList);
}
fanli/src/main/java/com/yeshi/fanli/dto/jd/JDPingouInfo.java
@@ -1,8 +1,13 @@
package com.yeshi.fanli.dto.jd;
import java.io.Serializable;
import java.math.BigDecimal;
public class JDPingouInfo {
public class JDPingouInfo implements Serializable{
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private BigDecimal pingouPrice;
    private Long pingouTmCount;
    private String pingouUrl;
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2Mapper.xml
@@ -294,13 +294,53 @@
    <select id="getUidByNear30DayShareSucceed" resultType="java.lang.Long">
        SELECT v2.`hb_uid` FROM yeshi_ec_hongbao_v2 v2
        WHERE  v2.`hb_type` = 20 AND v2.`hb_state`<![CDATA[<>]]> 4
        WHERE v2.`hb_type` = 20
        AND v2.`hb_state`<![CDATA[<>]]>
        4
              AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) <![CDATA[<=]]>DATE(v2.`hb_create_time`)
        GROUP BY v2.`hb_uid`
        ORDER BY v2.`hb_create_time`;
    </select>
    <select id="listByParentUidAndTypeAndState" resultMap="BaseResultMap">
        SELECT v.* FROM yeshi_ec_hongbao_v2 v LEFT JOIN yeshi_ec_hongbao_v2 p
        ON v.`hb_pid`=p.`hb_id` WHERE p.`hb_uid`=#{uid}
        <if test="typeList!=null">
            <foreach collection="typeList" item="type" open=" and ("
                separator=" or " close=")">
                v.hb_type=#{type}
            </foreach>
        </if>
        <if test="stateList!=null">
            <foreach collection="stateList" item="state" open=" and ("
                separator=" or " close=")">
                v.hb_state=#{state}
            </foreach>
        </if>
        limit #{start},#{count}
    </select>
    <select id="countByParentUidAndTypeAndState" resultType="java.lang.Long">
        SELECT count(v.hb_id) FROM yeshi_ec_hongbao_v2 v LEFT JOIN
        yeshi_ec_hongbao_v2 p
        ON v.`hb_pid`=p.`hb_id` WHERE p.`hb_uid`=#{uid}
        <if test="typeList!=null">
            <foreach collection="typeList" item="type" open=" and ("
                separator=" or " close=")">
                v.hb_type=#{type}
            </foreach>
        </if>
        <if test="stateList!=null">
            <foreach collection="stateList" item="state" open=" and ("
                separator=" or " close=")">
                v.hb_state=#{state}
            </foreach>
        </if>
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT}
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/JDCommonTemplateContentServiceImpl.java
@@ -1,6 +1,8 @@
package com.yeshi.fanli.service.impl.goods;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.cache.annotation.Cacheable;
@@ -8,6 +10,7 @@
import com.yeshi.fanli.dto.common.JDCommonContentTypeEnum;
import com.yeshi.fanli.dto.jd.JDSearchResult;
import com.yeshi.fanli.entity.jd.JDGoods;
import com.yeshi.fanli.service.inter.goods.JDCommonTemplateContentService;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
@@ -17,7 +20,6 @@
public class JDCommonTemplateContentServiceImpl implements JDCommonTemplateContentService {
    private Map<String, Long> countMap = new HashMap<String, Long>();
    @Cacheable(value = "jdCommonContentCache", key = "#type+'-'+#cid+'-'+#page+'-'+#pageSize")
    @Override
@@ -36,32 +38,48 @@
        return null;
    }
    private JDSearchResult get9K9Content(String cid, int page, int pageSize) {
        int[] arrayId = {10, 17};
        return getJingFenGoods(page, pageSize, "9k9-", arrayId);
        JDSearchResult result = getJingFenGoods(page, pageSize, "9k9-", arrayId);
        return filterGoods(result);
    }
    private JDSearchResult filterGoods(JDSearchResult result) {
        List<Long> skuIds = new ArrayList<>();
        if (result != null && result.getGoodsList() != null && result.getGoodsList().size() > 0) {
            for (JDGoods goods : result.getGoodsList()) {
                skuIds.add(goods.getSkuId());
            }
            List<JDGoods> goodsList = JDApiUtil.listGoodsDetail(skuIds);
            result.setGoodsList(goodsList);
        }
        return result;
    }
    
    private JDSearchResult getJDPeiSongContent(String cid, int page, int pageSize) {
        int[] arrayId = {15, 18};
        return getJingFenGoods(page, pageSize, "peisong-", arrayId);
        JDSearchResult result = getJingFenGoods(page, pageSize, "peisong-", arrayId);
        return filterGoods(result);
    }
    
    private JDSearchResult getJiaDianContent(String cid, int page, int pageSize) {
        int[] arrayId = {5, 2};
        return getJingFenGoods(page, pageSize, "jiadian-", arrayId);
        JDSearchResult result = getJingFenGoods(page, pageSize, "jiadian-", arrayId);
        return filterGoods(result);
    }
    
    private JDSearchResult getBaiHuoContent(String cid, int page, int pageSize) {
        int[] arrayId = {6, 3};
        return getJingFenGoods(page, pageSize, "baihuo-", arrayId);
        JDSearchResult result = getJingFenGoods(page, pageSize, "baihuo-", arrayId);
        return filterGoods(result);
    }
    
    private JDSearchResult getJuJiaContent(String cid, int page, int pageSize) {
        int[] arrayId = {7, 4};
        return getJingFenGoods(page, pageSize, "jujia-", arrayId);
        JDSearchResult result = getJingFenGoods(page, pageSize, "jujia-", arrayId);
        return filterGoods(result);
    }
    
    /**
     * 9快9包邮
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java
@@ -1047,4 +1047,30 @@
    public List<Long> getUidByNear30DayShareSucceed() {
        return hongBaoV2Mapper.getUidByNear30DayShareSucceed();
    }
    @Override
    public void invalidInviteHongBaoByParentUid(Long parentUid, String beiZhu) {
        List<Integer> typeList = new ArrayList<>();
        typeList.add(HongBaoV2.TYPE_YIJI);
        typeList.add(HongBaoV2.TYPE_ERJI);
        typeList.add(HongBaoV2.TYPE_SHARE_YIJI);
        typeList.add(HongBaoV2.TYPE_SHARE_ERJI);
        List<Integer> stateList = new ArrayList<>();
        stateList.add(HongBaoV2.STATE_KELINGQU);
        stateList.add(HongBaoV2.STATE_BUKELINGQU);
        long count = hongBaoV2Mapper.countByParentUidAndTypeAndState(parentUid, typeList, stateList);
        int page = (int) (count % 100 == 0 ? count / 100 : count / 100 + 1);
        for (int i = 1; i <= page; i++) {
            List<HongBaoV2> list = hongBaoV2Mapper.listByParentUidAndTypeAndState(parentUid, typeList, stateList,
                    0, 100);
            if (list != null)
                for (HongBaoV2 v2 : list) {
                    HongBaoV2 update = new HongBaoV2(v2.getId());
                    update.setUpdateTime(new Date());
                    update.setState(HongBaoV2.STATE_SHIXIAO);
                    update.setBeizhu(beiZhu);
                    hongBaoV2Mapper.updateByPrimaryKeySelective(update);
                }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/jd/JDGoodsServiceImpl.java
@@ -144,7 +144,7 @@
            if (result == null) {
                return null;
            } else {
                return result.getGoodsList();
                return filterJDGoods(result.getGoodsList());
            }
        }
@@ -164,7 +164,24 @@
                list.addAll(listGoods);
            }
        }
        return list;
        return filterJDGoods(list);
    }
    /**
     * 过滤商品
     *
     * @param goodsList
     * @return
     */
    private List<JDGoods> filterJDGoods(List<JDGoods> goodsList) {
        List<Long> skuIds = new ArrayList<>();
        for (JDGoods goods : goodsList) {
            skuIds.add(goods.getSkuId());
        }
        List<JDGoods> newGoodsList = JDApiUtil.listGoodsDetail(skuIds);
        if (newGoodsList != null && newGoodsList.size() > 0)
            return newGoodsList;
        return goodsList;
    }
    private List<JDGoods> search(int page, int pageSize, String jdcid) {
fanli/src/main/java/com/yeshi/fanli/service/inter/hongbao/HongBaoV2Service.java
@@ -34,7 +34,6 @@
     */
    public void addHongBao(List<CommonOrder> commonOrder, int type) throws HongBaoException;
    /**
     * 奖金列表(1.4.9之前的版本)
     * 
@@ -114,9 +113,9 @@
     */
    BigDecimal getUnRecievedMoneyWithPreGetTime(Long uid, Date minDate, Date maxDate);
    
    /**
     * 计算资金
     *
     * @param uid
     * @param state
     * @return
@@ -125,6 +124,7 @@
    /**
     * 查询子红包
     *
     * @param id
     * @return
     */
@@ -132,8 +132,16 @@
    /**
     * 最近30天内产生过分享订单的用户
     *
     * @return
     */
    public List<Long> getUidByNear30DayShareSucceed();
    /**
     * 让邀请赚失效(根据下级用户ID)
     * @param parentUid
     * @param beiZhu
     */
    public void invalidInviteHongBaoByParentUid(Long parentUid, String beiZhu);
}
fanli/src/main/java/com/yeshi/fanli/tag/PageEntity.java
@@ -1,10 +1,15 @@
package com.yeshi.fanli.tag;
import java.io.Serializable;
import java.util.Map;
import com.google.gson.annotations.Expose;
public class PageEntity {
public class PageEntity implements Serializable{
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private String url; //
    @Expose
    private int pageIndex;//
fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java
@@ -51,8 +51,6 @@
    public static int ORDER_TYPE_FINISHTIME = 2;// 完成时间
    public static int ORDER_TYPE_UPDATETIME = 3;// 更新时间
    private static String post2(String url, Map<String, String> params) {
        String baseUrl = url;
        List<String> paramsList = new ArrayList<>();
@@ -175,6 +173,19 @@
    }
    /**
     * 通过商品搜索接口批量获取详情
     *
     * @param skuIds
     * @return
     */
    public static List<JDGoods> listGoodsDetail(List<Long> skuIds) {
        JDFilter filter = new JDFilter();
        filter.setListId(skuIds);
        JDSearchResult result = queryByKey(filter);
        return result.getGoodsList();
    }
    /**
     * 关键词商品查询接口【申请】
     * 
     * @param skuIdList