yujian
2019-08-26 588607eeb4168f6f5734fdc91bb3dfd101eeb4eb
Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
19个文件已修改
1个文件已添加
631 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/PushController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMoneyController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java 97 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2Mapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/push/PushTypeEnum.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2Mapper.xml 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/IOSPushServiceImpl.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/XMPushServiceImpl.java 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/push/BasePushService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/push/HWPushService.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/push/PushService.java 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/IOSPushFactory.java 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/UserMoneyDetailFactory.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/push/HWPushUtil.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/push/IOSPushUtil.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/test/java/org/fanli/TaoKeTest.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/PushController.java
@@ -28,15 +28,6 @@
@RequestMapping("admin/new/api/v1/push")
public class PushController {
    public final static int GOODS = 1; // 商品推送
    public final static int URL = 2; // 网页推送
    public final static int DETAIL = 3; // 详情推送
    public final static int ZNX = 4; // 站内推送
    public final static int WEEX = 5; // 站内推送
    public final static int BAICHUAN = 6; // 站内推送
    public final static int WELFARE_CENTER = 7; // 福利中心
    @Resource
    private PushService pushService;
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java
@@ -2185,6 +2185,8 @@
        // 红包
        if (hongBao == null) {
            BigDecimal proportion = manageService.getFanLiRate();
            if ("taolijin".equalsIgnoreCase(from))
                proportion = manageService.getTLJShareRate(System.currentTimeMillis());
            hongBao = TaoBaoUtil.getGoodsHongBaoInfo(tb, proportion);
        }
        goodsJson.put("hongBao", hongBao);
@@ -2273,7 +2275,7 @@
        // 推广红包
        if (from != null && from.equals("taolijin")) {
            // 计算推广红包
            String warningRate = configTaoLiJinService.getValueByKey("warning_value",null);
            String warningRate = configTaoLiJinService.getValueByKey("warning_value", null);
            BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, goods);
            // 推广红包 不能小于1
@@ -2332,7 +2334,7 @@
                data.put("userHongbao", userMoneyExtra.getTlj().setScale(2).toString());
            }
            noRebateHelpLink = configTaoLiJinService.getValueByKey("share_goods_help_link",null);
            noRebateHelpLink = configTaoLiJinService.getValueByKey("share_goods_help_link", null);
            if (Constant.IS_TEST) {
                fanliValid = true;
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMoneyController.java
@@ -265,13 +265,15 @@
        Calendar ca = Calendar.getInstance();
        ca.setTime(new Date(timeStamp));
        ca.add(Calendar.MONTH, 1);
        maxDate = new Date(ca.getTimeInMillis());
        maxDate = new Date(
                TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy-MM"), "yyyy-MM"));
        // 本月未到账
        vo.setMonthUnRecievedMoney(hongBaoV2Service.getUnRecievedMoneyWithPreGetTime(uid, minDate, maxDate));
        // 全部未到账
        minDate = new Date(0);
        maxDate=new Date(timeStamp);
        vo.setTotalUnRecievedMoney(hongBaoV2Service.getUnRecievedMoneyWithCreateTime(uid, minDate, maxDate));
        GsonBuilder builder = new GsonBuilder();
        builder.registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java
@@ -240,7 +240,7 @@
        if (todayUse == null || todayUse.compareTo(zero) > 0) {
            todayUse = zero;
        }
        BigDecimal yesterdayUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 2);
        if (yesterdayUse == null || yesterdayUse.compareTo(zero) > 0) {
            yesterdayUse = zero;
@@ -252,12 +252,10 @@
        BigDecimal lastMonthUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 4);
        if (lastMonthUse == null || lastMonthUse.compareTo(zero) > 0) {
            lastMonthUse = zero;
        }
        }
        
        String giveMin = configTaoLiJinService.getValueByKey("give_min_amount");
        String giveMin = configTaoLiJinService.getValueByKey("give_min_amount");
        // 问号链接
        String helpLink = configTaoLiJinService.getValueByKey("hongbao_help_link",null);
        JSONObject data = new JSONObject();
        data.put("tlj", tlj.setScale(2).toString());
@@ -402,7 +400,7 @@
                // 已领取
                money = deviceRecord.getMoney();
            } else {
                String value = configTaoLiJinService.getValueByKey("hongbao_newbies",null);
                String value = configTaoLiJinService.getValueByKey("hongbao_newbies", null);
                if (StringUtil.isNullOrEmpty(value)) {
                    out.print(JsonUtil.loadFalseResult(1, "系统红包不存在"));
                    return;
@@ -412,7 +410,7 @@
            }
            JSONObject data = new JSONObject();
            data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon",null));
            data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon", null));
            data.put("title", "新人红包");
            data.put("content", "自购直接抵现,优惠真实可见!");
            data.put("type", 1);
@@ -420,8 +418,8 @@
            data.put("usage", "领取成功,已存入“我的-推广红包”");
            data.put("jumpName", "去使用");
            data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
            data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip",null));
            data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link",null));
            data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip", null));
            data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link", null));
            out.print(JsonUtil.loadTrueResult(data));
            return;
@@ -430,7 +428,7 @@
        // 登录用户
        boolean isReceive = false;
        JSONObject data = new JSONObject();
        data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon",null));
        data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon", null));
        if (type.equals(TaoLiJinOriginEnum.newbiesWin.name())) {
            BigDecimal hasMoney = null;
@@ -454,8 +452,8 @@
            data.put("usage", "领取成功,已存入“我的-推广红包”");
            data.put("jumpName", "去使用");
            data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
            data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip",null));
            data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link",null));
            data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip", null));
            data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link", null));
        } else if (type.equals(TaoLiJinOriginEnum.rankWin.name())) {
            boolean isRank = false;
@@ -491,8 +489,8 @@
                data.put("money", "本月账户等级未达到\r\n继续加油");
                data.put("jumpName", "去查看");
                data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("user_rank"));
                data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_not_enough_tip",null));
                data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link",null));
                data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_not_enough_tip", null));
                data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link", null));
                out.print(JsonUtil.loadTrueResult(data));
                return;
            } else {
@@ -507,8 +505,8 @@
                }
                data.put("jumpName", "去使用");
                data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
                data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_tip",null));
                data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link",null));
                data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_tip", null));
                data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link", null));
            }
        } else {
@@ -552,7 +550,7 @@
            }
        }
        BigDecimal proportion = hongBaoManageService.getFanLiRate();
        BigDecimal proportion = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
        for (ShareHotGoods hotGoods : listHot) {
            TaoBaoGoodsBrief taoBaoGoodsBrief = hotGoods.getGoods();
            if (taoBaoGoodsBrief == null) {
@@ -560,7 +558,7 @@
            }
            // 计算推广红包
            String warningRate = configTaoLiJinService.getValueByKey("warning_value",new Date());
            String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date());
            BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, taoBaoGoodsBrief);
            // 推广红包 不能小于1
