| | |
| | | import com.yeshi.fanli.entity.xinge.MessageInfo;
|
| | | import com.yeshi.fanli.entity.xinge.PushRecord;
|
| | | import com.yeshi.fanli.exception.PushException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.log.PushLogHelper;
|
| | | import com.yeshi.fanli.service.inter.push.IOSPushService;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | |
| | |
|
| | | @Resource
|
| | | private PushQueueRecordMapper pushQueueRecordMapper;
|
| | | |
| | |
|
| | | @Override
|
| | | public void pushGoods(Long uid, Long auctionId, String title, String content) throws PushException {
|
| | |
| | |
|
| | | addPushIOSQueue(info, url, PushController.GOODS);
|
| | |
|
| | | |
| | | /* // 查询IOS所有设备号
|
| | | // TODO 需要全推
|
| | | List<String> deviceTokenList = getDeviceTokenList(1, 20000);
|
| | | // IOS 全推
|
| | | ThreadUtil.run(new Runnable() {
|
| | |
|
| | | @Override
|
| | | public void run() {
|
| | | try {
|
| | | IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushController.GOODS);
|
| | | } catch (Exception e) {
|
| | | PushLogHelper.iosError(e);
|
| | | |
| | | }
|
| | | }
|
| | | });*/
|
| | | /*
|
| | | * // 查询IOS所有设备号 // TODO 需要全推 List<String> deviceTokenList =
|
| | | * getDeviceTokenList(1, 20000); // IOS 全推 ThreadUtil.run(new
|
| | | * Runnable() {
|
| | | * |
| | | * @Override public void run() { try {
|
| | | * IOSPushUtil.allPushIOS(deviceTokenList, info, url,
|
| | | * PushController.GOODS); } catch (Exception e) {
|
| | | * PushLogHelper.iosError(e);
|
| | | * |
| | | * } } });
|
| | | */
|
| | | } else {
|
| | | // IOS 单推
|
| | | List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid);
|
| | |
| | |
|
| | | addPushIOSQueue(info, url, PushController.URL);
|
| | |
|
| | | /*List<String> deviceTokenList = getDeviceTokenList(1, 1000);
|
| | | ThreadUtil.run(new Runnable() {
|
| | |
|
| | | @Override
|
| | | public void run() {
|
| | | try {
|
| | |
|
| | | IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushController.URL);
|
| | |
|
| | | } catch (Exception e) {
|
| | | PushLogHelper.iosError(e);
|
| | | }
|
| | | }
|
| | | });*/
|
| | | /*
|
| | | * List<String> deviceTokenList = getDeviceTokenList(1, 1000);
|
| | | * ThreadUtil.run(new Runnable() {
|
| | | * |
| | | * @Override public void run() { try {
|
| | | * |
| | | * IOSPushUtil.allPushIOS(deviceTokenList, info, url,
|
| | | * PushController.URL);
|
| | | * |
| | | * } catch (Exception e) { PushLogHelper.iosError(e); } } });
|
| | | */
|
| | | } else {
|
| | | List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid);
|
| | | List<String> deviceTokenList = new ArrayList<>();
|
| | |
| | |
|
| | | addPushIOSQueue(info, id + "", PushController.ZNX);
|
| | |
|
| | | /*List<String> deviceTokenList = getDeviceTokenList(1, 1000);
|
| | |
|
| | | ThreadUtil.run(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | try {
|
| | | IOSPushUtil.allPushIOS(deviceTokenList, info, id + "", PushController.ZNX);
|
| | | } catch (Exception e) {
|
| | | PushLogHelper.iosError(e);
|
| | | }
|
| | |
|
| | | }
|
| | | });*/
|
| | | /*
|
| | | * List<String> deviceTokenList = getDeviceTokenList(1, 1000);
|
| | | * |
| | | * ThreadUtil.run(new Runnable() {
|
| | | * |
| | | * @Override public void run() { try {
|
| | | * IOSPushUtil.allPushIOS(deviceTokenList, info, id + "",
|
| | | * PushController.ZNX); } catch (Exception e) {
|
| | | * PushLogHelper.iosError(e); }
|
| | | * |
| | | * } });
|
| | | */
|
| | | } else if (msg != null) {
|
| | | // 插入推送记录
|
| | | PushRecord pushRecord = new PushRecord();
|
| | |
| | | return deviceTokenIOSMapper.selectByDevice(device);
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 保存推送内容只队列中
|
| | | * |
| | | * @param json
|
| | | */
|
| | | @Transactional
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 队列执行推送操作
|
| | | */
|
| | |
| | |
|
| | | if (list != null) {
|
| | | executePushIOS(list, pushQueueRecord, recordCursor);
|
| | | PushLogHelper.iosInfo("推送游标:" + startCursor + "," + moveNum);
|
| | | }
|
| | |
|
| | | } else {
|
| | |
| | | List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList(recordCursor, moveNum);
|
| | | if (list != null) {
|
| | | executePushIOS(list, pushQueueRecord, endCursor);
|
| | | PushLogHelper.iosInfo("推送游标:" + recordCursor + "," + moveNum);
|
| | | }
|
| | | recordCursor = endCursor;
|
| | |
|
| | |
| | |
|
| | | if (list != null) {
|
| | | executePushIOS(list, pushQueueRecord, recordCursor-1);
|
| | | PushLogHelper.iosInfo("推送游标:" + recordCursor + "," + moveNum);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | }
|
| | | |
| | |
|
| | | public void executePushIOS(List<DeviceTokenIOS> list ,PushQueueRecord pushQueueRecord, long recordCursor) {
|
| | |
|
| | |
| | | //TODO 更新数据库
|
| | | pushQueueRecordMapper.updateByPrimaryKeySelective(pushQueueRecord);
|
| | | }
|
| | |
|
| | |
|
| | | }
|