| | |
| | | import com.yeshi.fanli.service.inter.push.DeviceActiveService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenOPPOService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenVIVOService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
|
| | | import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService;
|
| | |
| | |
|
| | | @Resource
|
| | | private DeviceTokenOPPOService deviceTokenOPPOService;
|
| | | |
| | | @Resource
|
| | | private DeviceTokenVIVOService deviceTokenVIVOService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService;
|
| | |
| | | platformType = 2;
|
| | | }
|
| | | userSystemCouponService.copyLotteryPrize(uuser.getId(), platformType, acceptData.getDevice());
|
| | | // 绑定oppo推送
|
| | | // 绑定oppo,vivo推送
|
| | | DeviceActive active = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
|
| | | if (active != null) {
|
| | | deviceTokenOPPOService.bindUid(uuser.getId(), active.getId());
|
| | | deviceTokenVIVOService.bindUid(uuser.getId(), active.getId());
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | |
| | | if (deviceActive != null) {
|
| | | // 解绑OPPO推送的用户绑定
|
| | | deviceTokenOPPOService.unBindUid(uid, deviceActive.getId());
|
| | | // 解绑VIVO推送的用户绑定
|
| | | deviceTokenVIVOService.unBindUid(uid, deviceActive.getId());
|
| | | }
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | |
| | | DeviceActive active = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
|
| | | if (active != null) {
|
| | | deviceTokenOPPOService.bindUid(uuser.getId(), active.getId());
|
| | | deviceTokenVIVOService.bindUid(uuser.getId(), active.getId());
|
| | | }
|
| | | }
|
| | | });
|
| | |
| | | import com.yeshi.fanli.service.inter.push.DeviceActiveService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenOPPOService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenVIVOService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
|
| | | import com.yeshi.fanli.service.inter.user.BindRemindService;
|
| | |
| | | private DeviceTokenOPPOService deviceTokenOPPOService;
|
| | |
|
| | | @Resource
|
| | | private DeviceTokenVIVOService deviceTokenVIVOService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService;
|
| | |
|
| | | @Resource
|
| | |
| | |
|
| | | @Resource
|
| | | private DeviceActiveService deviceActiveService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private BindRemindService bindRemindService;
|
| | |
|
| | |
|
| | |
|
| | | /**
|
| | | * 新版登录 V1.5.3
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "login", method = RequestMethod.POST)
|
| | | public void login(AcceptData acceptData, int loginType, String vcode, String phone, String code, |
| | | public void login(AcceptData acceptData, int loginType, String vcode, String phone, String code,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | | try {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | // 绑定oppo推送
|
| | |
|
| | | // 绑定oppo,VIVO推送
|
| | | DeviceActive active = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
|
| | | if (active != null) {
|
| | | deviceTokenOPPOService.bindUid(uuser.getId(), active.getId());
|
| | | deviceTokenVIVOService.bindUid(uuser.getId(), active.getId());
|
| | | }
|
| | | }
|
| | | });
|
| | |
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("登录失败"));
|
| | | try {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 绑定电话号码 V2.0.1 微信登录
|
| | | *
|
| | |
| | | */
|
| | | @RequestSerializableByKey(key = "'bindPhoneLogin-'+#phone")
|
| | | @RequestMapping(value = "bindPhoneLogin")
|
| | | public void bindPhoneLogin(AcceptData acceptData,String vcode, String phone, String key, HttpServletRequest request, PrintWriter out) {
|
| | | public void bindPhoneLogin(AcceptData acceptData, String vcode, String phone, String key,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | |
| | | out.print(JsonUtil.loadFalseResult("key值不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | phone = phone.replaceAll(" ", "");
|
| | |
|
| | | String oldVCode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_BIND);
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "绑定失败"));
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 绑定电话号码 V2.0.1 微信登录
|
| | | *
|
| | |
| | | bindRemindService.addBindPhone(uid);
|
| | | out.print(JsonUtil.loadTrueResult("记录成功"));
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
| | | * @param count |
| | | * @return |
| | | */ |
| | | List<HongBaoV2> listCanBalanceHongBaoByTypeAndUid(@Param("types") List<Integer> type, @Param("uid") Long uid,@Param("start") long start, |
| | | @Param("count") int count); |
| | | |
| | | 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 countByParentUidAndTypeAndState(@Param("uid") Long uid, @Param("typeList") List<Integer> typeList, |
| | | @Param("stateList") List<Integer> stateList); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据订单来源类型与交易ID列表查询订单信息 |
| | | * |
| | | * @param sourceType |
| | | * @param tradeId |
| | | * @return |
| | | */ |
| | | List<HongBaoV2> listBySourceTypeAndTradeIdListAndUid(@Param("sourceType") int sourceType, @Param("uid")long uid, @Param("tradeIdList") List<String> tradeIdList); |
| | | List<HongBaoV2> listBySourceTypeAndTradeIdListAndUid(@Param("sourceType") int sourceType, @Param("uid") long uid, |
| | | @Param("tradeIdList") List<String> tradeIdList); |
| | | |
| | | /** |
| | | * 根据状态,类型,用户ID检索 |
| | | * @param stateList |
| | | * @param typeList |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<HongBaoV2> listByStateAndTypeAndUid(@Param("stateList") List<Integer> stateList, |
| | | @Param("typeList") List<Integer> typeList, @Param("uid") Long uid,@Param("start") long start,@Param("count")int count); |
| | | |
| | | } |
| | |
| | | */ |
| | | List<ThreeSale> getSuccessByDate(@Param("bossId")Long bossId,@Param("minTime")Long minTime, @Param("maxTime")Long maxTime); |
| | | |
| | | /** |
| | | * 查询最近的信息(根据下级ID与状态) |
| | | * @param workerId |
| | | * @param state |
| | | * @return |
| | | */ |
| | | ThreeSale selectLatestByWorkerIdAndState(@Param("workerId") Long workerId,@Param("state") int state); |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | public static int EXPIRE_NORMAL = 0;// 正常状态
|
| | | public static int EXPIRE_OUTOFDATE = 1;// 过期状态
|
| | |
|
| | | public static int STATE_SUCCESS = 1;// 成功
|
| | | public static int STATE_NOT_SUCCESS = 0;// 尚未成功
|
| | |
|
| | | @Id
|
| | | @GeneratedValue(strategy = GenerationType.AUTO)
|
| | |
| | | public ThreeSale(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | | |
| | |
|
| | | public ThreeSale() {
|
| | | }
|
| | |
|
| | |
|
| | | @Column(name = "boss_id")
|
| | | private UserInfo boss;// 邀请者
|
| | |
|
| | |
|
| | | @Column(name = "worker_id")
|
| | | private UserInfo worker; // 被邀请者
|
| | |
| | | private BigDecimal couponPrice;// 优惠券金额
|
| | | @Field
|
| | | private String couponConditions;// 优惠券使用条件
|
| | | @Deprecated
|
| | | @Field
|
| | | private String couponId;// 券ID
|
| | | @Field
|
| | |
| | | } catch (IOException e1) {
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | public static void vivoError(Throwable e) {
|
| | | String date = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy_MM_dd");
|
| | | String os = System.getProperty("os.name");
|
| | | String filePath = String.format("/usr/local/tomcat8/logs/push/vivo_error_detail_%s.txt", date);
|
| | | if (os.toLowerCase().startsWith("win")) {
|
| | | filePath = String.format("C:/logs/push/vivo_error_detail_%s.txt", date);
|
| | | }
|
| | |
|
| | | try {
|
| | | saveErrorLog(e, filePath);
|
| | | } catch (IOException e1) {
|
| | | }
|
| | | }
|
| | |
|
| | | public static void saveErrorLog(Throwable e, String filePath) throws IOException {
|
| | | // 创建文件夹
|
| | |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | <select id="selectLatestByWorkerIdAndState" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_threeSale s where worker_id = #{workerId} and state=#{state} |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_threeSale where id = #{id,jdbcType=BIGINT} |
| | |
| | | b
|
| | | ON a.hb_id=b.hbId OR a.hb_pid=b.hbId WHERE b.hbId >0
|
| | | </select>
|
| | |
|
| | |
|
| | | |
| | | <select id="listByStateAndTypeAndUid" resultMap="BaseResultMap">
|
| | | |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v where v.hb_uid=#{uid}
|
| | | <if test="stateList!=null">
|
| | | <foreach collection="stateList" open=" and (" item="state" separator=" or " close=")">
|
| | | hb_state=#{state}
|
| | | </foreach>
|
| | | </if>
|
| | | |
| | | <if test="typeList!=null">
|
| | | <foreach collection="typeList" open=" and (" item="type" separator=" or " close=")">
|
| | | hb_type=#{type}
|
| | | </foreach>
|
| | | </if>
|
| | | order by hb_create_time asc,hb_id asc
|
| | | limit #{start},#{count}
|
| | | </select>
|
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
| | | yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT}
|
| | | </delete>
|
| | |
| | | return hongBaoOrderMapper.selectByCommonOrderId(commonOrderId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public HongBaoOrder selectDetailByHongBaoId(Long hongBaoId) {
|
| | | return hongBaoOrderMapper.selectByHongBaoId(hongBaoId);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | private void updateHongBao(HongBaoOrder hongBaoOrder, CommonOrder commonOrder, int type,
|
| | | Map<Integer, HongBaoOrder> notificationMap) throws HongBaoException {
|
| | | System.out.println(commonOrder.getOrderNo());
|
| | | //锁行
|
| | | // 锁行
|
| | | HongBaoV2 oldHongBao = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hongBaoOrder.getHongBaoV2().getId());
|
| | | if (oldHongBao == null)
|
| | | throw new HongBaoException(10, "红包对象不存在");
|
| | |
| | | child.setUrank(boss.getRank());
|
| | | child.setVersion(2);
|
| | | child.setCreateTime(new Date());
|
| | | hongBaoV2Mapper.insertSelective(child);
|
| | | // 添加通知
|
| | | if (notificationMap.get(HongBaoV2.TYPE_SHARE_YIJI) == null) {
|
| | | HongBaoV2 tempHongBao = new HongBaoV2(child.getId());
|
| | | tempHongBao.setUserInfo(child.getUserInfo());
|
| | | tempHongBao.setMoney(child.getMoney());
|
| | | tempHongBao.setBeizhu(hongBao.getUserInfo().getNickName());
|
| | | CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
|
| | | tempCommonOrder.setPayment(commonOrder.getPayment());
|
| | | notificationMap.put(HongBaoV2.TYPE_SHARE_YIJI, new HongBaoOrder(tempCommonOrder, tempHongBao));
|
| | | } else {
|
| | | // 增加付款金额与资金
|
| | | HongBaoOrder tempHongBaoOrder = notificationMap.get(HongBaoV2.TYPE_SHARE_YIJI);
|
| | | tempHongBaoOrder.getCommonOrder().setPayment(
|
| | | tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
|
| | | tempHongBaoOrder.getHongBaoV2()
|
| | | .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(child.getMoney()));
|
| | | notificationMap.put(HongBaoV2.TYPE_SHARE_YIJI, tempHongBaoOrder);
|
| | | if (child.getMoney().compareTo(new BigDecimal(0)) > 0) {
|
| | | hongBaoV2Mapper.insertSelective(child);
|
| | | // 添加通知
|
| | | if (notificationMap.get(HongBaoV2.TYPE_SHARE_YIJI) == null) {
|
| | | HongBaoV2 tempHongBao = new HongBaoV2(child.getId());
|
| | | tempHongBao.setUserInfo(child.getUserInfo());
|
| | | tempHongBao.setMoney(child.getMoney());
|
| | | tempHongBao.setBeizhu(hongBao.getUserInfo().getNickName());
|
| | | CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
|
| | | tempCommonOrder.setPayment(commonOrder.getPayment());
|
| | | notificationMap.put(HongBaoV2.TYPE_SHARE_YIJI,
|
| | | new HongBaoOrder(tempCommonOrder, tempHongBao));
|
| | | } else {
|
| | | // 增加付款金额与资金
|
| | | HongBaoOrder tempHongBaoOrder = notificationMap.get(HongBaoV2.TYPE_SHARE_YIJI);
|
| | | tempHongBaoOrder.getCommonOrder().setPayment(
|
| | | tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
|
| | | tempHongBaoOrder.getHongBaoV2()
|
| | | .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(child.getMoney()));
|
| | | notificationMap.put(HongBaoV2.TYPE_SHARE_YIJI, tempHongBaoOrder);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | return null;
|
| | | return hongBaoV2Mapper.listBySourceTypeAndTradeIdListAndUid(sourceType, uid, tradeIdList);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public HongBaoV2 getFirstValidHongBaoByTypeAndUid(List<Integer> typeList, Long uid) {
|
| | | List<Integer> stateList = new ArrayList<>();
|
| | | stateList.add(HongBaoV2.STATE_BUKELINGQU);
|
| | | stateList.add(HongBaoV2.STATE_KELINGQU);
|
| | | stateList.add(HongBaoV2.STATE_YILINGQU);
|
| | | List<HongBaoV2> hongBaoV2List = hongBaoV2Mapper.listByStateAndTypeAndUid(stateList, typeList, uid, 0, 1);
|
| | | if (hongBaoV2List != null && hongBaoV2List.size() > 0)
|
| | | return hongBaoV2List.get(0);
|
| | | return null;
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.AppVersionInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserCustomSettings;
|
| | | import com.yeshi.fanli.entity.bus.user.UserCustomSettings.UserSettingTypeEnum;
|
| | | import com.yeshi.fanli.entity.push.DeviceTokenHW;
|
| | | import com.yeshi.fanli.entity.push.DeviceTokenOPPO;
|
| | | import com.yeshi.fanli.exception.push.PushException;
|
| | | import com.yeshi.fanli.log.PushLogHelper;
|
| | |
| | | import com.yeshi.fanli.service.inter.push.OPPOPushService;
|
| | | import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.push.HWPushUtil;
|
| | | import com.yeshi.fanli.util.push.OPPOPushUtil;
|
| | |
|
| | | @Service
|
| | |
| | | private List<Integer> getVersionCodeList(List<Integer> versionCodeList) {
|
| | | List<Integer> versionList = new ArrayList<>();
|
| | | if (versionCodeList == null) {// 全推
|
| | | List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 49);
|
| | | List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 51);
|
| | | if (appInfoList != null)
|
| | | for (AppVersionInfo version : appInfoList) {
|
| | | versionList.add(version.getVersionCode());
|
| | |
| | |
|
| | | } else {// 按版本推送
|
| | | for (Integer versionCode : versionCodeList) {
|
| | | if (versionCode.intValue() >= 49) {// 2.0.1开始支持
|
| | | if (versionCode.intValue() >= 51) {// 2.0.1开始支持
|
| | | versionList.add(versionCode);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | 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.service.inter.push.OPPOPushService;
|
| | | import com.yeshi.fanli.service.inter.push.PushRecordService;
|
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.service.inter.push.VIVOPushService;
|
| | | import com.yeshi.fanli.service.inter.push.XMPushService;
|
| | | import com.yeshi.fanli.service.inter.user.SystemZnxService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | |
|
| | | @Resource
|
| | | private OPPOPushService oPPOPushService;
|
| | |
|
| | | @Resource
|
| | | private VIVOPushService vIVOPushService;
|
| | |
|
| | | @Resource
|
| | | private PushRecordMapper pushRecordMapper;
|
| | |
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | oPPOPushService.pushGoods(uid, Long.parseLong(gid), title, content, versionCodeList);
|
| | | }
|
| | | // VIVO推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | vIVOPushService.pushGoods(uid, Long.parseLong(gid), title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | oPPOPushService.pushUrl(uid, url, title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | // VIVO推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | vIVOPushService.pushUrl(uid, url, title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | oPPOPushService.pushZNX(uId, title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | // VIVO推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | vIVOPushService.pushZNX(uId, title, content, versionCodeList);
|
| | | }
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | |
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | oPPOPushService.pushWEEX(uid, title, content, weexUrl, versionCodeList);
|
| | | }
|
| | |
|
| | | // VIVO推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | vIVOPushService.pushWEEX(uid, title, content, weexUrl, versionCodeList);
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | |
| | | oPPOPushService.pushBaiChuanUrl(uid, title, content, url, versionCodeList);
|
| | | }
|
| | |
|
| | | // VIVO推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | vIVOPushService.pushBaiChuanUrl(uid, title, content, url, versionCodeList);
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setUrl(url);
|
| | |
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | oPPOPushService.pushWelfareCenter(uid, title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | // VIVO推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | vIVOPushService.pushWelfareCenter(uid, title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | |
| | | oPPOPushService.pushUserSignInNotification(uid, title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | // VIVO推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | vIVOPushService.pushUserSignInNotification(uid, title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setTitle(title);
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.push;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.HashSet;
|
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | 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;
|
| | | import com.yeshi.fanli.entity.push.DeviceTokenVIVO;
|
| | | import com.yeshi.fanli.exception.push.PushException;
|
| | | import com.yeshi.fanli.log.PushLogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.AppVersionService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenVIVOService;
|
| | | import com.yeshi.fanli.service.inter.push.VIVOPushService;
|
| | | import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.push.VIVOPushUtil;
|
| | |
|
| | | @Service
|
| | | public class VIVOPushServiceImpl implements VIVOPushService {
|
| | |
|
| | | @Resource
|
| | | private DeviceTokenVIVOService deviceTokenVIVOService;
|
| | |
|
| | | @Resource
|
| | | private AppVersionService appVersionService;
|
| | |
|
| | | @Resource
|
| | | private UserCustomSettingsService userCustomSettingsService;
|
| | |
|
| | | private List<Integer> getVersionCodeList(List<Integer> versionCodeList) {
|
| | | List<Integer> versionList = new ArrayList<>();
|
| | | if (versionCodeList == null) {// 全推
|
| | | List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 51);
|
| | | if (appInfoList != null)
|
| | | for (AppVersionInfo version : appInfoList) {
|
| | | versionList.add(version.getVersionCode());
|
| | | }
|
| | |
|
| | | } else {// 按版本推送
|
| | | for (Integer versionCode : versionCodeList) {
|
| | | if (versionCode.intValue() >= 51) {// 2.0.1开始支持
|
| | | versionList.add(versionCode);
|
| | | }
|
| | | }
|
| | | }
|
| | | return versionList;
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushGoods(Long uid, Long auctionId, String title, String content, List<Integer> versionCodeList)
|
| | | throws PushException {
|
| | | 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(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(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(PushTypeEnum.weex, uid, title, content, weexUrl, null, null, versionCodeList);
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<Integer> versionCodeList)
|
| | | throws PushException {
|
| | |
|
| | | 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(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<DeviceTokenVIVO> filterDeviceToken(List<DeviceTokenVIVO> deviceList, int hour) {
|
| | | // 处理消息免打扰
|
| | | if (hour >= 20 || hour < 8) {
|
| | | Set<Long> uidSets = new HashSet<>();
|
| | | for (DeviceTokenVIVO dt : deviceList)
|
| | | if (dt.getUid() != null)
|
| | | uidSets.add(dt.getUid());
|
| | | List<Long> uidList = new ArrayList<>();
|
| | | uidList.addAll(uidSets);
|
| | | List<UserCustomSettings> settingList = userCustomSettingsService.listByUidListAndTypeAndState(uidList,
|
| | | UserSettingTypeEnum.cancelNotice.name(), UserCustomSettings.STATE_VALID);
|
| | | uidSets.clear();
|
| | | if (settingList != null) {
|
| | | for (UserCustomSettings seeting : settingList)
|
| | | uidSets.add(seeting.getUserInfo().getId());
|
| | | }
|
| | | if (uidSets.size() > 0)
|
| | | for (int i = 0; i < deviceList.size(); i++) {
|
| | | if (deviceList.get(i).getUid() != null && uidSets.contains(deviceList.get(i).getUid())) {
|
| | | deviceList.remove(i--);
|
| | | }
|
| | | }
|
| | | }
|
| | | return deviceList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 推送
|
| | | * |
| | | * @param type
|
| | | * @param uid
|
| | | * @param title
|
| | | * @param content
|
| | | * @param url
|
| | | * @param webUrl
|
| | | * @param versionCodeList
|
| | | */
|
| | | 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);
|
| | | // 2.0.1后开始推送
|
| | | for (int i = 0; i < newVersionList.size(); i++) {
|
| | | if (newVersionList.get(i) < 51)
|
| | | newVersionList.remove(i--);
|
| | | }
|
| | |
|
| | | if (uid == null || uid == 0) {
|
| | | int pageSize = 200;
|
| | | long deviceCount = deviceTokenVIVOService.countDeviceToken(newVersionList);
|
| | | int page = (int) (deviceCount % pageSize == 0 ? deviceCount / pageSize : deviceCount / pageSize + 1);
|
| | | for (int p = 1; p <= page; p++) {
|
| | | List<DeviceTokenVIVO> deviceList = deviceTokenVIVOService.listDeviceToken(p, pageSize, newVersionList);
|
| | | deviceList = filterDeviceToken(deviceList, hour);
|
| | |
|
| | | List<String> tokenList = new ArrayList<>();
|
| | | for (DeviceTokenVIVO token : deviceList)
|
| | | tokenList.add(token.getRegisterId());
|
| | | try {
|
| | | if (type == PushTypeEnum.goodsdetail) {// 商品详情
|
| | | if (goodsId == null)
|
| | | throw new PushException(2, "参数不完整");
|
| | | VIVOPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
|
| | | } else if (type == PushTypeEnum.url) {// 链接
|
| | | if (StringUtil.isNullOrEmpty(webUrl))
|
| | | throw new PushException(2, "参数不完整");
|
| | | VIVOPushUtil.pushUrl(tokenList, title, content, webUrl);
|
| | | } else if (type == PushTypeEnum.ZNX) {// 站内信
|
| | | VIVOPushUtil.pushZNX(tokenList, title, content);
|
| | | } else if (type == PushTypeEnum.weex) {// weex
|
| | | if (StringUtil.isNullOrEmpty(url))
|
| | | throw new PushException(2, "参数不完整");
|
| | | VIVOPushUtil.pushWEEX(tokenList, title, content, url);
|
| | | } else if (type == PushTypeEnum.baichuan) {// 百川链接
|
| | | if (StringUtil.isNullOrEmpty(webUrl))
|
| | | throw new PushException(2, "参数不完整");
|
| | | VIVOPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
|
| | | } else if (type == PushTypeEnum.welfare) {// 福利中心
|
| | | VIVOPushUtil.pushWelfareCenter(tokenList, title, content);
|
| | | } else if (type == PushTypeEnum.signin) {// 签到
|
| | | VIVOPushUtil.pushUserSignInNotification(tokenList, title, content);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | PushLogHelper.hwError(e);
|
| | | }
|
| | |
|
| | | }
|
| | | } else {
|
| | | // 单推
|
| | | List<DeviceTokenVIVO> deviceList = deviceTokenVIVOService.listByUid(uid, newVersionList);
|
| | | List<String> tokenList = new ArrayList<>();
|
| | | if (deviceList != null) {
|
| | | deviceList = filterDeviceToken(deviceList, hour);
|
| | | for (DeviceTokenVIVO token : deviceList)
|
| | | tokenList.add(token.getRegisterId());
|
| | | }
|
| | | if (tokenList.size() == 0)
|
| | | return;
|
| | |
|
| | | try {
|
| | | if (type == PushTypeEnum.goodsdetail) {// 商品详情
|
| | | if (goodsId == null)
|
| | | throw new PushException(2, "参数不完整");
|
| | | VIVOPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
|
| | | } else if (type == PushTypeEnum.url) {// 链接
|
| | | if (StringUtil.isNullOrEmpty(webUrl))
|
| | | throw new PushException(2, "参数不完整");
|
| | | VIVOPushUtil.pushUrl(tokenList, title, content, webUrl);
|
| | | } else if (type == PushTypeEnum.ZNX) {// 站内信
|
| | | VIVOPushUtil.pushZNX(tokenList, title, content);
|
| | | } else if (type == PushTypeEnum.weex) {// weex
|
| | | if (StringUtil.isNullOrEmpty(url))
|
| | | throw new PushException(2, "参数不完整");
|
| | | VIVOPushUtil.pushWEEX(tokenList, title, content, url);
|
| | | } else if (type == PushTypeEnum.baichuan) {// 百川链接
|
| | | if (StringUtil.isNullOrEmpty(webUrl))
|
| | | throw new PushException(2, "参数不完整");
|
| | | VIVOPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
|
| | | } else if (type == PushTypeEnum.welfare) {// 福利中心
|
| | | VIVOPushUtil.pushWelfareCenter(tokenList, title, content);
|
| | | } else if (type == PushTypeEnum.signin) {// 签到
|
| | | VIVOPushUtil.pushUserSignInNotification(tokenList, title, content);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | PushLogHelper.vivoError(e);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | @Override
|
| | | @Transactional
|
| | | public UserTaoLiJinOrigin addNewbiesWinMoney(Long uid) throws UserTaoLiJinOriginException{
|
| | | if(1>0)
|
| | | throw new UserTaoLiJinOriginException(1, "接口已下线");
|
| | | if (uid == null) {
|
| | | throw new UserTaoLiJinOriginException(1, "参数不能为空");
|
| | | }
|
| | |
| | | throw new UserTaoLiJinOriginException(1, "参数不能为空");
|
| | | }
|
| | |
|
| | | if(1>0)
|
| | | throw new UserTaoLiJinOriginException(1, "接口已下线");
|
| | | |
| | | String key = "";
|
| | | if (userRank.getId() == 2) {
|
| | | key = "hongbao_rank_silver";
|
| | |
| | | throw new UserTaoLiJinOriginException(1, "参数不能为空");
|
| | | }
|
| | |
|
| | | if(1>0)
|
| | | throw new UserTaoLiJinOriginException(1, "接口已下线");
|
| | | |
| | | String value = configTaoLiJinService.getValueByKey("hongbao_invite",null);
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|
| | | throw new UserTaoLiJinOriginException(1, "系统红包不存在");
|
| | |
| | | throw new UserTaoLiJinOriginException(1, "用户未登录");
|
| | | }
|
| | |
|
| | | if(1>0)
|
| | | throw new UserTaoLiJinOriginException(1, "接口已下线");
|
| | | |
| | | String value = configTaoLiJinService.getValueByKey("hongbao_share",null);
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|
| | | throw new UserTaoLiJinOriginException(1, "系统红包不存在");
|
| | |
| | | @Resource
|
| | | private ThreeSaleExtraInfoSerivce threeSaleExtraInfoSerivce;
|
| | |
|
| | | |
| | | @Lazy
|
| | | @Resource
|
| | | private IntegralGetService integralGetService;
|
| | |
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | |
| | |
|
| | | // 邀请金币
|
| | | integralGetService.addInviteLevelOne(boss.getId(), invitee.getId());
|
| | | }
|
| | |
| | | return threeSaleMapper.listSecondTeam(start, count, uid, state);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ThreeSale selectLatestByWorkerIdAndState(Long workerId, int state) {
|
| | |
|
| | | return threeSaleMapper.selectLatestByWorkerIdAndState(workerId, state);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public HongBaoOrder selectDetailByCommonOrderId(Long commonOrderId);
|
| | | |
| | | |
| | | /**
|
| | | * 获取详情
|
| | | * @param hongBaoId
|
| | | * @return
|
| | | */
|
| | | public HongBaoOrder selectDetailByHongBaoId(Long hongBaoId);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public List<HongBaoV2> listBySourceTypeAndTradeIdListAndUid(int sourceType, long uid, List<String> tradeIdList);
|
| | |
|
| | | /**
|
| | | * 获取首次有效的红包(根据类型与用户ID)
|
| | | * |
| | | * @param typeList
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public HongBaoV2 getFirstValidHongBaoByTypeAndUid(List<Integer> typeList, Long uid);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.push;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.exception.push.PushException;
|
| | |
|
| | | /**
|
| | | * 华为推送服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface VIVOPushService {
|
| | |
|
| | | /**
|
| | | * 推送商品
|
| | | * |
| | | * @param uid
|
| | | * @param url
|
| | | * @param title
|
| | | * @param content
|
| | | * @throws PushException
|
| | | */
|
| | | void pushGoods(Long uid, Long auctionId, String title, String content, List<Integer> versionCodeList)
|
| | | throws PushException;
|
| | |
|
| | | /**
|
| | | * 推送链接
|
| | | * |
| | | * @param uid
|
| | | * @param url
|
| | | * @param title
|
| | | * @param content
|
| | | * @throws PushException
|
| | | */
|
| | | void pushUrl(Long uid, String url, String title, String content, List<Integer> versionCodeList)
|
| | | throws PushException;
|
| | |
|
| | | /**
|
| | | * 推送站内信
|
| | | * |
| | | * @param uId
|
| | | * @param title
|
| | | * @param content
|
| | | * @throws PushException
|
| | | */
|
| | | void pushZNX(Long uId, String title, String content, List<Integer> versionCodeList) throws PushException;
|
| | |
|
| | | /**
|
| | | * 适用版本 1.4.8及以后 推送weex页面
|
| | | * |
| | | * @param uid
|
| | | * @param title
|
| | | * @param content
|
| | | * @param weexUrl
|
| | | * @throws PushException
|
| | | */
|
| | | void pushWEEX(Long uid, String title, String content, String weexUrl, List<Integer> versionCodeList)
|
| | | throws PushException;
|
| | |
|
| | | /**
|
| | | * 适用版本 1.4.8及以后 推送百川网页
|
| | | * |
| | | * @param uid
|
| | | * @param title
|
| | | * @param content
|
| | | * @param url
|
| | | * @throws PushException
|
| | | */
|
| | | void pushBaiChuanUrl(Long uid, String title, String content, String url, List<Integer> versionCodeList)
|
| | | throws PushException;
|
| | |
|
| | | /**
|
| | | * 推送福利中心(版本号:1.5.1后)
|
| | | * |
| | | * @param uid
|
| | | * @param title
|
| | | * @param content
|
| | | * @throws PushException
|
| | | */
|
| | | 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;
|
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public ThreeSale selectByWorkerId(Long workerId);
|
| | | |
| | | |
| | | /**
|
| | | * 查询最近一条数据(根据下级用户ID与状态)
|
| | | * @param workerId
|
| | | * @param state
|
| | | * @return
|
| | | */
|
| | | public ThreeSale selectLatestByWorkerIdAndState(Long workerId,int state);
|
| | |
|
| | | /**
|
| | | * 时间段呢 邀请成功信息
|
| | |
| | | package com.yeshi.fanli.util;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | |
| | | if (hongBaoV2 != null && hongBaoV2.getState() == HongBaoV2.STATE_YILINGQU
|
| | | && hongBaoV2.getMoney().compareTo(new BigDecimal(0)) > 0) {
|
| | | if (hongBaoV2.getType() == HongBaoV2.TYPE_ZIGOU) {// 自购
|
| | | integralGetService.addRebateOrder(hongBaoV2.getUserInfo().getId());
|
| | | // 判断是否为该用户的首笔红包
|
| | | List<Integer> typeList = new ArrayList<>();
|
| | | typeList.add(HongBaoV2.TYPE_ZIGOU);
|
| | | HongBaoV2 firstHongBao = hongBaoV2Service.getFirstValidHongBaoByTypeAndUid(
|
| | | typeList, hongBaoV2.getUserInfo().getId());
|
| | | if (firstHongBao != null
|
| | | && firstHongBao.getId().longValue() == hongBaoV2.getId()) {// 自购首单到账
|
| | | // 查询下级红包
|
| | | BigDecimal firstLevelMoney = new BigDecimal(0);
|
| | | BigDecimal secondLevelMoney = new BigDecimal(0);
|
| | | // 获取改单下面的红包
|
| | | List<HongBaoV2> hongBaoList = new ArrayList<>();
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderService
|
| | | .selectDetailByHongBaoId(hongBaoV2.getId());
|
| | | if (hongBaoOrder != null && hongBaoOrder.getCommonOrder() != null) {// 计算改订单号下面的所有返利金额
|
| | | CommonOrder commonOrder = hongBaoOrder.getCommonOrder();
|
| | | List<CommonOrder> list = commonOrderService.listBySourceTypeAndOrderId(
|
| | | commonOrder.getSourceType(), commonOrder.getOrderNo());
|
| | | for (CommonOrder co : list) {
|
| | | HongBaoOrder hbo = hongBaoOrderService
|
| | | .selectDetailByCommonOrderId(co.getId());
|
| | | if (hbo != null && hbo.getHongBaoV2() != null)
|
| | | hongBaoList.add(hbo.getHongBaoV2());
|
| | | }
|
| | | }
|
| | |
|
| | | for (HongBaoV2 hb : hongBaoList) {
|
| | | List<HongBaoV2> children = hongBaoV2Service
|
| | | .listChildrenById(hb.getId());
|
| | | if (children != null)
|
| | | for (HongBaoV2 child : children)
|
| | | if (child.getType() == HongBaoV2.TYPE_YIJI) {
|
| | | firstLevelMoney = firstLevelMoney.add(child.getMoney());
|
| | | } else if (child.getType() == HongBaoV2.TYPE_ERJI) {
|
| | | secondLevelMoney = secondLevelMoney.add(child.getMoney());
|
| | | }
|
| | | }
|
| | |
|
| | | // 查询下级的生效时间
|
| | | ThreeSale threeSale = threeSaleSerivce.selectLatestByWorkerIdAndState(
|
| | | hongBaoV2.getUserInfo().getId(), ThreeSale.STATE_SUCCESS);
|
| | | if (threeSale != null && threeSale.getSucceedTime() != null && threeSale
|
| | | .getSucceedTime() < hongBaoV2.getCreateTime().getTime()) {// 邀请成功的时间是否在下单的时间之前
|
| | | // 成功时间要大于20190910日才开始送金币
|
| | | if (threeSale.getSucceedTime() > TimeUtil.convertToTimeTemp("20190901",
|
| | | "yyyyMMdd")) {
|
| | | if (firstLevelMoney.compareTo(new BigDecimal("0.01")) < 0) {// 一级返利小于0.01
|
| | | // integralTaskRecordService.firstRebateOrderRewardBoss(threeSale.getBoss().getId(),
|
| | | // hongBaoV2.getUserInfo().getId(), null);
|
| | | LogHelper.test("自购-一级用户-" + threeSale.getBoss().getId()
|
| | | + "-hongBaoId:" + hongBaoV2.getId());
|
| | | }
|
| | | }
|
| | | }
|
| | | // 查询下下级生效时间
|
| | | if (threeSale != null) {
|
| | | threeSale = threeSaleSerivce.selectLatestByWorkerIdAndState(
|
| | | threeSale.getBoss().getId(), ThreeSale.STATE_SUCCESS);
|
| | | if (threeSale != null && threeSale.getSucceedTime() != null && threeSale
|
| | | .getSucceedTime() < hongBaoV2.getCreateTime().getTime()) {// 邀请成功的时间是否在下单的时间之前
|
| | | // 成功时间要大于20190910日才开始送金币
|
| | | if (threeSale.getSucceedTime() > TimeUtil
|
| | | .convertToTimeTemp("20190901", "yyyyMMdd")) {
|
| | | if (secondLevelMoney.compareTo(new BigDecimal("0.01")) < 0) {// 二级返利小于0.01
|
| | | // integralTaskRecordService.firstRebateOrderRewardBossSuper(threeSale.getBoss().getId(),
|
| | | // hongBaoV2.getUserInfo().getId(), null);
|
| | | LogHelper.test("自购-二级用户-" + threeSale.getBoss().getId()
|
| | | + "-hongBaoId:" + hongBaoV2.getId());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_GOODS) {// 分享赚
|
| | | integralGetService.addShareOrder(hongBaoV2.getUserInfo().getId());
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_YIJI
|
| | | || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_YIJI) {// 一级邀请赚
|
| | | integralGetService.addInviteOrderLevelOne(hongBaoV2.getUserInfo().getId());
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_ERJI
|
| | | || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_ERJI) {// 二级邀请赚
|
| | | integralGetService.addInviteOrderLevelOne(hongBaoV2.getUserInfo().getId());
|
| | | // 判断是否为该用户的首笔红包
|
| | | List<Integer> typeList = new ArrayList<>();
|
| | | typeList.add(HongBaoV2.TYPE_SHARE_GOODS);
|
| | | HongBaoV2 firstHongBao = hongBaoV2Service.getFirstValidHongBaoByTypeAndUid(
|
| | | typeList, hongBaoV2.getUserInfo().getId());
|
| | | if (firstHongBao != null
|
| | | && firstHongBao.getId().longValue() == hongBaoV2.getId()) // 分享首笔到账
|
| | | {
|
| | |
|
| | | // 查询下级红包
|
| | | BigDecimal firstLevelMoney = new BigDecimal(0);
|
| | | // 获取改单下面的红包
|
| | | List<HongBaoV2> hongBaoList = new ArrayList<>();
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderService
|
| | | .selectDetailByHongBaoId(hongBaoV2.getId());
|
| | | if (hongBaoOrder != null && hongBaoOrder.getCommonOrder() != null) {// 计算改订单号下面的所有返利金额
|
| | | CommonOrder commonOrder = hongBaoOrder.getCommonOrder();
|
| | | List<CommonOrder> list = commonOrderService.listBySourceTypeAndOrderId(
|
| | | commonOrder.getSourceType(), commonOrder.getOrderNo());
|
| | | for (CommonOrder co : list) {
|
| | | HongBaoOrder hbo = hongBaoOrderService
|
| | | .selectDetailByCommonOrderId(co.getId());
|
| | | if (hbo != null && hbo.getHongBaoV2() != null)
|
| | | hongBaoList.add(hbo.getHongBaoV2());
|
| | | }
|
| | | }
|
| | |
|
| | | for (HongBaoV2 hb : hongBaoList) {
|
| | | List<HongBaoV2> children = hongBaoV2Service
|
| | | .listChildrenById(hb.getId());
|
| | | if (children != null)
|
| | | for (HongBaoV2 child : children)
|
| | | if (child.getType() == HongBaoV2.TYPE_SHARE_YIJI) {
|
| | | firstLevelMoney = firstLevelMoney.add(child.getMoney());
|
| | | }
|
| | | }
|
| | |
|
| | | ThreeSale threeSale = threeSaleSerivce.selectLatestByWorkerIdAndState(
|
| | | hongBaoV2.getUserInfo().getId(), ThreeSale.STATE_SUCCESS);
|
| | | if (threeSale != null && threeSale.getSucceedTime() != null && threeSale
|
| | | .getSucceedTime() < hongBaoV2.getCreateTime().getTime()) {// 邀请成功的时间是否在下单的时间之前
|
| | | // 成功时间要大于20190910日才开始送金币
|
| | | if (threeSale.getSucceedTime() > TimeUtil.convertToTimeTemp("20190901",
|
| | | "yyyyMMdd")) {
|
| | | if (firstLevelMoney.compareTo(new BigDecimal("0.01")) < 0) {// 一级返利小于0.01
|
| | | // integralTaskRecordService.firstSharerOrderRewardBoss(threeSale.getBoss().getId(),
|
| | | // hongBaoV2.getUserInfo().getId(), null);
|
| | | LogHelper.test("分享-一级用户-" + threeSale.getBoss().getId()
|
| | | + "-hongBaoId:" + hongBaoV2.getId());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | HongBaoRecieveCMQManager.getInstance()
|
| | | .deleteQueueMsg(HongBaoRecieveCMQManager.QUEUE_INTEGRAL, key);
|
| | | // HongBaoRecieveCMQManager.getInstance()
|
| | | // .deleteQueueMsg(HongBaoRecieveCMQManager.QUEUE_INTEGRAL,
|
| | | // key);
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | TaoKeAppInfo app = getRandomApp();
|
| | | DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
|
| | | Map<String, String> params = new TreeMap<>();
|
| | | params.put("version", "v1.0.0");
|
| | | params.put("version", "v1.1.0");
|
| | | params.put("appKey", app.getAppKey());
|
| | | params.put("pageSize", 200 + "");
|
| | | // params.put("sort", "1");
|
| | |
| | | TaoKeAppInfo app = getRandomApp();
|
| | | DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
|
| | | Map<String, String> params = new TreeMap<>();
|
| | | params.put("version", "v1.0.0");
|
| | | params.put("version", "v1.0.1");
|
| | | params.put("appKey", app.getAppKey());
|
| | | params.put("pageSize", 200 + "");
|
| | | if (!StringUtil.isNullOrEmpty(startTime))
|
| | |
| | | TaoKeAppInfo app = getRandomApp();
|
| | | DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
|
| | | Map<String, String> params = new TreeMap<>();
|
| | | params.put("version", "v1.0.0");
|
| | | params.put("version", "v1.1.0");
|
| | | params.put("appKey", app.getAppKey());
|
| | | params.put("pageSize", 200 + "");
|
| | | if (!StringUtil.isNullOrEmpty(startTime))
|
| | |
| | | TaoKeAppInfo app = getRandomApp();
|
| | | DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
|
| | | Map<String, String> params = new TreeMap<>();
|
| | | params.put("version", "v1.0.0");
|
| | | params.put("version", "v1.1.0");
|
| | | params.put("appKey", app.getAppKey());
|
| | | params.put("pageSize", 200 + "");
|
| | | if (!StringUtil.isNullOrEmpty(startTime))
|
| | |
| | | public static DaTaoKeDetailV2 getGoodsDetail(Long id) {
|
| | | TaoKeAppInfo app = getRandomApp();
|
| | | Map<String, String> params = new TreeMap<>();
|
| | | params.put("version", "v1.0.0");
|
| | | params.put("version", "v1.1.0");
|
| | | params.put("appKey", app.getAppKey());
|
| | | params.put("id", id + "");
|
| | | params.put("sign", getSign(params, app.getAppSecret()));
|
| | |
| | | TaoKeAppInfo app = getRandomApp();
|
| | | DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
|
| | | Map<String, String> params = new TreeMap<>();
|
| | | params.put("version", "v1.0.0");
|
| | | params.put("version", "v2.1.0");
|
| | | params.put("appKey", app.getAppKey());
|
| | | params.put("pageSize", pageSize + "");
|
| | | params.put("pageId", page + "");
|
| | |
| | | TaoKeAppInfo app = getRandomApp();
|
| | | DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
|
| | | Map<String, String> params = new TreeMap<>();
|
| | | params.put("version", "v1.0.0");
|
| | | params.put("version", "v1.1.0");
|
| | | params.put("appKey", app.getAppKey());
|
| | | params.put("rankType", type + "");
|
| | | if (cid != null)
|
| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | | import java.util.UUID;
|
| | |
|
| | | import com.vivo.push.sdk.notofication.Message;
|
| | | import com.vivo.push.sdk.notofication.Result;
|
| | |
| | | private static Message.Builder getBaseMessageBuidler(String title, String content,
|
| | | Map<String, String> customParams) {
|
| | | Message.Builder buidler = new Message.Builder();
|
| | | buidler = buidler.title(title).content(content).skipType(4).skipContent("").notifyType(3);
|
| | |
|
| | | buidler = buidler.title(title).content(content).skipType(4).skipContent("todo").notifyType(3)
|
| | | .requestId(UUID.randomUUID().toString());
|
| | | buidler = buidler.clientCustomMap(customParams);
|
| | | return buidler;
|
| | | }
|
| | |
| | | Sender sender = new Sender(APP_SECRET);
|
| | | sender.initPool(20, 10);// 设置连接池参数,可选项
|
| | | sender.setAuthToken(authToken);// 设置推送的必要参数authToken(调用鉴权方法获得)
|
| | | Message saveList = builder.build();// 构建要保存的批量推送消息体
|
| | | Result result = sender.saveListPayLoad(saveList);// 发送保存群推消息请求
|
| | | String taskId = result.getTaskId();
|
| | |
|
| | | Set<String> regIds = new HashSet<>();// 构建批量推送用户群
|
| | | for (String regId : regIdList)
|
| | | regIds.add(regId);
|
| | | TargetMessage targetMessage = new TargetMessage.Builder().regIds(regIds).taskId(taskId).build();// 构建批量推送的消息体
|
| | | result = sender.sendToList(targetMessage);// 批量推送给用户
|
| | | Message saveList = builder.timeToLive(3600).build();// 构建要保存的批量推送消息体
|
| | | Result result = null;
|
| | | if (regIdList.size() > 1) {
|
| | | result = sender.saveListPayLoad(saveList);// 发送保存群推消息请求
|
| | | String taskId = result.getTaskId();
|
| | | Set<String> regIds = new HashSet<>();// 构建批量推送用户群
|
| | | for (String regId : regIdList)
|
| | | regIds.add(regId);
|
| | | TargetMessage targetMessage = new TargetMessage.Builder().requestId(UUID.randomUUID().toString())
|
| | | .regIds(regIds).taskId(taskId).build();// 构建批量推送的消息体
|
| | | result = sender.sendToList(targetMessage);// 批量推送给用户
|
| | | } else
|
| | | {
|
| | | result = sender.sendSingle(builder.regId(regIdList.get(0)).timeToLive(3600).build());
|
| | | }
|
| | | if (result.getResult() == 0)// 成功
|
| | | {
|
| | | return true;
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return false;
|
| | | }
|