@@ -584,8 +582,8 @@
            array.add(gson.toJson(extra));
        }
        /*// 过期 -取消收回
         * executor.execute(new Runnable() {
        /*
         * // 过期 -取消收回 executor.execute(new Runnable() {
         * 
         * @Override public void run() {
         * userTaoLiJinOriginService.overdueHongBao(uid); } });
@@ -596,10 +594,10 @@
        data.put("list", array);
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 分享爆款商品-限于淘礼金
     *
     * @param acceptData
     * @param uid
     * @param out
@@ -610,20 +608,19 @@
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        String day = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis());
        List<ShareHotGoods> listHot = shareHotGoodsService.listByDay(day);
        if (listHot == null) {
            listHot = new ArrayList<ShareHotGoods>();
            listHot = new ArrayList<ShareHotGoods>();
        }
        JSONArray array = new JSONArray();
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
        //取消新人自购
        boolean isNewUser = false;//userInfoExtraService.isNewUser(uid);
        // 取消新人自购
        boolean isNewUser = false;// userInfoExtraService.isNewUser(uid);
        if (isNewUser) {
            // 判定为老用户: 新人只要使用了新人红包,也就是那1块钱,那么,他看到的分享爆款中的商品-就只能分享。
            long countRecord = userTaoLiJinRecordService.countRecordByUid(uid);
@@ -631,8 +628,7 @@
                isNewUser = false;
            }
        }
        BigDecimal fanLiRate = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
        BigDecimal shareRate = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
        for (ShareHotGoods hotGoods : listHot) {
@@ -640,24 +636,24 @@
            if (taoBaoGoodsBrief == null) {
                continue;
            }
            // 计算推广红包
            String warningRate = configTaoLiJinService.getValueByKey("warning_value",new Date());
            String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date());
            BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, taoBaoGoodsBrief);
            // 推广红包 不能小于1
            if (spreadMoney.compareTo(new BigDecimal(1.1)) < 0) {
                continue;
            }
            GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate);
            // 去掉标签
            detailVO.setLabels(null);
            MoneyInfoVO moneyInfo = detailVO.getMoneyInfo();
            OtherInfo otherInfo = new OtherInfo();
            SpreadHongBao spreadHongBao = new SpreadHongBao();
            // 显示类型
            if (isNewUser) {
                moneyInfo.setMoneyType(1);
@@ -671,25 +667,23 @@
            detailVO.setMoneyInfo(moneyInfo);
            otherInfo.setSpreadHongBao(spreadHongBao);
            detailVO.setOtherInfo(otherInfo);
            array.add(gson.toJson(detailVO));
        }
        /*
         * executor.execute(new Runnable() {
         * 
         * @Override public void run() { // 过期
         * userTaoLiJinOriginService.overdueHongBao(uid); } });
         */
        JSONObject data = new JSONObject();
        data.put("count", array.size());
        data.put("list", array);
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 分享爆款商品-限于淘礼金
     * 
@@ -753,18 +747,17 @@
        data.put("list", array);
        if (page == 1) {
            List<SwiperPicture> bannerList = swiperPictureService.getByBannerCard("zigoulijian_banner");
            if (bannerList != null && bannerList.size() > 0)
                data.put("topPicture", bannerList.get(0).getSrc());
            else
                data.put("topPicture", "");
            data.put("ruleUrl", configService.get("zigoulijian_rule"));
        }
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 分享爆款商品-限于淘礼金
     * 
@@ -800,16 +793,14 @@
                continue;
            }
            GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, proportion, proportion);
            // 去掉标签
            detailVO.setLabels(null);
            MoneyInfoVO moneyInfo = detailVO.getMoneyInfo();
            moneyInfo.setMoneyType(2);
            detailVO.setMoneyInfo(moneyInfo);
            String hongBao = spreadMoney.toString();
            ReduceHongBao vo = new ReduceHongBao();
            vo.setLeft(hotGoods.getLeftHongBaoCount());
@@ -817,11 +808,11 @@
            vo.setName("付款立减 ");
            vo.setTip("");
            vo.setTotal(hotGoods.getTotalHongBaoCount());
            OtherInfo otherInfo = new OtherInfo();
            otherInfo.setReduceHongBao(vo);
            detailVO.setOtherInfo(otherInfo);
            array.add(gson.toJson(detailVO));
        }
