| | |
| | | return ResultUtil.error("请先开启定位", ""); |
| | | } |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(addAppUserVo.getLon(), addAppUserVo.getLat()); |
| | | Integer num = 0; |
| | | Integer activityId = null; |
| | | if (null != geocode) { |
| | | String province = geocode.get("province"); |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String city = geocode.get("city"); |
| | | String cityCode = geocode.get("cityCode"); |
| | | // 根据所在市code 查询是否有介绍有礼活动 |
| | | IntroduceRewards res = introduceRewardsClient.getGiftList(cityCode); |
| | | List<IntroduceRewards> res = introduceRewardsClient.getGiftList(cityCode); |
| | | if (res != null) { |
| | | num = res.getGiveClass(); |
| | | activityId = res.getId(); |
| | | if (ToolUtil.isNotEmpty(addAppUserVo.getInvitePhone())) { |
| | | List<TAppUser> tAppUsers = this.baseMapper.selectList(new LambdaQueryWrapper<TAppUser>() |
| | | .eq(TAppUser::getPhone, addAppUserVo.getInvitePhone())); |
| | | if (tAppUsers.size() > 0) { |
| | | addAppUserVo.setReferralUserId(tAppUsers.get(0).getId()); |
| | | for (IntroduceRewards re : res) { |
| | | Integer num = re.getGiveClass(); |
| | | Integer activityId = re.getId(); |
| | | if (ToolUtil.isNotEmpty(addAppUserVo.getInvitePhone())) { |
| | | List<TAppUser> tAppUsers = this.baseMapper.selectList(new LambdaQueryWrapper<TAppUser>() |
| | | .eq(TAppUser::getPhone, addAppUserVo.getInvitePhone())); |
| | | if (tAppUsers.size() > 0) { |
| | | addAppUserVo.setReferralUserId(tAppUsers.get(0).getId()); |
| | | } |
| | | } |
| | | } |
| | | if (num != 0) { |
| | | TAppGift tAppGift = new TAppGift(); |
| | | TAppUser phone = appUserService.getOne(new QueryWrapper<TAppUser>() |
| | | .eq("phone", addAppUserVo.getInvitePhone())); |
| | | if (phone == null) { |
| | | return ResultUtil.error("推荐人手机号未注册玩湃会员!"); |
| | | } else { |
| | | tAppGift.setUserName(phone.getName()); |
| | | tAppGift.setUserPhone(phone.getPhone()); |
| | | if (num != 0) { |
| | | TAppGift tAppGift = new TAppGift(); |
| | | TAppUser phone = appUserService.getOne(new QueryWrapper<TAppUser>() |
| | | .eq("phone", addAppUserVo.getInvitePhone())); |
| | | if (phone == null) { |
| | | return ResultUtil.error("推荐人手机号未注册玩湃会员!"); |
| | | } else { |
| | | tAppGift.setUserName(phone.getName()); |
| | | tAppGift.setUserPhone(phone.getPhone()); |
| | | } |
| | | tAppGift.setUserId(addAppUserVo.getReferralUserId()); |
| | | tAppGift.setNum(num); |
| | | tAppGift.setShareUserId(tAppUser.getId()); |
| | | tAppGift.setShareUserName(tAppUser.getPhone()); |
| | | tAppGift.setShareUserPhone(tAppUser.getPhone()); |
| | | tAppGift.setActivityId(activityId); |
| | | tAppGift.setInsertTime(new Date()); |
| | | appGiftService.save(tAppGift); |
| | | } |
| | | tAppGift.setUserId(addAppUserVo.getReferralUserId()); |
| | | tAppGift.setNum(num); |
| | | tAppGift.setShareUserId(tAppUser.getId()); |
| | | tAppGift.setShareUserName(tAppUser.getPhone()); |
| | | tAppGift.setShareUserPhone(tAppUser.getPhone()); |
| | | tAppGift.setActivityId(activityId); |
| | | tAppGift.setInsertTime(new Date()); |
| | | appGiftService.save(tAppGift); |
| | | } |
| | | } |
| | | } |
| | |
| | | tAppUser.setGender(loginWechatVo.getSex()); |
| | | tAppUser.setState(1); |
| | | tAppUser.setInsertTime(new Date()); |
| | | tAppUser.setProvince(""); |
| | | tAppUser.setProvinceCode(""); |
| | | tAppUser.setCity(""); |
| | | tAppUser.setCityCode(""); |
| | | this.baseMapper.insert(tAppUser); |
| | | } |
| | | } |
| | |
| | | if (tAppUser.getState() == 2) { |
| | | return ResultUtil.error("您的账号已被冻结"); |
| | | } |
| | | boolean newUser = false; |
| | | List<TAppUser> tAppUsers1 = appUserMapper.selectList(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getPhone, dto.getPhone()).eq(TAppUser::getState, 1)); |
| | | if (tAppUsers1.size() > 0) { |
| | | TAppUser tAppUser1 = tAppUsers1.get(0); |
| | |
| | | appUserMapper.updateById(tAppUser); |
| | | token = getToken(tAppUser); |
| | | map.put("token", token); |
| | | |
| | | newUser = true; |
| | | } |
| | | |
| | | // tAppUser.setPhone(dto.getPhone()); |
| | | |
| | | if (ToolUtil.isNotEmpty(dto.getInvitePhone())) { |
| | | if (newUser && ToolUtil.isNotEmpty(dto.getInvitePhone())) { |
| | | if (ToolUtil.isEmpty(dto.getLat()) || ToolUtil.isEmpty(dto.getLon())) { |
| | | return ResultUtil.error("请先开启定位"); |
| | | } |
| | | TAppUser tAppUser1 = appUserMapper.selectOne(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getPhone, dto.getInvitePhone()).eq(TAppUser::getState, 1)); |
| | | if (tAppUser1 != null) { |
| | | Map<String, String> geocode = null; |
| | | try { |
| | | geocode = gdMapGeocodingUtil.geocode(dto.getLon(), dto.getLat()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Integer num = 0; |
| | | if (null != geocode) { |
| | | String province = geocode.get("province"); |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String city = geocode.get("city"); |
| | | String cityCode = geocode.get("cityCode"); |
| | | IntroduceRewards giftList = introduceRewardsClient.getGiftList(cityCode); |
| | | num = giftList.getGiveClass(); |
| | | } |
| | | Integer userId = null; |
| | | if (ToolUtil.isNotEmpty(dto.getInvitePhone())) { |
| | | List<TAppUser> tAppUsers = this.baseMapper.selectList(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getPhone, dto.getInvitePhone())); |
| | | if (tAppUsers.size() > 0) { |
| | | userId = tAppUsers.get(0).getId(); |
| | | } |
| | | } |
| | | if (userId != null) { |
| | | TAppGift one = appGiftService.getOne(new LambdaQueryWrapper<TAppGift>().eq(TAppGift::getUserId, userId)); |
| | | if (one != null) { |
| | | one.setNum(one.getNum() + num); |
| | | appGiftService.updateById(one); |
| | | } else { |
| | | TAppGift tAppGift = new TAppGift(); |
| | | tAppGift.setUserId(userId); |
| | | tAppGift.setNum(num); |
| | | appGiftService.save(tAppGift); |
| | | TAppUser tAppUser1 = appUserMapper.selectOne(new LambdaQueryWrapper<TAppUser>() |
| | | .eq(TAppUser::getPhone, dto.getInvitePhone()).eq(TAppUser::getState, 1)); |
| | | if(null == tAppUser1){ |
| | | return ResultUtil.error("邀请人还未注册账号"); |
| | | } |
| | | Map<String, String> geocode = null; |
| | | try { |
| | | geocode = gdMapGeocodingUtil.geocode(dto.getLon(), dto.getLat()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (null != geocode) { |
| | | String cityCode = geocode.get("cityCode"); |
| | | // 根据所在市code 查询是否有介绍有礼活动 |
| | | List<IntroduceRewards> res = introduceRewardsClient.getGiftList(cityCode); |
| | | if (res != null) { |
| | | for (IntroduceRewards re : res) { |
| | | Integer num = re.getGiveClass(); |
| | | Integer activityId = re.getId(); |
| | | if (num != 0) { |
| | | TAppGift tAppGift = new TAppGift(); |
| | | tAppGift.setUserName(tAppUser1.getName()); |
| | | tAppGift.setUserPhone(tAppUser1.getPhone()); |
| | | tAppGift.setUserId(tAppUser1.getId()); |
| | | tAppGift.setNum(num); |
| | | tAppGift.setShareUserId(tAppUser.getId()); |
| | | tAppGift.setShareUserName(tAppUser.getPhone()); |
| | | tAppGift.setShareUserPhone(tAppUser.getPhone()); |
| | | tAppGift.setActivityId(activityId); |
| | | tAppGift.setInsertTime(new Date()); |
| | | appGiftService.save(tAppGift); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // appUserMapper.updateById(tAppUser); |
| | | |
| | | return ResultUtil.success(map); |
| | | } |
| | | |
| | |
| | | return ResultUtil.success(returnId); |
| | | } |
| | | //积分+现金 |
| | | if(coupon.getRedemptionMethod() == 1){ |
| | | if(coupon.getRedemptionMethod() == 2){ |
| | | userCouponPaymentClient.addUserCouponPayment(userCouponPayment); |
| | | try { |
| | | if(exchangeType.getPayType() == 1){ |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private String smid = "2088330203191220";//平台支付宝商户号 |
| | | public ResultUtil aliPaymentCoupon(String body, UserCouponPayment userCouponPayment) throws Exception { |
| | | String code = userCouponPayment.getCode(); |
| | | Double cash = userCouponPayment.getCash(); |
| | | |
| | | ResultUtil alipay = payMoneyUtil.alipay(body, body, "", code, cash.toString(), "/base/coupon/aliPaymentCouponCallback"); |
| | | ResultUtil alipay = payMoneyUtil.alipay(smid, body, "",String.valueOf(userCouponPayment.getId()), code, cash.toString(), "/base/coupon/aliPaymentCouponCallback"); |
| | | if (alipay.getCode() == 200) { |
| | | new Thread(new Runnable() { |
| | | @Override |
| | |
| | | //有待支付的订单,这里不处理 |
| | | userCouponPayment1.setStatus(-1); |
| | | userCouponPaymentClient.updateUserCouponPayment(userCouponPayment1); |
| | | if ("TRADE_FINISHED".equals(s)) { |
| | | // todo 资金结算 |
| | | |
| | | } |
| | | break; |
| | | } |
| | | if ("TRADE_SUCCESS".equals(s)) { |
| | |
| | | userCouponPayment1.setPaymentTime(new Date()); |
| | | userCouponPayment1.setOrderNumber(tradeNo); |
| | | userCouponPaymentClient.updateUserCouponPayment(userCouponPayment1); |
| | | |
| | | UserCoupon userCoupon = new UserCoupon(); |
| | | userCoupon.setCouponId(userCouponPayment1.getCouponId()); |
| | | userCoupon.setUserId(userCouponPayment1.getUserId()); |
| | | userCoupon.setStatus(1); |
| | | userCoupon.setInsertTime(new Date()); |
| | | userConponClient.insertToAppuserCoupon(userCoupon); |
| | | |
| | | if(null != userCouponPayment1.getIntegral() && 0 != userCouponPayment1.getIntegral()){ |
| | | //扣积分 |
| | | TAppUser user = appUserService.getById(userCouponPayment1.getUserId()); |
| | | user.setIntegral(user.getIntegral() - userCouponPayment1.getIntegral().intValue()); |
| | | appUserService.updateById(user); |
| | | } |
| | | payMoneyUtil.confirm(smid,code,tradeNo,cash.toString()); |
| | | break; |
| | | |
| | | } |
| | | |
| | | if ("WAIT_BUYER_PAY".equals(s)) { |
| | | num++; |
| | | } |
| | |
| | | } |
| | | |
| | | private ResultUtil AlipayPayment(BigDecimal cash, String code, Long returnId) { |
| | | ResultUtil alipay = payMoneyUtil.alipay("优惠卷", "优惠卷", String.valueOf(returnId), code, cash.toString(), |
| | | ResultUtil alipay = payMoneyUtil.alipay(smid,"优惠卷", "优惠卷", String.valueOf(returnId), code, cash.toString(), |
| | | "/base/pointMer/exchangeGoodPaymentAliCallback"); |
| | | if (alipay.getCode() == 200) { |
| | | new Thread(new Runnable() { |
| | |
| | | moneyOut(tradeNo, tradeNo); |
| | | break; |
| | | } |
| | | if ("TRADE_FINISHED".equals(tradeStatus)) { |
| | | // todo 资金结算 |
| | | payMoneyUtil.confirm(smid,code,tradeNo,cash.toString()); |
| | | break; |
| | | } |
| | | // if("REFUND".equals(tradeStatus) || "NOTPAY".equals(tradeStatus) || "CLOSED".equals(tradeStatus) || "REVOKED".equals(tradeStatus) || "PAYERROR".equals(tradeStatus) || num == 10){ |
| | | // mcClient.deletePaymentRecord(code); |
| | | // break; |