| | |
| | | package com.yeshi.fanli.job;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.ShareHotGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinReportService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Component
|
| | | public class TaoLiJinJob {
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserTaoLiJinReportService userTaoLiJinReportService;
|
| | | |
| | | |
| | |
|
| | | @Resource
|
| | | private ShareHotGoodsService shareHotGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | | /**
|
| | | * 更新报告
|
| | | * 更新报告
|
| | | */
|
| | | @Scheduled(cron = "0 0 0,10 * * ?")
|
| | | @Scheduled(cron = "0 0 1,10 * * ?")
|
| | | public void insetDynamicInfo() {
|
| | | |
| | |
|
| | | if (!Constant.IS_TASK) {
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | userTaoLiJinReportService.needUpdateReport();
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 退回超过3天无领取的淘礼金
|
| | | */
|
| | | @Scheduled(cron = "0 0 1 * * ?")
|
| | | public void refundNotWin() {
|
| | |
|
| | | if (!Constant.IS_TASK) {
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | userTaoLiJinReportService.refundNotWin();
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 每天凌晨过5分钟验证
|
| | | */
|
| | | @Scheduled(cron = "0 5 0 * * ?")
|
| | | public void updateShareTLJGoods() {
|
| | | 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(),
|
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
|
| | | TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT));
|
| | | if (success) {
|
| | | count++;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 每天凌晨过3分钟验证
|
| | | */
|
| | | @Scheduled(cron = "0 3 0 * * ?")
|
| | | public void updateBuyTLJGoods() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | LogHelper.test("验证自购立减商品");
|
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd");
|
| | | List<TLJBuyGoods> list = tljBuyGoodsService.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(),
|
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
|
| | | TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT));
|
| | | if (success) {
|
| | | count++;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|