Administrator
2018-11-05 2d950dce7919a2bc39464f9d264f7b96b69f6d1e
1.添加IOS推送日志记录
2.分享添加显示描述语
2个文件已修改
90 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/ShareController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/IOSPushServiceImpl.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/ShareController.java
@@ -107,6 +107,7 @@
            }
            shareText = shareText.replace("[价格类型]", shopType);
            data.put("shareText", shareText);
            data.put("descText", shareText.replace(taoBaoLink.getGoods().getTitle(), ""));
            // 添加分享记录
            BigDecimal rate = new BigDecimal(hongBaoManageService.get("hongbao_goods_proportion"));
fanli/src/main/java/com/yeshi/fanli/service/impl/push/IOSPushServiceImpl.java
@@ -21,6 +21,7 @@
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;
@@ -37,7 +38,6 @@
    
    @Resource
    private PushQueueRecordMapper pushQueueRecordMapper;
    @Override
    public void pushGoods(Long uid, Long auctionId, String title, String content) throws PushException {
@@ -68,23 +68,18 @@
            
            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);
@@ -128,20 +123,17 @@
            
            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<>();
@@ -195,19 +187,18 @@
            
            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();
@@ -301,9 +292,9 @@
        return deviceTokenIOSMapper.selectByDevice(device);
    }
    /**
     * 保存推送内容只队列中
     *
     * @param json
     */
    @Transactional
@@ -376,7 +367,6 @@
    }
    
    /**
     * 队列执行推送操作
     */
@@ -415,6 +405,7 @@
                
                if (list != null) {
                    executePushIOS(list, pushQueueRecord, recordCursor);
                    PushLogHelper.iosInfo("推送游标:" + startCursor + "," + moveNum);
                }
                
            } else {
@@ -426,6 +417,7 @@
                    List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList(recordCursor, moveNum);
                    if (list != null) {
                        executePushIOS(list, pushQueueRecord, endCursor);
                        PushLogHelper.iosInfo("推送游标:" + recordCursor + "," + moveNum);
                    }
                    recordCursor = endCursor;
                    
@@ -435,6 +427,7 @@
                    
                    if (list != null) {
                        executePushIOS(list, pushQueueRecord, recordCursor-1);
                        PushLogHelper.iosInfo("推送游标:" + recordCursor + "," + moveNum);
                    }
                }
                
@@ -443,7 +436,6 @@
        }
        
    }
    
    public void executePushIOS(List<DeviceTokenIOS> list ,PushQueueRecord pushQueueRecord, long recordCursor) {
        
@@ -475,6 +467,5 @@
        //TODO 更新数据库
        pushQueueRecordMapper.updateByPrimaryKeySelective(pushQueueRecord);
    }
    
}