| | |
| | | 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;
|
| | |
| | | @Resource
|
| | | private JDGoodsService jdGoodsService;
|
| | |
|
| | | |
| | | /**
|
| | | * 京东专题分类
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 京东专题 + 商品列表
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | |
| | | Long countInviteOrderCountByUidAndSettleTime(@Param("uid") Long uid, @Param("state") int state, |
| | | @Param("minDate") Date minDate, @Param("maxDate") Date maxDate); |
| | | |
| | | |
| | | /** |
| | | * 根据用户ID,订单状态和结算时间统计分享赚的订单数量 |
| | | * |
| | |
| | | |
| | | /** |
| | | * 最近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); |
| | | |
| | | } |
| | |
| | | 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;
|
| | |
| | | |
| | | <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} |
| | |
| | | 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;
|
| | |
| | |
|
| | | 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;
|
| | |
| | | public class JDCommonTemplateContentServiceImpl implements JDCommonTemplateContentService {
|
| | |
|
| | | private Map<String, Long> countMap = new HashMap<String, Long>();
|
| | | |
| | |
|
| | | @Cacheable(value = "jdCommonContentCache", key = "#type+'-'+#cid+'-'+#page+'-'+#pageSize")
|
| | | @Override
|
| | |
| | | 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包邮
|
| | |
| | | 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);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | if (result == null) {
|
| | | return null;
|
| | | } else {
|
| | | return result.getGoodsList();
|
| | | return filterJDGoods(result.getGoodsList());
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | 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) {
|
| | |
| | | */
|
| | | public void addHongBao(List<CommonOrder> commonOrder, int type) throws HongBaoException;
|
| | |
|
| | |
|
| | | /**
|
| | | * 奖金列表(1.4.9之前的版本)
|
| | | *
|
| | |
| | | */
|
| | | BigDecimal getUnRecievedMoneyWithPreGetTime(Long uid, Date minDate, Date maxDate);
|
| | |
|
| | | |
| | | /**
|
| | | * 计算资金
|
| | | * |
| | | * @param uid
|
| | | * @param state
|
| | | * @return
|
| | |
| | |
|
| | | /**
|
| | | * 查询子红包
|
| | | * |
| | | * @param id
|
| | | * @return
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 最近30天内产生过分享订单的用户
|
| | | * |
| | | * @return
|
| | | */
|
| | | public List<Long> getUidByNear30DayShareSucceed();
|
| | |
|
| | | /**
|
| | | * 让邀请赚失效(根据下级用户ID)
|
| | | * @param parentUid
|
| | | * @param beiZhu
|
| | | */
|
| | | public void invalidInviteHongBaoByParentUid(Long parentUid, String beiZhu);
|
| | |
|
| | | }
|
| | |
| | | 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;//
|
| | |
| | | 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<>();
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 通过商品搜索接口批量获取详情
|
| | | * |
| | | * @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
|