| | |
| | | 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 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
|
| | | */
|
| | |
| | | root.put("jdLink", configService.get("jingdong_h5_link"));
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | }
|
| | | |
| | | |
| | |
|
| | |
|
| | | /**
|
| | | * 京东专题 + 商品列表
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | |
| | | 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();
|
| | |
| | | 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));
|
| | |
| | | */ |
| | | Long countInviteOrderCountByUidAndSettleTime(@Param("uid") Long uid, @Param("state") int state, |
| | | @Param("minDate") Date minDate, @Param("maxDate") Date maxDate); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据用户ID,订单状态和结算时间统计分享赚的订单数量 |
| | | * |
| | |
| | | * @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); |
| | | |
| | | } |
| | |
| | | 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;
|
| | |
| | | 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> |
| | | |
| | | <!-- 获取用户奖金列表 --> |
| | |
| | | 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 |
| | |
| | | |
| | | <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} |
| | |
| | | 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);
|
| | | 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包邮
|
| | | *
|
| | |
| | | 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) {
|
| | |
| | | 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;
|
| | | }
|
| | |
| | | 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之前的版本)
|
| | | *
|
| | |
| | | * @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
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 最近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<>();
|
| | |
| | | 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();
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | 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();
|