Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoHongBaoInfo;
|
| | | import com.yeshi.fanli.entity.taobao.TaobaoMeterial;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | import com.yeshi.fanli.service.inter.lable.TaoKeGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsActivityService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaobaoMeterialService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | private TaoBaoGoodsActivityService taoBaoGoodsActivityService;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | | private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
|
| | |
|
| | | /**
|
| | | * 9.9商品
|
| | |
| | |
|
| | | @RequestMapping("getFlashSaleNew")
|
| | | public void getFlashSaleNew(String callback, Integer page, Long auctionId, String time, PrintWriter out) {
|
| | | List<DaTaoKeDetail> detailList0 = daTaoKeGoodsDetailService.getDingDongQiangData(time);
|
| | | List<DaTaoKeDetailV2> detailList0 = daTaoKeGoodsDetailV2Service.getDingDongQiangData(time);
|
| | | if (detailList0 == null)
|
| | | detailList0 = new ArrayList<>();
|
| | | List<DaTaoKeDetail> detailList = new ArrayList<>();
|
| | | List<DaTaoKeDetailV2> detailList = new ArrayList<>();
|
| | | detailList.addAll(detailList0);
|
| | | JSONArray array = new JSONArray();
|
| | | if (page == 1) {
|
| | | if (auctionId != null && detailList != null)
|
| | | for (int i = 0; i < detailList.size(); i++) {
|
| | | if (detailList.get(i).getGoodsId().longValue() == auctionId) {
|
| | | DaTaoKeDetail goods = detailList.get(i);
|
| | | DaTaoKeDetailV2 goods = detailList.get(i);
|
| | | detailList.remove(i);
|
| | | detailList.add(0, goods);
|
| | | break;
|
| | |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | if (detailList != null)
|
| | | for (DaTaoKeDetail detail : detailList) {
|
| | | for (DaTaoKeDetailV2 detail : detailList) {
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(TaoBaoUtil.convert(detail),
|
| | | hongBaoManageService.getFanLiRate() + "", null)));
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.lable.QualityFactory;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | |
| | | import com.yeshi.fanli.service.inter.pdd.PDDGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.factory.MonitorFactory;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
|
| | |
|
| | | /**
|
| | | * 新版推荐专题管理(1.5.3)
|
| | |
| | | }
|
| | |
|
| | | private JSONObject getSpikeGoodsContent(AcceptData acceptData) {
|
| | | // 下一次倒计时的时间
|
| | | int type = qualityFlashSaleService.getNowType() + 1;
|
| | | int hour = 0;
|
| | | switch (type) {
|
| | | case 1:
|
| | | hour = 0;
|
| | | break;
|
| | | case 2:
|
| | | hour = 9;
|
| | | break;
|
| | | case 3:
|
| | | hour = 12;
|
| | | break;
|
| | | case 4:
|
| | | hour = 14;
|
| | | break;
|
| | | case 5:
|
| | | hour = 16;
|
| | | break;
|
| | | case 6:
|
| | | hour = 20;
|
| | | break;
|
| | | case 7:
|
| | | hour = 22;
|
| | | break;
|
| | | default:
|
| | | break;
|
| | | List<String> dtoList = daTaoKeGoodsDetailV2Service.getDingDongQiangTime();
|
| | | long nowTime = System.currentTimeMillis();
|
| | | int dateNum = Integer.parseInt(TimeUtil.getGernalTime(nowTime, "ddHH"));
|
| | | String timeStr = null;
|
| | | int nextPos = 0;
|
| | | for (int i = 0; i < dtoList.size(); i++) {
|
| | | if (dateNum <= Integer.parseInt(dtoList.get(i))) {
|
| | | timeStr = dtoList.get(i);
|
| | | nextPos = i + 1;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | Calendar nextTime = Calendar.getInstance();
|
| | | nextTime.set(Calendar.HOUR_OF_DAY, hour);
|
| | | nextTime.set(Calendar.MINUTE, 0);
|
| | | nextTime.set(Calendar.SECOND, 0);
|
| | | nextTime.set(Calendar.MILLISECOND, 0);
|
| | | long nextTime = nowTime + 1000 * 60 * 60L;// 默认为1小时
|
| | | if (nextPos < dtoList.size()) {
|
| | | nextTime = TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(nowTime, "MM") + dtoList.get(nextPos),
|
| | | "MMddHH");
|
| | | }
|
| | |
|
| | | JSONArray array = null;
|
| | | String timekey = String.format("spikeGoods_hour_new-%s-%s", acceptData.getPlatform(), acceptData.getVersion());
|
| | | String cachekey = String.format("spikeGoodsList_new-%s-%s", acceptData.getPlatform(), acceptData.getVersion());
|
| | | Calendar nowCalendar = Calendar.getInstance();
|
| | | nowCalendar.setTimeInMillis(nowTime);
|
| | | int hour = nowCalendar.get(Calendar.HOUR_OF_DAY);
|
| | |
|
| | | String timeValue = redisManager.getCommonString(timekey);
|
| | | if (timeValue == null || !timeValue.equals(hour + "")) {
|
| | |
| | | array = JSONArray.fromObject(cacheValue);
|
| | | }
|
| | | }
|
| | |
|
| | | JumpDetailV2 jumpDetail = jumpDetailV2Service.getByTypeCache("web");
|
| | | if (array == null) {
|
| | | array = new JSONArray();
|
| | |
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | // 缓存中不存在
|
| | | List<QualityFactory> listGoods = qualityGoodsService.listFlashSaleRandGoods();
|
| | | List<DaTaoKeDetailV2> listGoods = daTaoKeGoodsDetailV2Service.getDingDongQiangData(timeStr);
|
| | | if (listGoods == null) {
|
| | | listGoods = new ArrayList<QualityFactory>();
|
| | | listGoods = new ArrayList<>();
|
| | | }
|
| | |
|
| | | if (listGoods != null && listGoods.size() > 3)
|
| | | listGoods = listGoods.subList(0, 3);
|
| | |
|
| | | /* 遍历列表数据 */
|
| | |
|
| | | for (QualityFactory qualityFactory : listGoods) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = qualityFactory.getTaoBaoGoodsBrief();
|
| | | for (DaTaoKeDetailV2 detail : listGoods) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = TaoBaoUtil.convert(detail);
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | |
| | | // 缓存半个小时
|
| | | redisManager.cacheCommonString(cachekey, array.toString(), 60 * 30);
|
| | | }
|
| | | Long endTime = nextTime.getTimeInMillis() - java.lang.System.currentTimeMillis();
|
| | |
|
| | | // 获取今天的数据
|
| | |
|
| | | Long endTime = nextTime - nowTime;
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | |
|
| | | if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | root.put("time", nextTime.getTimeInMillis());
|
| | | root.put("time", nextTime);
|
| | | root.put("endTime", endTime > 0 ? endTime : 0);
|
| | | JSONArray imgArray = new JSONArray();
|
| | | if (array != null)
|
| | |
| | | root.put("name", "限时秒杀");
|
| | | root.put("desc", "整点更新,好物抢购");
|
| | | } else {
|
| | | root.put("time", nextTime.getTimeInMillis());
|
| | | root.put("time", nextTime);
|
| | | root.put("endTime", endTime > 0 ? endTime : 0);
|
| | | root.put("listgoods", array);
|
| | | JSONObject params = new JSONObject();
|
| | |
| | | root.put("params", params);
|
| | | root.put("jumpDetail", jumpDetail);
|
| | | }
|
| | |
|
| | | root.put("time", nextTime);
|
| | | root.put("endTime", endTime > 0 ? endTime : 0);
|
| | | root.put("listgoods", array);
|
| | |
|
| | | return root;
|
| | | }
|
| | |
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | JSONArray array = new JSONArray();
|
| | | array.add(
|
| | | "http://img.flqapp.com/resource/integral/integral_home_icon_2.png");
|
| | | array.add(
|
| | | "http://img.flqapp.com/resource/integral/integral_home_icon_1.png");
|
| | | array.add("http://img.flqapp.com/resource/integral/integral_home_icon_2.png");
|
| | | array.add("http://img.flqapp.com/resource/integral/integral_home_icon_1.png");
|
| | | root.put("imgList", array);
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("balanceMore", true);
|
| | |
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.cache.IntegralGetCacheManager;
|
| | | import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
|
| | | import com.yeshi.fanli.util.factory.CommonGoodsFactory;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | |
| | |
|
| | | @Resource
|
| | | private IntegralGetService integralGetService;
|
| | |
|
| | | @Resource
|
| | | private IntegralGetCacheManager integralGetCacheManager;
|
| | |
|
| | | /**
|
| | | * 粘贴板信息推荐
|
| | |
| | | @RequestMapping(value = "searchGoods")
|
| | | public void searchGoods(AcceptData acceptData, Integer goodsType, String key, Integer page, String filter,
|
| | | Integer order, Long uid, HttpSession session, PrintWriter out) {
|
| | |
|
| | | if (goodsType == null || goodsType < 1 || goodsType > 3) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "请传递正确平台参数"));
|
| | | return;
|
| | |
| | |
|
| | | if (uid != null) {
|
| | | if (page == 1) {
|
| | | session.setAttribute("searchFirstTime", System.currentTimeMillis());
|
| | | } else if (page == 2) {
|
| | | Long lastTime = (Long) session.getAttribute("searchFirstTime");
|
| | | integralGetCacheManager.cacheSearchGoods(acceptData.getDevice(), System.currentTimeMillis());
|
| | | } else if (page > 1) {
|
| | | Long lastTime = integralGetCacheManager.getLastSearchTime(acceptData.getDevice());
|
| | | if (lastTime != null && System.currentTimeMillis() - lastTime >= 15 * 1000L) {// 超过15s浏览
|
| | | |
| | | integralGetCacheManager.clearSearchTime(acceptData.getDevice());
|
| | | ThreadUtil.run(new Runnable() {
|
| | |
|
| | | @Override
|
| | | public void run() {
|
| | | try {
|
| | | // 增加金币
|
| | | integralGetService.addSearchResultScan(uid,key);
|
| | | integralGetService.addSearchResultScan(uid, key);
|
| | | } catch (IntegralGetException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | *
|
| | | * @return
|
| | | */
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int start, int count, String sortName,BigDecimal minCommission) {
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int start, int count, String sortName, BigDecimal minCommission) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("commission").gt(minCommission.multiply(new BigDecimal(100)).intValue()));
|
| | | List<Order> orders = new ArrayList<>();
|
| | |
| | | return list.size();
|
| | | }
|
| | |
|
| | | public long countByMinUpdateTime(Date minUpdateTime) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("updateTime").gt(minUpdateTime));
|
| | | return mongoTemplate.count(query, DaTaoKeDetailV2.class);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | * @return |
| | | */ |
| | | PDDOrder selectByOrderSN(String orderSn); |
| | | |
| | | |
| | | /** |
| | | * 数量统计 |
| | | * |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | |
| | | */ |
| | | List<Map<String, Object>> countOrderNumber(@Param("dateType") Integer dateType, @Param("year") String year, |
| | | @Param("startTime") String startTime, @Param("endTime") String endTime); |
| | | |
| | | /** |
| | | * 根据状态查询数据 |
| | | * |
| | | * @param status |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | List<PDDOrder> listByStatus(@Param("status") Integer status, @Param("start") long start, @Param("count") int count); |
| | | |
| | | /** |
| | | * 根据状态查询数量 |
| | | * |
| | | * @param status |
| | | * @return |
| | | */ |
| | | Long countByStatus(@Param("status") Integer status); |
| | | } |
| | |
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | |
|
| | | /**
|
| | | * 大淘客叮咚抢
|
| | |
| | | */
|
| | | public class DingDongQiangDTO {
|
| | | private String time;
|
| | | private List<DaTaoKeDetail> goodsList;
|
| | | private List<DaTaoKeDetailV2> goodsList;
|
| | |
|
| | | public DingDongQiangDTO(String time, List<DaTaoKeDetail> goodsList) {
|
| | | public DingDongQiangDTO(String time, List<DaTaoKeDetailV2> goodsList) {
|
| | | this.time = time;
|
| | | this.goodsList = goodsList;
|
| | | }
|
| | |
| | | this.time = time;
|
| | | }
|
| | |
|
| | | public List<DaTaoKeDetail> getGoodsList() {
|
| | | public List<DaTaoKeDetailV2> getGoodsList() {
|
| | | return goodsList;
|
| | | }
|
| | |
|
| | | public void setGoodsList(List<DaTaoKeDetail> goodsList) {
|
| | | public void setGoodsList(List<DaTaoKeDetailV2> goodsList) {
|
| | | this.goodsList = goodsList;
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Scheduled(cron = "0 30 7,11,18,23 * * ? ")
|
| | | public void syncGoodsBeiYong() {
|
| | | long latestUpdateCount = daTaoKeGoodsDetailV2Service
|
| | | .countByMinUpdateTime(new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L));
|
| | | if (latestUpdateCount < 50000L) {// 若每天没有超过5w数据更新就需要重新更新数据
|
| | | daTaoKeGoodsDetailV2Service.startSyncGoods();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | #{orderId,jdbcType=VARCHAR},po_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},po_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP},po_order_receive_time = |
| | | #{orderReceiveTime,jdbcType=BIGINT} where po_id = #{id,jdbcType=BIGINT} |
| | | #{orderReceiveTime,jdbcType=BIGINT} where po_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.pdd.PDDOrder"> |
| | | update yeshi_ec_pdd_order |
| | |
| | | <if test="orderId != null">po_order_id=#{orderId,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">po_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">po_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="orderReceiveTime != null">po_order_receive_time=#{orderReceiveTime,jdbcType=BIGINT},</if> |
| | | <if test="orderReceiveTime != null">po_order_receive_time=#{orderReceiveTime,jdbcType=BIGINT}, |
| | | </if> |
| | | </set> |
| | | where po_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="listByStatus" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | |
| | | from yeshi_ec_pdd_order |
| | | |
| | | <if test="status!=null"> |
| | | where po_order_status=#{status} |
| | | </if> |
| | | limit #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="countByStatus" resultType="java.lang.Long"> |
| | | select |
| | | count(po_id) |
| | | |
| | | from yeshi_ec_pdd_order |
| | | |
| | | <if test="status!=null"> |
| | | where po_order_status=#{status} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | } else if (type == CommonContentTypeEnum.haoQuan) {
|
| | | result = getHaoQuanContent(cid, page, pageSize);
|
| | | } else if (type == CommonContentTypeEnum.mianDan) {
|
| | | result = getHaoQuanContent(cid, page, pageSize);
|
| | | result = getMianDanContent(page, pageSize);
|
| | | }
|
| | |
|
| | | if (result != null) {// 商品信息过滤
|
| | |
| | |
|
| | | }
|
| | |
|
| | | @Cacheable(value = "integralGetCache", key = "'addSearchResultScan-'+#uid+'-'+kw")
|
| | | @Cacheable(value = "integralGetCache", key = "'addSearchResultScan-'+#uid+'-'+#kw")
|
| | | @Override
|
| | | public void addSearchResultScan(Long uid, String kw) throws IntegralGetException {
|
| | | System.out.println("搜索");
|
| | |
| | | return pddList;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<PDDOrder> listByStatus(Integer status, int page, int pageSize) {
|
| | | return pddOrderMapper.listByStatus(status, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return daTaoKeDetailMapper.countByCidAndMaxMinPrice(cid, maxPrice, null);
|
| | | }
|
| | |
|
| | | @Cacheable(value = "daTaoKeGoodsCache", key = "'getDingDongQiangData'")
|
| | | @Override
|
| | | public List<DingDongQiangDTO> getDingDongQiangData() {
|
| | | List<DingDongQiangDTO> list = null;
|
| | | int count = 0;
|
| | | while ((list == null || list.size() == 0) && count < 3) {
|
| | | count++;
|
| | | list = DaTaoKeUtil.getDingDongQiang();
|
| | | }
|
| | | if (list == null)
|
| | | return null;
|
| | | return list;
|
| | | }
|
| | |
|
| | | private void updateGoods(Long id) {
|
| | | DaTaoKeDetail detail = daTaoKeDetailMapper.selectByPrimaryKey(id);
|
| | |
| | | list.add(detail);
|
| | | addGoodsList(list);
|
| | | }
|
| | | }
|
| | |
|
| | | @Cacheable(value = "daTaoKeGoodsCache", key = "'getDingDongQiangData-'+#time")
|
| | | @Override
|
| | | public List<DaTaoKeDetail> getDingDongQiangData(String time) {
|
| | | List<DingDongQiangDTO> list = getDingDongQiangData();
|
| | | if (list == null)
|
| | | return null;
|
| | | Map<String, DingDongQiangDTO> map = new HashMap<>();
|
| | | for (DingDongQiangDTO dto : list)
|
| | | map.put(dto.getTime(), dto);
|
| | |
|
| | | DingDongQiangDTO dto = map.get(time);
|
| | | if (dto != null) {
|
| | | List<Long> idList = new ArrayList<>();
|
| | | for (DaTaoKeDetail td : dto.getGoodsList())
|
| | | idList.add(td.getId());
|
| | | List<DaTaoKeDetail> finalList = listByIds(idList);
|
| | | if (finalList.size() != idList.size()) {
|
| | | for (Long id : idList)
|
| | | updateGoods(id);
|
| | | finalList = listByIds(idList);
|
| | | }
|
| | |
|
| | | for (DaTaoKeDetail detail : finalList) {
|
| | | detail.setQuanReceive(
|
| | | detail.getQuanSurplus() + detail.getQuanReceive() - (int) (200 + Math.random() * 1000));
|
| | | }
|
| | | return finalList;
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.scheduling.annotation.Async;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.goods.taobao.dataoke.DaTaoKeGoodsDetailV2Dao;
|
| | | import com.yeshi.fanli.dto.dataoke.DaTaoKeGoodsResult;
|
| | | import com.yeshi.fanli.dto.dataoke.DingDongQiangDTO;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int page,BigDecimal minCommission) {
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int page, BigDecimal minCommission) {
|
| | | Map<Long, DaTaoKeDetailV2> map = new HashMap<>();
|
| | | List<DaTaoKeDetailV2> list = daTaoKeGoodsDetailV2Dao.listPreShareHotGoods((page - 1) * 100, 100, "hotPush",minCommission);
|
| | | List<DaTaoKeDetailV2> list = daTaoKeGoodsDetailV2Dao.listPreShareHotGoods((page - 1) * 100, 100, "hotPush",
|
| | | minCommission);
|
| | | System.out.println(list);
|
| | | for (DaTaoKeDetailV2 v2 : list) {
|
| | | map.put(v2.getId(), v2);
|
| | |
| | | daTaoKeGoodsDetailV2Dao.listAndRemoveByMinUpdateTime(minTime, 0, 3000);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByMinUpdateTime(Date minTime) {
|
| | | return daTaoKeGoodsDetailV2Dao.countByMinUpdateTime(minTime);
|
| | | }
|
| | |
|
| | | @Cacheable(value = "daTaoKeGoodsCache", key = "'getDingDongQiangData'")
|
| | | @Override
|
| | | public List<DingDongQiangDTO> getDingDongQiangData() {
|
| | | List<DingDongQiangDTO> list = null;
|
| | | int count = 0;
|
| | | while ((list == null || list.size() == 0) && count < 3) {
|
| | | count++;
|
| | | list = DaTaoKeUtil.getDingDongQiang();
|
| | | }
|
| | | if (list == null)
|
| | | return null;
|
| | | return list;
|
| | | }
|
| | |
|
| | | @Async
|
| | | private void updateGoods(Long id) {
|
| | | DaTaoKeDetailV2 v2 = DaTaoKeApiUtil.getGoodsDetail(id);
|
| | | if (v2 != null)
|
| | | daTaoKeGoodsDetailV2Dao.save(v2);
|
| | | }
|
| | |
|
| | | @Cacheable(value = "daTaoKeGoodsCache", key = "'getDingDongQiangData-'+#time")
|
| | | @Override
|
| | | public List<DaTaoKeDetailV2> getDingDongQiangData(String time) {
|
| | | List<DingDongQiangDTO> list = getDingDongQiangData();
|
| | | if (list == null)
|
| | | return null;
|
| | | Map<String, DingDongQiangDTO> map = new HashMap<>();
|
| | | for (DingDongQiangDTO dto : list)
|
| | | map.put(dto.getTime(), dto);
|
| | |
|
| | | DingDongQiangDTO dto = map.get(time);
|
| | | if (dto != null) {
|
| | | List<Long> idList = new ArrayList<>();
|
| | | for (DaTaoKeDetailV2 td : dto.getGoodsList())
|
| | | idList.add(td.getId());
|
| | | List<DaTaoKeDetailV2> finalList = listByIds(idList);
|
| | | if (finalList.size() != idList.size()) {
|
| | | for (Long id : idList)
|
| | | updateGoods(id);
|
| | | finalList = listByIds(idList);
|
| | | }
|
| | |
|
| | | for (DaTaoKeDetailV2 detail : finalList) {
|
| | | detail.setCouponReceiveNum(detail.getCouponTotalNum() - (int) (200 + Math.random() * 1000));
|
| | | if (detail.getCouponTotalNum() - detail.getCouponReceiveNum() <= 0)
|
| | | detail.setCouponReceiveNum(detail.getCouponTotalNum());
|
| | | }
|
| | | return finalList;
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<String> getDingDongQiangTime() {
|
| | | List<DingDongQiangDTO> list = getDingDongQiangData();
|
| | | List<String> dateList = new ArrayList<>();
|
| | | for (DingDongQiangDTO dto : list) {
|
| | | dateList.add(dto.getTime());
|
| | | }
|
| | | return dateList;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public List<PDDOrder> selectByOrderSn(String orderSn);
|
| | |
|
| | | /**
|
| | | * 根据状态查询
|
| | | * @param status
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | public List<PDDOrder> listByStatus(Integer status, int page, int pageSize);
|
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public Long countByCidAndMaxPrice(Integer cid, BigDecimal maxPrice);
|
| | |
|
| | | /**
|
| | | * 获取叮咚呛数据
|
| | | * |
| | | * @return
|
| | | */
|
| | | public List<DingDongQiangDTO> getDingDongQiangData();
|
| | | |
| | | /**
|
| | | * 根据时间查询
|
| | | * @param time 0712 表示7号12点
|
| | | * @return
|
| | | */
|
| | | public List<DaTaoKeDetail> getDingDongQiangData(String time);
|
| | | |
| | | |
| | | |
| | | }
|
| | |
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.dto.dataoke.DingDongQiangDTO;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | |
|
| | | /**
|
| | |
| | | * @param minTime
|
| | | */
|
| | | public void deleteOutOfDate(Date minTime);
|
| | | |
| | | |
| | | /**
|
| | | * 根据最小更新时间查询数量
|
| | | * @param minTime
|
| | | * @return
|
| | | */
|
| | | public long countByMinUpdateTime(Date minTime);
|
| | | |
| | | /**
|
| | | * 获取叮咚呛数据
|
| | | * |
| | | * @return
|
| | | */
|
| | | public List<DingDongQiangDTO> getDingDongQiangData();
|
| | | |
| | | |
| | | /**
|
| | | * 获取叮咚呛时间
|
| | | * @return
|
| | | */
|
| | | public List<String> getDingDongQiangTime();
|
| | | |
| | | /**
|
| | | * 根据时间查询
|
| | | * @param time 0712 表示7号12点
|
| | | * @return
|
| | | */
|
| | | public List<DaTaoKeDetailV2> getDingDongQiangData(String time);
|
| | | |
| | | |
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.cache;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | /**
|
| | | * 金币缓存
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class IntegralGetCacheManager {
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
|
| | | /**
|
| | | * 缓存商品搜索记录
|
| | | * |
| | | * @param device
|
| | | * @param time
|
| | | */
|
| | | public void cacheSearchGoods(String device, Long time) {
|
| | | redisManager.cacheCommonString("integral-seacrh-goods-" + device, time + "", 60 * 5);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取上次搜索时间
|
| | | * |
| | | * @param device
|
| | | * @return
|
| | | */
|
| | | public Long getLastSearchTime(String device) {
|
| | | String value = redisManager.getCommonString("integral-seacrh-goods-" + device);
|
| | | if (StringUtil.isNullOrEmpty(value))
|
| | | return null;
|
| | | return Long.parseLong(value);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 清除设备搜索时间
|
| | | * @param device
|
| | | */
|
| | | public void clearSearchTime(String device) {
|
| | | redisManager.removeCommonString("integral-seacrh-goods-" + device);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | map.put("page", page + "");
|
| | | map.put("page_size", pageSize + "");
|
| | | String result = baseRequest(map);
|
| | | System.out.println(result);
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | | JSONObject root = json.optJSONObject("order_list_get_response");
|
| | | if (root != null) {
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | public static PDDOrder getOrderDetail(String orderSn) {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("type", "pdd.ddk.order.detail.get");
|
| | | map.put("order_sn", orderSn);
|
| | | String result = baseRequest(map);
|
| | | System.out.println(result);
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | | JSONObject root = json.optJSONObject("order_detail_response");
|
| | | if (root != null) {
|
| | | return new Gson().fromJson(root.toString(), PDDOrder.class);
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取商品详情
|
| | | *
|
| | |
| | | List<DingDongQiangDTO> list = new ArrayList<>();
|
| | | Document doc = null;
|
| | | try {
|
| | | doc = Jsoup.connect("http://www.dataoke.com/ddq").get();
|
| | | doc = Jsoup.connect("http://www.dataoke.com/ddq").userAgent("").get();
|
| | | } catch (IOException e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | |
| | | for (Iterator<String> its = dataJson.keys(); its.hasNext();) {
|
| | | String key = its.next();
|
| | | JSONArray array = dataJson.optJSONArray(key);
|
| | | List<DaTaoKeDetail> detailList = new ArrayList<>();
|
| | | List<DaTaoKeDetailV2> detailList = new ArrayList<>();
|
| | | for (int n = 0; n < array.size(); n++) {
|
| | | detailList.add(new DaTaoKeDetail(array.optJSONObject(n).optLong("id")));
|
| | | DaTaoKeDetailV2 v2 = new DaTaoKeDetailV2();
|
| | | v2.setId(array.optJSONObject(n).optLong("id"));
|
| | | detailList.add(v2);
|
| | | }
|
| | | list.add(new DingDongQiangDTO(key, detailList));
|
| | | }
|
| | |
| | |
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | }
|