@@ -833,12 +824,12 @@
        data.put("list", array);
        if (page == 1) {
            List<SwiperPicture> bannerList = swiperPictureService.getByBannerCard("zigoulijian_banner");
            if (bannerList != null && bannerList.size() > 0)
                data.put("topPicture", bannerList.get(0).getSrc());
            else
                data.put("topPicture", "");
            data.put("ruleUrl", configService.get("zigoulijian_rule"));
        }
        out.print(JsonUtil.loadTrueResult(data));
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2Mapper.java
@@ -127,8 +127,16 @@
     * @param count
     * @return
     */
    List<HongBaoV2> listCanBalanceHongBaoByTypeAndUid(@Param("types") List<Integer> type, @Param("uid") Long uid,
    List<HongBaoV2> listCanBalanceHongBaoByTypeAndUid(@Param("types") List<Integer> type, @Param("uid") Long uid,@Param("start") long start,
            @Param("count") int count);
    /**
     * 计算可以结算红包的数量
     * @param type
     * @param uid
     * @return
     */
    long countCanBalanceHongBaoByTypeAndUid(@Param("types") List<Integer> type, @Param("uid") Long uid);
    /**
     * 根据用户ID,订单状态和结算时间统计邀请赚的订单数量
fanli/src/main/java/com/yeshi/fanli/dto/push/PushTypeEnum.java
New file
@@ -0,0 +1,21 @@
package com.yeshi.fanli.dto.push;
public enum PushTypeEnum {
    goodsdetail(1, "淘宝商品详情"), url(2, "网页"), ZNX(4, "站内信"), weex(5, "weex"), baichuan(6, "百川链接"), welfare(7,
            "福利中心"), signin(8, "签到");
    private final String desc;
    private final int code;
    private PushTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
    public String getDesc() {
        return desc;
    }
    public int getCode() {
        return code;
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2Mapper.xml
@@ -221,8 +221,27 @@
        hb_pre_get_time IS NOT NULL AND
        hb_pre_get_time>0 AND
        NOW()>=hb_pre_get_time limit
        #{count}
        #{start},#{count}
    </select>
    <select id="countCanBalanceHongBaoByTypeAndUid" resultType="java.lang.Long">
        select
        count(hb_id)
        from yeshi_ec_hongbao_v2 where hb_uid=#{uid} and `hb_version`=2
        <foreach collection="types" item="type" open=" and ("
            separator=" or " close=")">
            hb_type =
            #{type}
        </foreach>
        and
        (hb_state=1 or hb_state=2) and
        hb_pre_get_time IS NOT NULL AND
        hb_pre_get_time>0 AND
        NOW()>=hb_pre_get_time
    </select>
    <select id="countInviteOrderCountByUidAndSettleTime" resultType="java.lang.Long">
        SELECT COUNT(h.hb_id) FROM yeshi_ec_hongbao_v2 h LEFT JOIN
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -574,7 +574,16 @@
        List<Integer> types = new ArrayList<>();
        types.add(HongBaoV2.TYPE_YIJI);
        types.add(HongBaoV2.TYPE_ERJI);
        List<HongBaoV2> hongBaoList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid, 1000);
        long count=    hongBaoV2Mapper.countCanBalanceHongBaoByTypeAndUid(types, uid);
        List<HongBaoV2> hongBaoList =new ArrayList<>();
        //1000条数据为1页
        int page=(int)    (count%1000==0?count/1000:count/1000+1);
        for(int i=0;i<page;i++)
        {
            List<HongBaoV2> tempHongBaoList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid, i*1000,1000);
            if(tempHongBaoList!=null&&tempHongBaoList.size()>0)
                hongBaoList.addAll(tempHongBaoList);
        }
        // 灰度测试中,京东/拼多多订单分享/邀请订单不返利
        for (int i = 0; i < hongBaoList.size(); i++) {
            HongBaoV2 item = hongBaoList.get(i);
@@ -591,7 +600,7 @@
                        hongBaoList.remove(i);
                        i--;
                    } else {// 上级用户不是正常用户,订单均不能到账
                        UserInfo userInfo = userInfoMapper.selectByPrimaryKey(item.getUserInfo().getId());
                        UserInfo userInfo = userInfoMapper.selectByPrimaryKey(co.getUserInfo().getId());
                        if (userInfo == null || userInfo.getState() != UserInfo.STATE_NORMAL) {
                            hongBaoList.remove(i);
                            i--;
@@ -651,7 +660,8 @@
        types.clear();
        types.add(HongBaoV2.TYPE_SHARE_YIJI);
        types.add(HongBaoV2.TYPE_SHARE_ERJI);
        List<HongBaoV2> hbList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid, 10000);
        //TODO 需要处理超过1w条数据的订单
        List<HongBaoV2> hbList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid,0, 10000);
        if (hbList != null && hbList.size() > 0)
            totalHongBaoList.addAll(hbList);
@@ -735,7 +745,8 @@
        // 查询UID的分享赚订单
        types.clear();
        types.add(HongBaoV2.TYPE_SHARE_GOODS);
        List<HongBaoV2> hongBaoShareList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid, 10000);
        //TODO 需要处理超过10000条数据的订单
        List<HongBaoV2> hongBaoShareList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid,0, 10000);
        for (HongBaoV2 hongBao : hongBaoShareList) {
            hongBao = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hongBao.getId());
            hongBao = filterWeiQuanINGHongBao(hongBao);
fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java
@@ -8,10 +8,10 @@
import javax.annotation.Resource;
import org.checkerframework.checker.units.qual.h;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dto.push.PushTypeEnum;
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.bus.user.UserCustomSettings;
import com.yeshi.fanli.entity.bus.user.UserCustomSettings.UserSettingTypeEnum;
@@ -60,27 +60,27 @@
    @Override
    public void pushGoods(Long uid, Long auctionId, String title, String content, List<Integer> versionCodeList)
            throws PushException {
        push("goodsdetail", uid, title, content, null, null, auctionId, versionCodeList);
        push(PushTypeEnum.goodsdetail, uid, title, content, null, null, auctionId, versionCodeList);
    }
    @Async("pushExecutor")
    @Override
    public void pushUrl(Long uid, String url, String title, String content, List<Integer> versionCodeList)
            throws PushException {
        push("url", uid, title, content, null, url, null, versionCodeList);
        push(PushTypeEnum.url, uid, title, content, null, url, null, versionCodeList);
    }
    @Async("pushExecutor")
    @Override
    public void pushZNX(Long uid, String title, String content, List<Integer> versionCodeList) throws PushException {
        push("ZNX", uid, title, content, null, null, null, versionCodeList);
        push(PushTypeEnum.ZNX, uid, title, content, null, null, null, versionCodeList);
    }
    @Async("pushExecutor")
    @Override
    public void pushWEEX(Long uid, String title, String content, String weexUrl, List<Integer> versionCodeList)
            throws PushException {
        push("weex", uid, title, content, weexUrl, null, null, versionCodeList);
        push(PushTypeEnum.weex, uid, title, content, weexUrl, null, null, versionCodeList);
    }
    @Async("pushExecutor")
@@ -88,14 +88,20 @@
    public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<Integer> versionCodeList)
            throws PushException {
        push("baichuan", uid, title, content, null, url, null, versionCodeList);
        push(PushTypeEnum.baichuan, uid, title, content, null, url, null, versionCodeList);
    }
    @Async("pushExecutor")
    @Override
    public void pushWelfareCenter(Long uid, String title, String content, List<Integer> versionCodeList)
            throws PushException {
        push("welfare", uid, title, content, null, null, null, versionCodeList);
        push(PushTypeEnum.welfare, uid, title, content, null, null, null, versionCodeList);
    }
    @Override
    public void pushUserSignInNotification(Long uid, String title, String content, List<Integer> versionCodeList)
            throws PushException {
        push(PushTypeEnum.signin, uid, title, content, null, null, null, versionCodeList);
    }
    private List<DeviceTokenHW> filterDeviceToken(List<DeviceTokenHW> hwDeviceList, int hour) {
@@ -136,7 +142,7 @@
     * @param webUrl
     * @param versionCodeList
     */
    private void push(String type, Long uid, String title, String content, String url, String webUrl, Long goodsId,
    private void push(PushTypeEnum type, Long uid, String title, String content, String url, String webUrl, Long goodsId,
            List<Integer> versionCodeList) throws PushException {
        int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
        List<Integer> newVersionList = getVersionCodeList(versionCodeList);
@@ -151,26 +157,28 @@
                for (DeviceTokenHW token : hwDeviceList)
                    tokenList.add(token.getDeviceToken());
                try {
                    if (type.equalsIgnoreCase("goodsdetail")) {// 商品详情
                    if (type==PushTypeEnum.goodsdetail) {// 商品详情
                        if (goodsId == null)
                            throw new PushException(2, "参数不完整");
                        HWPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
                    } else if (type.equalsIgnoreCase("url")) {// 链接
                    } else if (type==PushTypeEnum.url) {// 链接
                        if (StringUtil.isNullOrEmpty(webUrl))
                            throw new PushException(2, "参数不完整");
                        HWPushUtil.pushUrl(tokenList, title, content, webUrl);
                    } else if (type.equalsIgnoreCase("ZNX")) {// 站内信
                    } else if (type==PushTypeEnum.ZNX) {// 站内信
                        HWPushUtil.pushZNX(tokenList, title, content);
                    } else if (type.equalsIgnoreCase("weex")) {// weex
                    } else if (type==PushTypeEnum.weex) {// weex
                        if (StringUtil.isNullOrEmpty(url))
                            throw new PushException(2, "参数不完整");
                        HWPushUtil.pushWEEX(tokenList, title, content, url);
                    } else if (type.equalsIgnoreCase("baichuan")) {// 百川链接
                    } else if (type==PushTypeEnum.baichuan) {// 百川链接
                        if (StringUtil.isNullOrEmpty(webUrl))
                            throw new PushException(2, "参数不完整");
                        HWPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
                    } else if (type.equalsIgnoreCase("welfare")) {// 福利中心
                    } else if (type==PushTypeEnum.welfare) {// 福利中心
                        HWPushUtil.pushWelfareCenter(tokenList, title, content);
                    }else if (type==PushTypeEnum.signin) {// 签到
                        HWPushUtil.pushUserSignInNotification(tokenList, title, content);
                    }
                } catch (Exception e) {
                    PushLogHelper.hwError(e);
@@ -190,26 +198,28 @@
                return;
            try {
                if (type.equalsIgnoreCase("goodsdetail")) {// 商品详情
                if (type==PushTypeEnum.goodsdetail) {// 商品详情
                    if (goodsId == null)
                        throw new PushException(2, "参数不完整");
                    HWPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
                } else if (type.equalsIgnoreCase("url")) {// 链接
                } else if (type==PushTypeEnum.url) {// 链接
                    if (StringUtil.isNullOrEmpty(webUrl))
                        throw new PushException(2, "参数不完整");
                    HWPushUtil.pushUrl(tokenList, title, content, webUrl);
                } else if (type.equalsIgnoreCase("ZNX")) {// 站内信
                } else if (type==PushTypeEnum.ZNX) {// 站内信
                    HWPushUtil.pushZNX(tokenList, title, content);
                } else if (type.equalsIgnoreCase("weex")) {// weex
                } else if (type==PushTypeEnum.weex) {// weex
                    if (StringUtil.isNullOrEmpty(url))
                        throw new PushException(2, "参数不完整");
                    HWPushUtil.pushWEEX(tokenList, title, content, url);
                } else if (type.equalsIgnoreCase("baichuan")) {// 百川链接
                } else if (type==PushTypeEnum.baichuan) {// 百川链接
                    if (StringUtil.isNullOrEmpty(webUrl))
                        throw new PushException(2, "参数不完整");
                    HWPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
                } else if (type.equalsIgnoreCase("welfare")) {// 福利中心
                } else if (type==PushTypeEnum.welfare) {// 福利中心
                    HWPushUtil.pushWelfareCenter(tokenList, title, content);
                } else if (type==PushTypeEnum.signin) {// 签到
                    HWPushUtil.pushUserSignInNotification(tokenList, title, content);
                }
            } catch (Exception e) {
                PushLogHelper.hwError(e);
fanli/src/main/java/com/yeshi/fanli/service/impl/push/IOSPushServiceImpl.java
@@ -12,9 +12,9 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.controller.admin.PushController;
import com.yeshi.fanli.dao.mybatis.push.DeviceTokenIOSMapper;
import com.yeshi.fanli.dao.mybatis.push.PushQueueRecordMapper;
import com.yeshi.fanli.dto.push.PushTypeEnum;
import com.yeshi.fanli.entity.bus.user.AccountMessage;
import com.yeshi.fanli.entity.push.DeviceTokenIOS;
import com.yeshi.fanli.entity.push.PushQueueRecord;
@@ -46,7 +46,8 @@
    @Async("pushExecutor")
    @Override
    public void pushGoods(Long uid, Long auctionId, String title, String content, String versionCodes) throws PushException {
    public void pushGoods(Long uid, Long auctionId, String title, String content, String versionCodes)
            throws PushException {
        String url = "https://item.taobao.com/item.htm?id=" + auctionId;
        JSONObject json = new JSONObject();
@@ -65,14 +66,14 @@
        PushRecord pushRecord = new PushRecord();
        pushRecord.setState(1);
        pushRecord.setType(PushController.GOODS); // 都成功
        pushRecord.setType(PushTypeEnum.goodsdetail.getCode()); // 都成功
        pushRecord.setUrl(url);
        pushRecord.setTitle(title);
        pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
        if (uid == null || uid == 0) {
            addPushIOSQueue(info, url, PushController.GOODS, versionCodes);
            addPushIOSQueue(info, url, PushTypeEnum.goodsdetail.getCode(), versionCodes);
            /*
             * // 查询IOS所有设备号 // TODO 需要全推 List<String> deviceTokenList =
@@ -90,10 +91,10 @@
            if (!validateNotDisturbSingle(uid)) {
                return; // 通知免打扰(20:00-24:00 / 00:00 -08:00)
            }
            // IOS 单推
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
@@ -101,7 +102,7 @@
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushController.GOODS);
                IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushTypeEnum.goodsdetail.getCode());
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
@@ -133,7 +134,7 @@
        if (uid == null || uid == 0) {
            // TODO 需要全推
            addPushIOSQueue(info, url, PushController.URL, versionCodes);
            addPushIOSQueue(info, url, PushTypeEnum.url.getCode(), versionCodes);
            /*
             * List<String> deviceTokenList = getDeviceTokenList(1, 1000);
@@ -158,14 +159,13 @@
                    deviceTokenList.add(ios.getDeviceToken());
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushController.URL);
                IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushTypeEnum.url.getCode());
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
        }
    }
    @Async("pushExecutor")
    @Override
    public void pushZNX(Long uId, AccountMessage msg, SystemZnx systemZNX, String versionCodes) throws PushException {
@@ -198,7 +198,7 @@
            // TODO 需要全推
            addPushIOSQueue(info, id + "", PushController.ZNX, versionCodes);
            addPushIOSQueue(info, id + "", PushTypeEnum.ZNX.getCode(), versionCodes);
            /*
             * List<String> deviceTokenList = getDeviceTokenList(1, 1000);
@@ -250,7 +250,7 @@
            // IOS 单推
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, "0", PushController.ZNX);
                IOSPushUtil.allPushIOS(deviceTokenList, info, "0", PushTypeEnum.ZNX.getCode());
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
@@ -328,8 +328,8 @@
     */
    @Transactional
    public void addPushIOSQueue(MessageInfo info, String url, int type, String versionCodes) throws PushException {
        if(Constant.IS_TEST)
        if (Constant.IS_TEST)
            return;
        try {
@@ -344,7 +344,7 @@
            // 每次执行条目
            int pushNum = 50;
            for (long i = 0; i < tokenCount + totalCount;) {
                PushQueueRecord pushQueueRecord = new PushQueueRecord();
@@ -360,7 +360,6 @@
                pushQueueRecord.setType(1);
                // 版本号
                pushQueueRecord.setVersions(versionCodes);
                if (tokenCount - i < totalCount) {
                    // 起始游标
@@ -411,17 +410,15 @@
        Long startCursor = pushQueueRecord.getStartCursor();
        // 结束位置
        Long endCursor = pushQueueRecord.getEndCursor();
        if (startCursor == null && endCursor == null) {
            return;
        }
        // 推送的版本号
        String versions = pushQueueRecord.getVersions();
        List<Integer> listCode = convertVersionType(versions);
        int total = (int) (endCursor - startCursor);
        // 每次推送总条数
@@ -436,7 +433,7 @@
        long recordCursor = startCursor;
        for (int i = 0; i < count; i++) {
            // 不足50个数据
            if (moveNum > total) {
                moveNum = (int) (endCursor - startCursor);
@@ -535,14 +532,15 @@
    @Async("pushExecutor")
    @Override
    public void pushWEEX(Long uid, String title, String content, String weexUrl,String versionCodes) throws PushException {
    public void pushWEEX(Long uid, String title, String content, String weexUrl, String versionCodes)
            throws PushException {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // IOS 全推
        if (uid == null || uid == 0) {
            addPushIOSQueue(info, weexUrl, PushController.WEEX, versionCodes);
            addPushIOSQueue(info, weexUrl, PushTypeEnum.weex.getCode(), versionCodes);
        } else {
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
            List<String> deviceTokenList = new ArrayList<>();
@@ -551,7 +549,7 @@
                    deviceTokenList.add(ios.getDeviceToken());
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, weexUrl, PushController.WEEX);
                IOSPushUtil.allPushIOS(deviceTokenList, info, weexUrl, PushTypeEnum.weex.getCode());
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
@@ -560,14 +558,15 @@
    @Async("pushExecutor")
    @Override
    public void pushBaiChuanUrl(Long uid, String title, String content, String url, String versionCodes) throws PushException {
    public void pushBaiChuanUrl(Long uid, String title, String content, String url, String versionCodes)
            throws PushException {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // IOS 全推
        if (uid == null || uid == 0) {
            addPushIOSQueue(info, url, PushController.BAICHUAN, versionCodes);
            addPushIOSQueue(info, url, PushTypeEnum.baichuan.getCode(), versionCodes);
        } else {
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
            List<String> deviceTokenList = new ArrayList<>();
@@ -576,7 +575,7 @@
                    deviceTokenList.add(ios.getDeviceToken());
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushController.BAICHUAN);
                IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushTypeEnum.baichuan.getCode());
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
@@ -616,7 +615,7 @@
        info.setDescription(content);
        // IOS 全推
        if (uid == null || uid == 0) {
            addPushIOSQueue(info, "", PushController.WELFARE_CENTER, versionCodes);
            addPushIOSQueue(info, "", PushTypeEnum.welfare.getCode(), versionCodes);
        } else {
            if (!validateNotDisturbSingle(uid)) {
                return;
@@ -628,7 +627,7 @@
                    deviceTokenList.add(ios.getDeviceToken());
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, "", PushController.WELFARE_CENTER);
                IOSPushUtil.allPushIOS(deviceTokenList, info, "", PushTypeEnum.welfare.getCode());
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
@@ -653,5 +652,30 @@
        }
        return listVersionCode;
    }
    @Override
    public void pushUserSignInNotification(Long uid, String title, String content, String versions)
            throws PushException {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // IOS 全推
        if (uid == null || uid == 0) {
            addPushIOSQueue(info, "", PushTypeEnum.signin.getCode(), versions);
        } else {
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versions);
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
                    deviceTokenList.add(ios.getDeviceToken());
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, "", PushTypeEnum.signin.getCode());
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java
@@ -9,6 +9,7 @@
import com.yeshi.fanli.controller.admin.PushController;
import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
import com.yeshi.fanli.dao.mybatis.push.PushRecordMapper;
import com.yeshi.fanli.dto.push.PushTypeEnum;
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.bus.user.AccountMessage;
import com.yeshi.fanli.entity.bus.user.UserInfo;
@@ -104,7 +105,7 @@
        PushRecord pushRecord = new PushRecord();
        pushRecord.setUid(uid);
        pushRecord.setState(1);
        pushRecord.setType(PushController.GOODS); // 都成功
        pushRecord.setType(PushTypeEnum.goodsdetail.getCode()); // 都成功
        pushRecord.setUrl(url);
        pushRecord.setTitle(title);
        pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
@@ -153,7 +154,7 @@
        PushRecord pushRecord = new PushRecord();
        pushRecord.setUid(uid);
        pushRecord.setState(1);
        pushRecord.setType(PushController.URL);
        pushRecord.setType(PushTypeEnum.url.getCode());
        pushRecord.setUrl(url);
        pushRecord.setTitle(title);
        pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
@@ -221,7 +222,7 @@
        pushRecord.setUid(uId);
        pushRecord.setTitle(title);
        pushRecord.setState(1); // 成功
        pushRecord.setType(PushController.ZNX); // 类型:站内信
        pushRecord.setType(PushTypeEnum.ZNX.getCode()); // 类型:站内信
        pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
        pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
        pushRecordMapper.insertSelective(pushRecord);
@@ -268,7 +269,7 @@
        pushRecord.setTitle(title);
        pushRecord.setUid(uid);
        pushRecord.setState(1); // 成功
        pushRecord.setType(PushController.WEEX); // 类型:WEEX
        pushRecord.setType(PushTypeEnum.weex.getCode()); // 类型:WEEX
        pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
        pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
        pushRecordMapper.insertSelective(pushRecord);
@@ -317,7 +318,7 @@
        pushRecord.setTitle(title);
        pushRecord.setUid(uid);
        pushRecord.setState(1); // 成功
        pushRecord.setType(PushController.BAICHUAN); // 类型:百川
        pushRecord.setType(PushTypeEnum.baichuan.getCode()); // 类型:百川
        pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
        pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
        pushRecordMapper.insertSelective(pushRecord);
@@ -363,7 +364,7 @@
        pushRecord.setTitle(title);
        pushRecord.setUid(uid);
        pushRecord.setState(1); // 成功
        pushRecord.setType(PushController.WELFARE_CENTER); // 类型:百川
        pushRecord.setType(PushTypeEnum.welfare.getCode()); // 类型:百川
        pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
        pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
        pushRecordMapper.insertSelective(pushRecord);
@@ -449,4 +450,49 @@
        return versionCodes;
    }
    @Override
    public void pushUserSignInNotification(Long uid, String title, String content, List<String> listIOS,
            List<String> listAndroid) throws PushException {
        if (StringUtil.isNullOrEmpty(title))
            throw new PushException(1, "无推送标题");
        if (StringUtil.isNullOrEmpty(content))
            throw new PushException(1, "无推送内容");
        /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
        if (listIOS == null || listIOS.size() > 0) {
            // 限制推送版本号:0
            String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS);
            if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
                iosPushService.pushUserSignInNotification(uid, title, content, codes);
            }
        }
        /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
        if (listAndroid == null || listAndroid.size() > 0) {
            // 限制推送版本号:36
            String versions = getEffectiveVersions(36, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
            if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
                xmPushService.pushUserSignInNotification(uid, title, content, versions);
            }
        }
        // 华为推送
        if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            hwPushService.pushUserSignInNotification(uid, title, content, versionCodeList);
        }
        // 插入推送记录
        PushRecord pushRecord = new PushRecord();
        pushRecord.setTitle(title);
        pushRecord.setUid(uid);
        pushRecord.setState(1); // 成功
        pushRecord.setType(PushTypeEnum.signin.getCode()); // 类型:百川
        pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
        pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
        pushRecordMapper.insertSelective(pushRecord);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/push/XMPushServiceImpl.java
@@ -3,6 +3,7 @@
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dto.push.PushTypeEnum;
import com.yeshi.fanli.entity.bus.user.AccountMessage;
import com.yeshi.fanli.entity.system.SystemZnx;
import com.yeshi.fanli.entity.xinge.MessageInfo;
@@ -27,7 +28,7 @@
        JSONObject json = new JSONObject();
        // json.put("url", "http://item.taobao.com/item.htm?id=" + gid);// IOS使用
        json.put("id", gid);
        json.put("type", "goodsdetail");
        json.put("type", PushTypeEnum.goodsdetail.name());
        json.put("miPushUrl", String.format("%s.ui.recommend.GoodsBrowserActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
@@ -65,7 +66,7 @@
        JSONObject json = new JSONObject();
        json.put("url", url);
        json.put("type", "url");
        json.put("type", PushTypeEnum.url.name());
        json.put("webUrl", url);
        json.put("miPushUrl", String.format("%s.ui.invite.ShareBrowserActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
@@ -122,7 +123,7 @@
            contentJson.put("id", id);
            JSONObject json = new JSONObject();
            json.put("type", "ZNX");
            json.put("type",PushTypeEnum.ZNX.name());
            json.put("content", contentJson);
            json.put("miPushUrl", String.format("%s.ui.main.MainActivity",
                    Constant.systemCommonConfig.getAndroidBaseactivityName()));
@@ -156,7 +157,7 @@
            contentJson.put("id", msg.getId() + "");
            JSONObject json = new JSONObject();
            json.put("type", "ZNX");
            json.put("type", PushTypeEnum.ZNX.name());
            json.put("content", contentJson);
            json.put("miPushUrl", String.format("%s.ui.main.MainActivity",
                    Constant.systemCommonConfig.getAndroidBaseactivityName()));
@@ -181,7 +182,7 @@
        JSONObject json = new JSONObject();
        json.put("url", weexUrl);
        json.put("type", "weex");
        json.put("type", PushTypeEnum.weex.name());
        // 版本推送
        if (versions != null && versions.trim().length() > 0) {
@@ -219,7 +220,7 @@
        JSONObject json = new JSONObject();
        json.put("url", url);
        json.put("type", "baichuan");
        json.put("type", PushTypeEnum.baichuan.name());
        // 版本推送
        if (versions != null && versions.trim().length() > 0) {
            json.put("app_version", versions);
@@ -252,7 +253,7 @@
    public void pushWelfareCenter(Long uid, String title, String content, String versions) throws PushException {
        JSONObject json = new JSONObject();
        json.put("type", "welfare");
        json.put("type", PushTypeEnum.welfare.name());
        json.put("miPushUrl", String.format("%s.ui.mine.WelfareCenterActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
        // 版本推送
@@ -284,4 +285,40 @@
        }
    }
    @Override
    public void pushUserSignInNotification(Long uid, String title, String content, String versions)
            throws PushException {
        JSONObject json = new JSONObject();
        json.put("type", PushTypeEnum.signin.name());
        json.put("miPushUrl", String.format("%s.ui.goldtask.GoldTaskActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
        // 版本推送
        if (versions != null && versions.trim().length() > 0) {
            json.put("app_version", versions);
        }
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // 小米推送网页
        info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
        info.setActivty(String.format("%s.ui.goldtask.GoldTaskActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
        PushRecord pushRecord = new PushRecord();
        // 小米 全推
        if (uid == null || uid == 0) {
            try {
                PushUtils.allPushXiaoMi(info, json, pushRecord);
            } catch (Exception e) {
                PushLogHelper.xmError(e);
            }
        } else {
            info.setAlias(uid + "");
            PushUtils.singlePushXiaoMi(info, json, pushRecord);
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/push/BasePushService.java
@@ -68,4 +68,15 @@
     * @throws PushException
     */
    void pushWelfareCenter(Long uid, String title, String content, String versions) throws PushException;
    /**
     * 推送用户签到
     *
     * @param uid
     * @param title
     * @param content
     * @param versions
     * @throws PushException
     */
    void pushUserSignInNotification(Long uid, String title, String content, String versions) throws PushException;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/push/HWPushService.java
@@ -2,8 +2,6 @@
import java.util.List;
import com.yeshi.fanli.entity.bus.user.AccountMessage;
import com.yeshi.fanli.entity.system.SystemZnx;
import com.yeshi.fanli.exception.PushException;
/**
@@ -46,7 +44,7 @@
     * @param content
     * @throws PushException
     */
    void pushZNX(Long uId, String title,String content, List<Integer> versionCodeList) throws PushException;
    void pushZNX(Long uId, String title, String content, List<Integer> versionCodeList) throws PushException;
    /**
     * 适用版本 1.4.8及以后 推送weex页面
@@ -82,4 +80,15 @@
     */
    void pushWelfareCenter(Long uid, String title, String content, List<Integer> versionCodeList) throws PushException;
    /**
     * 推送签到提醒
     *
     * @param uid
     * @param title
     * @param content
     * @param versions
     * @throws PushException
     */
    void pushUserSignInNotification(Long uid, String title, String content,  List<Integer> versionCodeList) throws PushException;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/push/PushService.java
@@ -7,6 +7,7 @@
public interface PushService {
    /**
     * 推送商品
     *
     * @param uid
     * @param url
     * @param title
@@ -15,11 +16,12 @@
     * @param listAndroid
     * @throws PushException
     */
    void pushGoods(Long uid, String title, String content, String url, List<String> listIOS,
            List<String> listAndroid) throws PushException;
    void pushGoods(Long uid, String title, String content, String url, List<String> listIOS, List<String> listAndroid)
            throws PushException;
    /**
     * 推送链接
     *
     * @param uid
     * @param url
     * @param title
@@ -28,11 +30,12 @@
     * @param listAndroid
     * @throws PushException
     */
    void pushUrl(Long uid, String title, String content, String url, List<String> listIOS,
            List<String> listAndroid) throws PushException;
    void pushUrl(Long uid, String title, String content, String url, List<String> listIOS, List<String> listAndroid)
            throws PushException;
    /**
     * 推送站内信
     *
     * @param uId
     * @param title
     * @param content
@@ -40,11 +43,12 @@
     * @param listAndroid
     * @throws PushException
     */
    void pushZNX(Long uId, String title, String content, List<String> listIOS,
            List<String> listAndroid) throws PushException;
    void pushZNX(Long uId, String title, String content, List<String> listIOS, List<String> listAndroid)
            throws PushException;
    /**
     * 适用版本 1.4.8及以后 推送weex页面
     *
     * @param uid
     * @param title
     * @param content
@@ -58,6 +62,7 @@
    /**
     * 适用版本 1.4.8及以后 推送百川网页
     *
     * @param uid
     * @param title
     * @param content
@@ -71,6 +76,7 @@
    /**
     * 推送福利中心
     *
     * @param uid
     * @param title
     * @param content
@@ -78,6 +84,19 @@
     * @param listAndroid
     * @throws PushException
     */
    void pushWelfareCenter(Long uid, String title, String content,List<String> listIOS,
    void pushWelfareCenter(Long uid, String title, String content, List<String> listIOS, List<String> listAndroid)
            throws PushException;
    /**
     * 推送签到通知
     *
     * @param uid
     * @param title
     * @param content
     * @param listIOS
     * @param listAndroid
     * @throws PushException
     */
    void pushUserSignInNotification(Long uid, String title, String content, List<String> listIOS,
            List<String> listAndroid) throws PushException;
}
fanli/src/main/java/com/yeshi/fanli/util/factory/IOSPushFactory.java
@@ -2,7 +2,7 @@
import java.io.UnsupportedEncodingException;
import com.yeshi.fanli.controller.admin.PushController;
import com.yeshi.fanli.dto.push.PushTypeEnum;
import com.yeshi.fanli.util.StringUtil;
import net.sf.json.JSONObject;
@@ -59,7 +59,7 @@
        alert.put("badge", "1");
        alert.put("sound", "default");
        alert.put("url", "http://id=" + auctionId);
        alert.put("type", PushController.GOODS);
        alert.put("type",PushTypeEnum.goodsdetail.getCode());
        JSONObject aps = new JSONObject();
        aps.put("alert", alert);
@@ -82,7 +82,7 @@
        alert.put("body", body);
        alert.put("badge", "1");
        alert.put("sound", "default");
        alert.put("type", PushController.ZNX);
        alert.put("type", PushTypeEnum.ZNX.getCode());
        JSONObject aps = new JSONObject();
        aps.put("alert", alert);
        //aps.put("badge", 1);
@@ -106,7 +106,7 @@
        alert.put("body", body);
        alert.put("badge", "1");
        alert.put("sound", "default");
        alert.put("type", PushController.URL);
        alert.put("type",PushTypeEnum.url.getCode());
        alert.put("url", shortUrl);
        JSONObject aps = new JSONObject();
@@ -131,7 +131,7 @@
        alert.put("body", body);
        alert.put("badge", "1");
        alert.put("sound", "default");
        alert.put("type", PushController.WEEX);
        alert.put("type", PushTypeEnum.weex.getCode());
        alert.put("url", shortUrl);
        JSONObject aps = new JSONObject();
@@ -156,7 +156,7 @@
        alert.put("body", body);
        alert.put("badge", "1");
        alert.put("sound", "default");
        alert.put("type", PushController.BAICHUAN);
        alert.put("type", PushTypeEnum.baichuan.getCode());
        alert.put("url", shortUrl);
        JSONObject aps = new JSONObject();
@@ -179,7 +179,7 @@
        alert.put("body", body);
        alert.put("badge", "1");
        alert.put("sound", "default");
        alert.put("type", PushController.WELFARE_CENTER);
        alert.put("type", PushTypeEnum.welfare.getCode());
        JSONObject aps = new JSONObject();
        aps.put("alert", alert);
@@ -189,4 +189,27 @@
        return filterPushContent(json);
    }
    /**
     * 用户签到
     * @param title
     * @param body
     * @return
     */
    public static JSONObject createUserSignInPush( String title, String body) {
        JSONObject alert = new JSONObject();
        alert.put("title", title);
        alert.put("body", body);
        alert.put("badge", "1");
        alert.put("sound", "default");
        alert.put("type", PushTypeEnum.signin.getCode());
        JSONObject aps = new JSONObject();
        aps.put("alert", alert);
        //aps.put("badge", 1);
        JSONObject json = new JSONObject();
        json.put("aps", aps);
        return filterPushContent(json);
    }
}
fanli/src/main/java/com/yeshi/fanli/util/factory/UserMoneyDetailFactory.java
@@ -15,6 +15,7 @@
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.account.UserUtil;
public class UserMoneyDetailFactory {
@@ -62,8 +63,8 @@
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createShare(Long uid,int orderType, int validCount, int weiQuanCount, int invalidCount,
            BigDecimal money, Date time) throws UserMoneyDetailException {
    public static UserMoneyDetail createShare(Long uid, int orderType, int validCount, int weiQuanCount,
            int invalidCount, BigDecimal money, Date time) throws UserMoneyDetailException {
        if (money == null)
            throw new UserMoneyDetailException(1, "返利金额为空");
@@ -104,8 +105,8 @@
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createInvite(Long uid,int orderType, int validCount, int weiQuanCount, int invalidCount,
            BigDecimal money, Date time) throws UserMoneyDetailException {
    public static UserMoneyDetail createInvite(Long uid, int orderType, int validCount, int weiQuanCount,
            int invalidCount, BigDecimal money, Date time) throws UserMoneyDetailException {
        if (money == null)
            throw new UserMoneyDetailException(1, "返利金额为空");
@@ -208,7 +209,7 @@
        detail.setSubTitle("订单维权");
        detail.setType(UserMoneyDetailTypeEnum.shareWeiQuan);
        detail.setSourceIdentifyId(drawBack.getId());
        detail.setDescInfo("订单号:" + drawBack.getOrderId());
        detail.setDescInfo("订单号:" + UserUtil.filterOrderId(drawBack.getOrderId()));
        detail.setUpdateTime(new Date());
        detail.setUserInfo(new UserInfo(uid));
        detail.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
@@ -248,7 +249,7 @@
        detail.setSubTitle("订单维权");
        detail.setType(UserMoneyDetailTypeEnum.inviteWeiQuan);
        detail.setSourceIdentifyId(drawBack.getId());
        detail.setDescInfo("订单号:" + drawBack.getOrderId());
        detail.setDescInfo("订单号:" + UserUtil.filterOrderId(drawBack.getOrderId()));
        detail.setUpdateTime(new Date());
        detail.setUserInfo(new UserInfo(uid));
        detail.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
@@ -422,7 +423,7 @@
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createOrderReward(String orderId,int orderType, BigDecimal money, UserInfo user)
    public static UserMoneyDetail createOrderReward(String orderId, int orderType, BigDecimal money, UserInfo user)
            throws UserMoneyDetailException {
        if (StringUtil.isNullOrEmpty(orderId))
            throw new UserMoneyDetailException(1, "订单号不能为空");
@@ -453,7 +454,7 @@
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createRepeatStatistic(String orderId,int orderType,  BigDecimal money, UserInfo user)
    public static UserMoneyDetail createRepeatStatistic(String orderId, int orderType, BigDecimal money, UserInfo user)
            throws UserMoneyDetailException {
        if (StringUtil.isNullOrEmpty(orderId))
            throw new UserMoneyDetailException(1, "订单号不能为空");
@@ -497,10 +498,8 @@
        }
        return detail;
    }
    public static UserMoneyDetail createScoreConvert(BigDecimal money, UserInfo user)
            throws UserMoneyDetailException {
    public static UserMoneyDetail createScoreConvert(BigDecimal money, UserInfo user) throws UserMoneyDetailException {
        if (user == null)
            throw new UserMoneyDetailException(1, "UID不能为空");
        if (money == null)
@@ -515,7 +514,7 @@
        detail.setType(UserMoneyDetailTypeEnum.scoreConvert);
        detail.setUpdateTime(new Date());
        detail.setUserInfo(user);
        return detail;
    }
fanli/src/main/java/com/yeshi/fanli/util/push/HWPushUtil.java
@@ -214,6 +214,23 @@
            e.printStackTrace();
        }
    }
    public static void pushUserSignInNotification(List<String> deviceTokens, String title, String content) throws PushException {
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.goldtask.GoldTaskActivity";
        String intent = getIntent("signin", activity, null, null, null);
        if (intent == null)
            return;
        try {
            String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
            net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
            if (!"success".equalsIgnoreCase(data.optString("msg")))
                throw new PushException(2, result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    /**
     * 推送设备消息
fanli/src/main/java/com/yeshi/fanli/util/push/IOSPushUtil.java
@@ -12,6 +12,7 @@
import com.google.gson.Gson;
import com.yeshi.fanli.controller.admin.PushController;
import com.yeshi.fanli.dto.push.PushTypeEnum;
import com.yeshi.fanli.entity.xinge.MessageInfo;
import com.yeshi.fanli.entity.xinge.PushRecord;
import com.yeshi.fanli.log.LogHelper;
@@ -70,7 +71,7 @@
        // json自定义传值
        JSONObject json = null;
        if (type == PushController.GOODS) {
        if (type == PushTypeEnum.goodsdetail.getCode()) {
            Long auctionId = null;
            if (url.contains("id=")) {
                String[] sts = url.split("\\?")[1].split("&");
@@ -83,26 +84,29 @@
            if (auctionId == null)
                throw new Exception("淘宝商品ID提取出错");
            json = IOSPushFactory.createGoodsPush(auctionId, info.getTitle(), info.getContent());
        } else if (type == PushController.URL) {
        } else if (type == PushTypeEnum.url.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                throw new Exception("获取短链出错");
            json = IOSPushFactory.createURLPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushController.ZNX) {
        } else if (type == PushTypeEnum.ZNX.getCode()) {
            json = IOSPushFactory.createZNXPush(info.getTitle(), info.getContent());
        } else if (type == PushController.WEEX) {
        } else if (type == PushTypeEnum.weex.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                throw new Exception("获取短链出错");
            json = IOSPushFactory.createWEEXPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushController.BAICHUAN) {
        } else if (type == PushTypeEnum.baichuan.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                throw new Exception("获取短链出错");
            json = IOSPushFactory.createBaiChuanPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushController.WELFARE_CENTER) {
        } else if (type == PushTypeEnum.welfare.getCode()) {
            json = IOSPushFactory.createWelfarePush(info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.signin.getCode()) {
            json = IOSPushFactory.createUserSignInPush(info.getTitle(), info.getContent());
        }
        // 分组推送 每50个设备为一组
        InputStream certificate = IOSPushUtil.class.getClassLoader()
@@ -241,7 +245,7 @@
        // json自定义传值
        JSONObject json = null;
        if (type == PushController.GOODS) {
        if (type == PushTypeEnum.goodsdetail.getCode()) {
            Long auctionId = null;
            if (url.contains("id=")) {
                String[] sts = url.split("\\?")[1].split("&");
@@ -254,23 +258,25 @@
            if (auctionId == null)
                throw new Exception("淘宝商品ID提取出错");
            json = IOSPushFactory.createGoodsPush(auctionId, info.getTitle(), info.getContent());
        } else if (type == PushController.URL) {
        } else if (type == PushTypeEnum.url.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                throw new Exception("获取短链出错");
            json = IOSPushFactory.createURLPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushController.ZNX) {
        } else if (type == PushTypeEnum.ZNX.getCode()) {
            json = IOSPushFactory.createZNXPush(info.getTitle(), info.getContent());
        } else if (type == PushController.WEEX) {
        } else if (type == PushTypeEnum.weex.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                shortUrl = url;
            json = IOSPushFactory.createWEEXPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushController.BAICHUAN) {
        } else if (type == PushTypeEnum.baichuan.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                shortUrl = url;
            json = IOSPushFactory.createBaiChuanPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.signin.getCode()) {
            json = IOSPushFactory.createUserSignInPush(info.getTitle(), info.getContent());
        }
        return json;
fanli/src/test/java/org/fanli/TaoKeTest.java
@@ -4,7 +4,9 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -20,6 +22,8 @@
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoLink;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
import com.yeshi.fanli.exception.taobao.TaoKeApiException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
@@ -44,7 +48,7 @@
    @Test
    public void test1() {
         TaoKeApiUtil.taoKeContent();
    }
    @Test
@@ -58,24 +62,19 @@
    @Test
    public void test3() {
        // try {
        // EmergencyUtil.baoJin("monitor-error-tb-app-limit-24980167",
        // "淘宝APPKey请求限制【24980167】", new String[] { "18581318252" });
        // } catch (Exception e1) {
        //
        // }
        // 0K6TBHS%2F84vpYy%2FzKPWwH6J7%2BkHL3AEW
        // 2PlyMHAEtzjJX3K6R73L5KJ7%2BkHL3AEW
        Long[] auctionIds = new Long[] { 528561708277L, 563689377074L, 570752677800L, 569281626446L, 567165767332L,
                555437572417L, 534857332052L, 565233575889L, 565536124572L };
        Long auctionId = 598165623087L;
        String appKey = "27821872";
        String appSecret = "9277b7c40b753e142303eeabc1936c80";
        String pid = "mm_491980152_690500060_109327900051";
        TaoKeAppInfo app=new TaoKeAppInfo(appKey, appSecret, pid);
        // TaoKeApiUtil.getLiJinXG();
        // String
        // url="https://uland.taobao.com/taolijin/edetail?eh=aIrBfHZGd4iZuQF0XRz0iAXoB+DaBK5LQS0Flu/fbSp4QsdWMikAalrisGmre1Id0BFAqRODu114yl7QZ1qFyc7LbOC0oAuo+MUwzxYlSKECGml30RY8PBx5jSVkulpmRQIlrKaDNziGVmobyGguP+jgTFwOoHsRe9593cvcC9QGQASttHIRqdGO5qxVOPQ2buEoHk5wx6hxhsv5QYr1rbcOQrCzclRfPTIk7Z0myMWxZvcNeMU+E+L71lQF+6uZp7DLcYmoygrjfjYOW9fVleIg09jheaZgonv6QcvcARY=&union_lens=lensId:0b0b4505_0c2a_16af789993f_0880;traffic_flag=lm";
        // String token=
        // TaoKeApiUtil.getTKToken("https://img.alicdn.com/imgextra/i4/2256112408/O1CN01EKNifJ1TeuF9x4it9_!!2256112408.jpg_400x400.jpg",
        // "旗睿电风扇台式家用12寸16寸静音学生宿舍摇头定时节能台扇落地扇", url);
        // System.out.println(token);
        try {
            TaoKeApiUtil.createTaoLiJin(auctionId, "淘礼金", new BigDecimal(1), 1, new Date(),
                    new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 12L), new Date(),
                    new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 12L), app);
        } catch (TaoKeApiException e) {
            e.printStackTrace();
        }
    }
    @Test