| | |
| | | public void insertTimeHotSale() {
|
| | | Long classId = 1L;
|
| | | try {
|
| | | saveHotSale(classId, 0L);
|
| | | for (int i = 0; i < 3; i++) {
|
| | | boolean addSuccess = saveHotSale(classId, 0L);
|
| | | if (addSuccess) {
|
| | | break;
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | List<GoodsClass> list = DaTaoKeUtil.goodsClasses;
|
| | | for (GoodsClass goodsClass : list) {
|
| | | try {
|
| | | saveHotSale(classId, goodsClass.getId());
|
| | | for (int i = 0; i < 3; i++) {
|
| | | boolean addSuccess = saveHotSale(classId, goodsClass.getId());
|
| | | if (addSuccess) {
|
| | | break;
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | * @param subclassId
|
| | | * @throws TaobaoGoodsDownException
|
| | | */
|
| | | public void saveHotSale(Long classId, Long subclassId) throws TaobaoGoodsDownException {
|
| | | public boolean saveHotSale(Long classId, Long subclassId) throws TaobaoGoodsDownException {
|
| | | boolean addSuccess = false;
|
| | | List<Long> listId = null;
|
| | | List<DynamicInfo> listInfo = dynamicInfoDao.query(classId, subclassId);
|
| | | if (listInfo != null && listInfo.size() > 0) {
|
| | |
| | | }
|
| | | // 大淘客数据
|
| | | DaTaoKeDetail daTaoKe = daTaoKeGoodsService.getGoodsNotInList(subclassId, listId, 1).get(0);
|
| | | if (daTaoKe == null) {
|
| | | return addSuccess;
|
| | | }
|
| | |
|
| | | try {
|
| | | daTaoKe = DaTaoKeUtil.filterDaTaoKe(TaoKeApiUtil.searchGoodsDetail(daTaoKe.getGoodsId()), daTaoKe);
|
| | |
| | |
|
| | | }
|
| | |
|
| | | // 过滤为空的
|
| | | if (daTaoKe == null) {
|
| | | return;
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> listGoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = TaoBaoUtil.convert(daTaoKe);
|
| | | listGoods.add(taoBaoGoodsBrief);
|
| | |
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | TaoBaoGoodsBriefExtra goodsExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | proportion.toString(), null);
|
| | |
|
| | | // 商品图片
|
| | | GoodsPicture goodsPicture = getGoodsPicture(daTaoKe);
|
| | | if (!taoBaoGoodsBriefExtra.isCoupon()) {
|
| | | taoBaoGoodsBriefExtra.setState(1);
|
| | | goodsPicture.setGoodState(1);
|
| | | if (!goodsExtra.isCoupon() || (goodsExtra.getState() != null && goodsExtra.getState() == 1)) {
|
| | | return addSuccess; // 已下架 、无券 不加入
|
| | | }
|
| | | taoBaoGoodsBriefExtra.setTkRate(taoBaoGoodsBrief.getTkRate());
|
| | | taoBaoGoodsBriefExtra.setUpdatetime(new Date());
|
| | | taoBaoGoodsBriefExtra.setCouponInfo(null);
|
| | | goodsPicture.setGoods(taoBaoGoodsBriefExtra);
|
| | |
|
| | | List<TaoBaoGoodsBrief> listGoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | | listGoods.add(taoBaoGoodsBrief);
|
| | | |
| | | goodsExtra.setTkRate(taoBaoGoodsBrief.getTkRate());
|
| | | goodsExtra.setUpdatetime(new Date());
|
| | | goodsExtra.setCouponInfo(null);
|
| | | |
| | | GoodsPicture goodsPicture = getGoodsPicture(daTaoKe);
|
| | | goodsPicture.setGoods(goodsExtra);
|
| | | // 商品列表
|
| | | List<GoodsPicture> listPicture = new ArrayList<GoodsPicture>();
|
| | | listPicture.add(goodsPicture);
|
| | | |
| | | // 分享奖金
|
| | | BigDecimal shareMoney = taoBaoGoodsBriefService.getShareGoodsUserHongBao(taoBaoGoodsBrief);
|
| | | ClientTextStyleVO shareMoneyDesc = new ClientTextStyleVO();
|
| | | shareMoneyDesc.setColor("#FFFFFF");
|
| | | shareMoneyDesc.setBottomColor("#E8AE48");
|
| | | shareMoneyDesc.setContent("预估分享奖金:¥" + shareMoney);
|
| | | |
| | |
|
| | | // 获取商品列表图片
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief2 = TaoKeApiUtil.getSimpleGoodsInfo(daTaoKe.getGoodsId());
|
| | |
| | | listPicture.add(picture);
|
| | | }
|
| | | }
|
| | |
|
| | | taoBaoGoodsBriefExtra.setImgList(imgList);
|
| | | goodsExtra.setImgList(imgList);
|
| | | |
| | | // 分享奖金
|
| | | BigDecimal shareMoney = taoBaoGoodsBriefService.getShareGoodsUserHongBao(taoBaoGoodsBrief);
|
| | | ClientTextStyleVO shareMoneyDesc = new ClientTextStyleVO();
|
| | | shareMoneyDesc.setColor("#FFFFFF");
|
| | | shareMoneyDesc.setBottomColor("#E8AE48");
|
| | | shareMoneyDesc.setContent("预估分享奖金:¥" + shareMoney);
|
| | |
|
| | | // 组织动态信息
|
| | | DynamicInfo dynamicInfo = getDynamicInfo(daTaoKe, classId, subclassId);
|
| | |
| | |
|
| | | // 保存信息
|
| | | dynamicInfoDao.insert(dynamicInfo);
|
| | | |
| | | addSuccess = true;
|
| | | return addSuccess;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | // @Cacheable(value = "dynamicCache", key = "'queryV2-'+#platform+'-'+#version+'-'+#start+'-'+#count+'-'+#cid+'-'+#subId")
|
| | | @Cacheable(value = "dynamicCache", key = "'queryV2-'+#platform+'-'+#version+'-'+#start+'-'+#count+'-'+#cid+'-'+#subId")
|
| | | public List<DynamicInfo> queryV2(int platform, int version, int start, int count, Long cid, Long subId) {
|
| | | List<DynamicInfo> listNew = new ArrayList<DynamicInfo>();
|
| | | List<DynamicInfo> list = dynamicInfoDao.query(start, count, cid, subId);
|
| | |
| | | continue;
|
| | | }
|
| | |
|
| | | // 店铺信息
|
| | | TaoBaoShop shop = dynamicNew.getShop();
|
| | | if (shop != null) {
|
| | | Integer userType = shop.getUserType();
|
| | | if (userType == null || userType == 0) {
|
| | | shop.setUserType(10);
|
| | | } else {
|
| | | shop.setUserType(11);
|
| | | TaoBaoShop shopNew = new TaoBaoShop();
|
| | | try {
|
| | | PropertyUtils.copyProperties(shopNew, shop);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | continue;
|
| | | }
|
| | | dynamicNew.setShop(shop);
|
| | | Integer userType = shopNew.getUserType();
|
| | | if (userType == null || userType == 0) {
|
| | | shopNew.setUserType(10);
|
| | | } else {
|
| | | shopNew.setUserType(11);
|
| | | }
|
| | | dynamicNew.setShop(shopNew);
|
| | | }
|
| | |
|
| | | |
| | | List<GoodsPicture> imgsNew = new ArrayList<GoodsPicture>();
|
| | | List<GoodsPicture> imgs = dynamicNew.getImgs();
|
| | | if (imgs != null && imgs.size() > 0) {
|
| | | for (GoodsPicture goodsPicture: imgs) {
|
| | | TaoBaoGoodsBriefExtra goods = goodsPicture.getGoods();
|
| | | if (goods == null) {
|
| | | imgsNew.add(goodsPicture);
|
| | | continue;
|
| | | }
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBaoGoodsBriefExtra(goods, fanLiRate, shareRate);
|
| | | goodsPicture.setGoodsVO(detailVO);
|
| | | goodsPicture.setGoods(null);
|
| | |
|
| | | JumpDetailV2 jumpDetail = goodsPicture.getJumpDetail();
|
| | | GoodsPicture goodsNew = new GoodsPicture();
|
| | | try {
|
| | | PropertyUtils.copyProperties(goodsNew, goodsPicture);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | continue;
|
| | | }
|
| | | |
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBaoGoodsBriefExtra(goods, fanLiRate, shareRate);
|
| | | goodsNew.setGoodsVO(detailVO);
|
| | | goodsNew.setGoods(null);
|
| | | |
| | | JumpDetailV2 jumpDetail = goodsNew.getJumpDetail();
|
| | | if (jumpDetail != null) {
|
| | | JumpDetailV2 jumpDetailV2 = jumpDetailV2Service.getByTypeCache(jumpDetail.getType(), platform, version);
|
| | | if (jumpDetailV2 != null) {
|
| | | goodsPicture.setJumpDetail(jumpDetailV2);
|
| | | goodsNew.setJumpDetail(jumpDetailV2);
|
| | | }
|
| | | }
|
| | | |
| | | imgsNew.add(goodsNew);
|
| | | }
|
| | | dynamicNew.setImgs(imgsNew);
|
| | | }
|
| | | dynamicNew.setImgs(imgs);
|
| | | listNew.add(dynamicNew);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // 更新商品信息
|
| | | executor.execute(new Runnable() {
|
| | |
| | | * 更新商品信息
|
| | | */
|
| | | public void updateGoodInfo(List<DynamicInfo> list) {
|
| | | // if (!Constant.IS_OUTNET) {
|
| | | // return; // 外网进行更新
|
| | | // }
|
| | | if (!Constant.IS_OUTNET) {
|
| | | return; // 外网进行更新
|
| | | }
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | return;
|