| | |
| | | import java.util.List;
|
| | | import java.util.Scanner;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.entity.push.PushGoods;
|
| | | import com.yeshi.fanli.entity.push.PushInfo;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.push.PushGoodsService;
|
| | | import com.yeshi.fanli.service.inter.push.PushInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.factory.IOSPushFactory;
|
| | | import com.yeshi.fanli.util.push.IOSPushUtil;
|
| | |
| | |
|
| | | @Component
|
| | | public class PushJob {
|
| | |
|
| | | |
| | | @Resource
|
| | | private PushInfoService pushInfoService;
|
| | | |
| | | @Resource
|
| | | private PushGoodsService pushGoodsService;
|
| | | |
| | | |
| | | /**
|
| | | * 推送老版本IOS(每晚8点推送)
|
| | | */
|
| | |
| | | InputStream cer = null;
|
| | |
|
| | | int p = deviceList.size() / 50 + 1;
|
| | | JSONObject json = IOSPushFactory.createURLPush("https://0x9.me/TusaI", "返利券苹果端进行了重大更新!请立即升级",
|
| | | "更多优惠券,更高返利,尽在新版苹果端返利券!");
|
| | | JSONObject json = IOSPushFactory.createURLPush("https://0x9.me/TusaI", "板栗快省苹果端进行了重大更新!请立即升级",
|
| | | "更多优惠券,更高返利,尽在新版苹果端板栗快省!");
|
| | | for (int i = 0; i < p; i++) {
|
| | | cer = this.getClass().getClassLoader().getResourceAsStream("certificate/老版本-生产证书.p12");
|
| | | try {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 定时消息推送任务 每个30秒爬取
|
| | | */
|
| | | @Scheduled(cron = "30 * * * * ? ")
|
| | | public void pushInfo() {
|
| | | if (!Constant.IS_TASK) {
|
| | | return;
|
| | | }
|
| | | |
| | | // 站内信、网页、百川
|
| | | try {
|
| | | List<PushInfo> listTask = pushInfoService.listTask();
|
| | | if (listTask != null && listTask.size() > 0) {
|
| | | for (PushInfo pushInfo: listTask) {
|
| | | pushInfoService.taskPush(pushInfo);
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | // 今日推荐
|
| | | try {
|
| | | List<PushGoods> listTask = pushGoodsService.listTask();
|
| | | if (listTask != null && listTask.size() > 0) {
|
| | | for (PushGoods pushGoods: listTask) {
|
| | | pushGoodsService.taskPush(pushGoods);
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | |
| | | |
| | | |
| | | }
|