admin
2019-08-15 4e61ba25544cbcc04f523505696cb7cce8e106bf
京东商品过滤,用户被封上级邀请订单失效
10个文件已修改
274 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/JingDongControllerV2.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2Mapper.java 32 ●●●● 补丁 | 查看 | 原始文档 | 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 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/JDCommonTemplateContentServiceImpl.java 68 ●●●●● 补丁 | 查看 | 原始文档 | 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 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/tag/PageEntity.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java 19 ●●●● 补丁 | 查看 | 原始文档 | 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;
@@ -54,25 +55,25 @@
    @Resource
    private DaTaoKeGoodsService daTaoKeGoodsService;
    @Resource
    private SwiperPictureService swiperPictureService;
    @Resource
    private QualityGoodsService qualityGoodsService;
    @Resource
    private ConfigService configService;
    @Resource
    private SpecialService specialService;
    @Resource
    private JDGoodsService jdGoodsService;
    /**
     * 京东专题分类
     *
     * @param acceptData
     * @param out
     */
@@ -83,10 +84,11 @@
        root.put("jdLink", configService.get("jingdong_h5_link"));
        out.print(JsonUtil.loadTrueResult(root));
    }
    /**
     * 京东专题 + 商品列表
     *
     * @param acceptData
     * @param out
     */
@@ -99,14 +101,14 @@
                topPicList = new ArrayList<SwiperPicture>();
            }
            root.put("listPic", JsonUtil.getApiCommonGson().toJson(topPicList));
            List<Special> listSpecial = specialService.listByPlaceKey("jingdong_special_index");
            if (listSpecial == null) {
                listSpecial = new ArrayList<Special>();
            }
            root.put("listSpe", JsonUtil.getApiCommonGson().toJson(listSpecial));
        }
        try {
            List<JDGoods> goodsList = jdGoodsService.specialSearch(page, cid);
            JSONArray array = new JSONArray();
@@ -116,11 +118,11 @@
                Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                        .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
                for (JDGoods goods : goodsList) {
                    GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(goods, fanLiRate,    shareRate);
                    GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(goods, fanLiRate, shareRate);
                    array.add(gson.toJson(goodsDetailVO));
                }
            }
            root.put("list", array);
            root.put("count", 1000);
            out.print(JsonUtil.loadTrueResult(root));
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2Mapper.java
@@ -140,8 +140,7 @@
     */
    Long countInviteOrderCountByUidAndSettleTime(@Param("uid") Long uid, @Param("state") int state,
            @Param("minDate") Date minDate, @Param("maxDate") Date maxDate);
    /**
     * 根据用户ID,订单状态和结算时间统计分享赚的订单数量
     * 
@@ -169,12 +168,35 @@
     * @param stateList
     * @return
     */
    BigDecimal computeMoneyByUidAndState(@Param("uid") Long uid,@Param("stateList")  List<Integer> stateList);
    BigDecimal computeMoneyByUidAndState(@Param("uid") Long uid, @Param("stateList") List<Integer> stateList);
    /**
     * 最近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
@@ -100,7 +100,7 @@
        h.`hb_pre_get_time` IS NOT
        NULL AND h.`hb_pre_get_time`
        <![CDATA[ <]]>
        NOW()  order by hb_pre_get_time desc limit #{count}
        NOW() order by hb_pre_get_time desc limit #{count}
    </select>
    <!-- 获取用户奖金列表 -->
@@ -233,8 +233,8 @@
        co.`co_settle_time` is not null and co.`co_settle_time`>=#{minDate}
        and #{maxDate}>co.`co_settle_time`;
    </select>
    <select id="countShareOrderCountByUidAndSettleTime" resultType="java.lang.Long">
        SELECT COUNT(h.hb_id) FROM yeshi_ec_hongbao_v2 h LEFT JOIN
        yeshi_ec_hongbao_order ho ON h.`hb_id`=ho.`ho_hongbao_id` LEFT JOIN
@@ -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
              AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) <![CDATA[<=]]>DATE(v2.`hb_create_time`)
        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,33 +38,49 @@
        return null;
    }
    private JDSearchResult get9K9Content(String cid, int page, int pageSize) {
        int[] arrayId = {10, 17};
        return getJingFenGoods(page, pageSize, "9k9-", arrayId);
        int[] arrayId = { 10, 17 };
        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);
        int[] arrayId = { 15, 18 };
        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);
        int[] arrayId = { 5, 2 };
        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);
        int[] arrayId = { 6, 3 };
        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);
        int[] arrayId = { 7, 4 };
        JDSearchResult result = getJingFenGoods(page, pageSize, "jujia-", arrayId);
        return filterGoods(result);
    }
    /**
     * 9快9包邮
     * 
@@ -81,21 +99,21 @@
            if (count != null) {
                addCount += count;
            }
            if (count != null && totalCount > addCount) {
                pageTemp = (int)(addCount / Constant.PAGE_SIZE);
                pageTemp = (int) (addCount / Constant.PAGE_SIZE);
                continue; // 当前分类商品不足
            } else {
                page = page - pageTemp;
                page = page - pageTemp;
                categoryId = arrayId[i];
                break;
            }
        }
        if (categoryId == null) {
            return null;
        }
        JDSearchResult result = JDApiUtil.getJingFenGoods(page, categoryId);
        long count = 0;
        if (result != null) {
@@ -104,8 +122,8 @@
                count = pageEntity.getTotalCount();
            }
        }
        long mcount = (count/Constant.PAGE_SIZE) * Constant.PAGE_SIZE;
        long mcount = (count / Constant.PAGE_SIZE) * Constant.PAGE_SIZE;
        if (mcount == 0) {
            mcount = 20;
        }
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之前的版本)
     * 
@@ -113,18 +112,19 @@
     * @return
     */
    BigDecimal getUnRecievedMoneyWithPreGetTime(Long uid, Date minDate, Date maxDate);
    /**
     * 计算资金
     *
     * @param uid
     * @param state
     * @return
     */
    BigDecimal computeMoneyByUidAndState(Long uid,int state);
    BigDecimal computeMoneyByUidAndState(Long uid, int state);
    /**
     * 查询子红包
     *
     * @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<>();
@@ -172,6 +170,19 @@
                return list.get(0);
        }
        return null;
    }
    /**
     * 通过商品搜索接口批量获取详情
     *
     * @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();
    }
    /**
@@ -610,8 +621,8 @@
        if (root.optInt("code") == 0) {
            boolean hasMore = root.optBoolean("hasMore");
            root = JSONObject.fromObject(root.optString("result"));
            if (root.optInt("code") == 200&&root.optJSONArray("data")!=null) {
            if (root.optInt("code") == 200 && root.optJSONArray("data") != null) {
                String date = root.optJSONArray("data").toString();
                Type typeToken = new TypeToken<List<JDOrder>>() {
                }.getType();