| | |
| | | package com.yeshi.fanli.job;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivity;
|
| | | import com.yeshi.fanli.entity.taobao.ShareHotGoods;
|
| | | import com.yeshi.fanli.exception.ActivityException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandClassShopGoodsService;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandClassShopService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFlashSaleService;
|
| | | import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsActivityService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.cache.HttpGoodsCacheManager;
|
| | |
|
| | | /**
|
| | | * 淘宝商品更细
|
| | |
| | |
|
| | | @Resource
|
| | | private ShareHotGoodsService shareHotGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | | @Resource
|
| | | private BrandClassShopGoodsService brandClassShopGoodsService;
|
| | |
|
| | | @Resource
|
| | | private HttpGoodsCacheManager httpGoodsCacheManager;
|
| | |
|
| | | // 动态商品更新 ,1个小时更新
|
| | | @Scheduled(cron = "0 0 */1 * * ?")
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | // 更新品牌商品,每天早上6点执行一次
|
| | | // 更新增加品牌商品,每天早上6点执行一次
|
| | | @Scheduled(cron = "0 0 6 * * ? ")
|
| | | public void updateBrandGoods() {
|
| | | public void updateAddBrandGoods() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | brandClassShopService.updateShopGoods();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 每天凌晨过5分钟验证
|
| | | */
|
| | | @Scheduled(cron = "0 5 0 * * ? *")
|
| | | public void update618() {
|
| | | // 更新原有精品库的品牌商品,每天凌晨3点执行一次
|
| | | @Scheduled(cron = "0 0 3 * * ? ")
|
| | | public void updateBrandGoods() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | LogHelper.test("验证爆款商品库商品");
|
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd");
|
| | | List<ShareHotGoods> list = shareHotGoodsService.listByDay(day, 15);
|
| | | int count = 0;
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (count >= 10)
|
| | | break;
|
| | | boolean success = shareHotGoodsService.verifyCanCreateTLJ(list.get(i).getGoods().getAuctionId());
|
| | | if (success) {
|
| | | count++;
|
| | | }
|
| | | }
|
| | | brandClassShopGoodsService.startUpdateGoods();
|
| | | }
|
| | |
|
| | | // 每天凌晨4点模拟请求
|
| | | @Scheduled(cron = "0 0 4 * * ? ")
|
| | | public void simulateRequest() {
|
| | | httpGoodsCacheManager.requestHomeRecommend();
|
| | | httpGoodsCacheManager.requestClassGoods();
|
| | | httpGoodsCacheManager.requestBrandGoods();
|
| | | httpGoodsCacheManager.requestDynamic();
|
| | | httpGoodsCacheManager.requestCommonTemplate();
|
| | | }
|
| | | }
|