Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
| | |
| | | @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;
|
| | |
|
| | |
| | | // 红包
|
| | | 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);
|
| | |
| | | // 推广红包
|
| | | 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
|
| | |
| | | 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;
|
| | |
| | | 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>() {
|
| | |
| | | if (todayUse == null || todayUse.compareTo(zero) > 0) {
|
| | | todayUse = zero;
|
| | | }
|
| | | |
| | |
|
| | | BigDecimal yesterdayUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 2);
|
| | | if (yesterdayUse == null || yesterdayUse.compareTo(zero) > 0) {
|
| | | yesterdayUse = zero;
|
| | |
| | | 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());
|
| | |
| | | // 已领取
|
| | | 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;
|
| | |
| | | }
|
| | |
|
| | | 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);
|
| | |
| | | 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;
|
| | |
| | | // 登录用户
|
| | | 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;
|
| | |
| | | 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;
|
| | |
| | | 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 {
|
| | |
| | | }
|
| | | 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 {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal proportion = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
|
| | | for (ShareHotGoods hotGoods : listHot) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = hotGoods.getGoods();
|
| | | if (taoBaoGoodsBrief == null) {
|
| | |
| | | }
|
| | |
|
| | | // 计算推广红包
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value",new Date());
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date());
|
| | | BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, taoBaoGoodsBrief);
|
| | |
|
| | | // 推广红包 不能小于1
|
| | |
| | | array.add(gson.toJson(extra));
|
| | | }
|
| | |
|
| | | /*// 过期 -取消收回
|
| | | * executor.execute(new Runnable() {
|
| | | /*
|
| | | * // 过期 -取消收回 executor.execute(new Runnable() {
|
| | | *
|
| | | * @Override public void run() {
|
| | | * userTaoLiJinOriginService.overdueHongBao(uid); } });
|
| | |
| | | data.put("list", array);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 分享爆款商品-限于淘礼金
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | |
| | | 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);
|
| | |
| | | isNewUser = false;
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
|
| | | BigDecimal shareRate = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
|
| | | for (ShareHotGoods hotGoods : listHot) {
|
| | |
| | | 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);
|
| | |
| | | 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));
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 分享爆款商品-限于淘礼金
|
| | | *
|
| | |
| | | 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));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 分享爆款商品-限于淘礼金
|
| | | *
|
| | |
| | | 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());
|
| | |
| | | vo.setName("付款立减 ");
|
| | | vo.setTip("");
|
| | | vo.setTotal(hotGoods.getTotalHongBaoCount());
|
| | | |
| | |
|
| | | OtherInfo otherInfo = new OtherInfo();
|
| | | otherInfo.setReduceHongBao(vo);
|
| | | detailVO.setOtherInfo(otherInfo);
|
| | | |
| | |
|
| | | array.add(gson.toJson(detailVO));
|
| | | }
|
| | |
|
| | |
| | | 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));
|
| | |
| | | * @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,订单状态和结算时间统计邀请赚的订单数量 |
New file |
| | |
| | | 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;
|
| | | }
|
| | | }
|
| | |
| | | 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 |
| | |
| | | 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);
|
| | |
| | | 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--;
|
| | |
| | | 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);
|
| | |
| | | // 查询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);
|
| | |
| | |
|
| | | 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;
|
| | |
| | | @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")
|
| | |
| | | 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) {
|
| | |
| | | * @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);
|
| | |
| | | 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);
|
| | |
| | | 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);
|
| | |
| | | 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;
|
| | |
| | |
|
| | | @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();
|
| | |
| | |
|
| | | 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 =
|
| | |
| | | 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) {
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | | IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushController.GOODS);
|
| | | IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushTypeEnum.goodsdetail.getCode());
|
| | | } catch (Exception e) {
|
| | | PushLogHelper.iosError(e);
|
| | | }
|
| | |
| | | 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);
|
| | |
| | | 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 {
|
| | |
| | |
|
| | | // TODO 需要全推
|
| | |
|
| | | addPushIOSQueue(info, id + "", PushController.ZNX, versionCodes);
|
| | | addPushIOSQueue(info, id + "", PushTypeEnum.ZNX.getCode(), versionCodes);
|
| | |
|
| | | /*
|
| | | * List<String> deviceTokenList = getDeviceTokenList(1, 1000);
|
| | |
| | |
|
| | | // IOS 单推
|
| | | try {
|
| | | IOSPushUtil.allPushIOS(deviceTokenList, info, "0", PushController.ZNX);
|
| | | IOSPushUtil.allPushIOS(deviceTokenList, info, "0", PushTypeEnum.ZNX.getCode());
|
| | | } catch (Exception e) {
|
| | | PushLogHelper.iosError(e);
|
| | | }
|
| | |
| | | */
|
| | | @Transactional
|
| | | public void addPushIOSQueue(MessageInfo info, String url, int type, String versionCodes) throws PushException {
|
| | | |
| | | if(Constant.IS_TEST)
|
| | |
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | |
|
| | | try {
|
| | |
| | |
|
| | | // 每次执行条目
|
| | | int pushNum = 50;
|
| | | |
| | |
|
| | | for (long i = 0; i < tokenCount + totalCount;) {
|
| | |
|
| | | PushQueueRecord pushQueueRecord = new PushQueueRecord();
|
| | |
| | | pushQueueRecord.setType(1);
|
| | | // 版本号
|
| | | pushQueueRecord.setVersions(versionCodes);
|
| | | |
| | |
|
| | | if (tokenCount - i < totalCount) {
|
| | | // 起始游标
|
| | |
| | | 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);
|
| | |
|
| | | // 每次推送总条数
|
| | |
| | | long recordCursor = startCursor;
|
| | |
|
| | | for (int i = 0; i < count; i++) {
|
| | | |
| | |
|
| | | // 不足50个数据
|
| | | if (moveNum > total) {
|
| | | moveNum = (int) (endCursor - startCursor);
|
| | |
| | |
|
| | | @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<>();
|
| | |
| | | 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);
|
| | | }
|
| | |
| | |
|
| | | @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<>();
|
| | |
| | | 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);
|
| | | }
|
| | |
| | | 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;
|
| | |
| | | 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);
|
| | | }
|
| | |
| | | }
|
| | | 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);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | 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;
|
| | |
| | | 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());
|
| | |
| | | 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());
|
| | |
| | | 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);
|
| | |
| | | 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);
|
| | |
| | | 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);
|
| | |
| | | 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);
|
| | |
| | | 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);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | 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;
|
| | |
| | | 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()));
|
| | |
|
| | |
| | |
|
| | | 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()));
|
| | |
| | | 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()));
|
| | |
| | | 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()));
|
| | |
| | |
|
| | | 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) {
|
| | |
| | |
|
| | | 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);
|
| | |
| | | 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()));
|
| | | // 版本推送
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @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);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | * @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;
|
| | | }
|
| | |
| | |
|
| | | 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;
|
| | |
|
| | | /**
|
| | |
| | | * @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页面
|
| | |
| | | */
|
| | | 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;
|
| | |
|
| | | }
|
| | |
| | | public interface PushService {
|
| | | /**
|
| | | * 推送商品
|
| | | * |
| | | * @param uid
|
| | | * @param url
|
| | | * @param title
|
| | |
| | | * @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
|
| | |
| | | * @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
|
| | |
| | | * @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
|
| | |
| | |
|
| | | /**
|
| | | * 适用版本 1.4.8及以后 推送百川网页
|
| | | * |
| | | * @param uid
|
| | | * @param title
|
| | | * @param content
|
| | |
| | |
|
| | | /**
|
| | | * 推送福利中心
|
| | | * |
| | | * @param uid
|
| | | * @param title
|
| | | * @param content
|
| | |
| | | * @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;
|
| | | }
|
| | |
| | |
|
| | | 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;
|
| | |
| | | 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);
|
| | |
| | | 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);
|
| | |
| | | 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();
|
| | |
| | | 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();
|
| | |
| | | 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();
|
| | |
| | | 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);
|
| | |
| | | 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);
|
| | | }
|
| | | |
| | | }
|
| | |
| | | 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 {
|
| | |
|
| | |
| | | * @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, "返利金额为空");
|
| | |
|
| | |
| | | * @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, "返利金额为空");
|
| | |
|
| | |
| | | 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);
|
| | |
| | | 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);
|
| | |
| | | * @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, "订单号不能为空");
|
| | |
| | | * @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, "订单号不能为空");
|
| | |
| | | }
|
| | | 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)
|
| | |
| | | detail.setType(UserMoneyDetailTypeEnum.scoreConvert);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(user);
|
| | | |
| | |
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | 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();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 推送设备消息
|
| | |
| | |
|
| | | 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;
|
| | |
| | | // 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("&");
|
| | |
| | | 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()
|
| | |
| | |
|
| | | // 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("&");
|
| | |
| | | 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;
|
| | |
| | | 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;
|
| | |
| | | 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;
|
| | |
| | |
|
| | | @Test
|
| | | public void test1() {
|
| | | TaoKeApiUtil.taoKeContent();
|
| | | |
| | | }
|
| | |
|
| | | @Test
|
| | |
| | |
|
| | | @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
|