From 18b58aaf9bd99cadd0e7f80fe5d80586f2f4831a Mon Sep 17 00:00:00 2001 From: nickchange <126672920+nickchange@users.noreply.github.com> Date: 星期五, 24 十一月 2023 18:32:43 +0800 Subject: [PATCH] 11.24 --- cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java | 104 ++++++++++++++++++++++++++++++++-------------------- 1 files changed, 64 insertions(+), 40 deletions(-) diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java index 8e5de5e..25f4833 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java +++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java @@ -285,7 +285,7 @@ .eq("appUserId",tAppUser.getId()) .eq("state",1) .eq("isDefault",1)); - if (tStudents==null){ + if (tStudents.isEmpty()){ tStudents = tsmapper.selectList(new QueryWrapper<TStudent>() .eq("appUserId",tAppUser.getId()) .eq("state",1)) @@ -321,6 +321,7 @@ course.setRemainingNums(ToolUtil.isEmpty(tCoursePackagePayment.getResidueNums())? 0 : tCoursePackagePayment.getResidueNums()); course.setPeriodOfValidity(tCoursePackagePayment.getPeriodOfValidity()); course.setIsAble(tCoursePackagePayment.getIsAble()); + course.setCourseType(tCoursePackagePayment.getCourseType()); courseList.add(course); } } @@ -419,7 +420,9 @@ */ @Override public ResultUtil addAppUser(AddAppUserVo addAppUserVo) throws Exception { - TAppUser tAppUser = this.baseMapper.selectOne(new QueryWrapper<TAppUser>().eq("phone", addAppUserVo.getPhone()).ne("state", 3)); + TAppUser tAppUser = this.baseMapper.selectOne(new QueryWrapper<TAppUser>() + .eq("phone", addAppUserVo.getPhone()) + .ne("state", 3)); if(null != tAppUser){ return ResultUtil.error("账号已存在"); } @@ -435,42 +438,58 @@ tAppUser.setIsVip(0); tAppUser.setState(1); tAppUser.setInsertTime(new Date()); - - - - // 介绍有礼 - if(addAppUserVo.getReferralUserId()!=null || ToolUtil.isNotEmpty(addAppUserVo.getInvitePhone())){ - if(ToolUtil.isEmpty(addAppUserVo.getLat()) || ToolUtil.isEmpty(addAppUserVo.getLon())){ - return ResultUtil.error("请先开启定位", ""); - } - Map<String, String> geocode = gdMapGeocodingUtil.geocode(addAppUserVo.getLon(), addAppUserVo.getLat()); - 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"); - num = introduceRewardsClient.getGiftList(cityCode); - } - 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()); + // 注册用户 + int insert = this.baseMapper.insert(tAppUser); + // 介绍有礼 + if(addAppUserVo.getReferralUserId()!=null || ToolUtil.isNotEmpty(addAppUserVo.getInvitePhone())){ + if(ToolUtil.isEmpty(addAppUserVo.getLat()) || ToolUtil.isEmpty(addAppUserVo.getLon())){ + 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); + 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()); + } + } + 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 one = appGiftService.getOne(new LambdaQueryWrapper<TAppGift>().eq(TAppGift::getUserId, addAppUserVo.getReferralUserId())); - if(one!=null){ - one.setNum(one.getNum()+num); - appGiftService.updateById(one); - }else { - TAppGift tAppGift = new TAppGift(); - tAppGift.setUserId(addAppUserVo.getReferralUserId()); - tAppGift.setNum(num); - appGiftService.save(tAppGift); - } - } - this.baseMapper.insert(tAppUser); + + return ResultUtil.success(); } @@ -700,7 +719,11 @@ IndexOfUserBenefirVo benefirVo = new IndexOfUserBenefirVo(); TAppUser appUser = this.getById(appUserId); - benefirVo.setUserHeadImg(appUser.getHeadImg()); + if (appUser.getHeadImg()!=null) { + benefirVo.setUserHeadImg(appUser.getHeadImg()); + }else { + benefirVo.setUserHeadImg("https://we-park-life.oss-cn-beijing.aliyuncs.com/img/630864764d3c4e98822ff976a2389559.jpg"); + } benefirVo.setUserName(appUser.getName()); benefirVo.setWpCoin(ToolUtil.isEmpty(appUser.getPlayPaiCoins()) ? 0 : appUser.getPlayPaiCoins()); benefirVo.setUserIntegral(ToolUtil.isEmpty(appUser.getIntegral()) ? 0 : appUser.getIntegral()); @@ -849,7 +872,7 @@ if (rechargeRecords.size() > 0) { for (RechargeRecords rechargeRecord : rechargeRecords) { ConsumeDetail consumeDetail = new ConsumeDetail(); - consumeDetail.setConsumeName(RechargeRecordEnum.RECHARGE.getMsg() + ":" + rechargeRecord.getPlayPaiCoins()); + consumeDetail.setConsumeName(RechargeRecordEnum.RECHARGE.getMsg() + ":" + rechargeRecord.getPlayPaiCoins()+"币"); consumeDetail.setConsumeTime(simpleDateFormat.format(rechargeRecord.getInsertTime())); consumeDetail.setConsumeAmount("-" + rechargeRecord.getAmount()); consumeDetail.setType(2); @@ -910,7 +933,7 @@ RechargeCentVo vo = new RechargeCentVo(); Double money = (Double) stringObjectMap.get("money"); vo.setAmount(BigDecimal.valueOf(money) ); - if (tAppUser.getIsVip() == 1){ + if (tAppUser.getIsVip() == 1&&tAppUser.getVipEndTime().after(new Date())){ vo.setWpGold((Integer) stringObjectMap.get("MemberCoins")); }else { vo.setWpGold((Integer) stringObjectMap.get("usersCoins")); @@ -1161,7 +1184,8 @@ String provinceCode = geocode.get("provinceCode"); String city = geocode.get("city"); String cityCode = geocode.get("cityCode"); - num = introduceRewardsClient.getGiftList(cityCode); + IntroduceRewards giftList = introduceRewardsClient.getGiftList(cityCode); + num = giftList.getGiveClass(); } Integer userId=null; if(ToolUtil.isNotEmpty(dto.getInvitePhone())){ @@ -1561,7 +1585,7 @@ UserIntegralChanges userIntegralChanges = new UserIntegralChanges(); userIntegralChanges.setAppUserId(appUserId); userIntegralChanges.setOldIntegral(appUser.getIntegral()); - userIntegralChanges.setType(5); + userIntegralChanges.setType(2); appUser.setIntegral(null == appUser.getIntegral() ? points : appUser.getIntegral() - points); userIntegralChanges.setNewIntegral(appUser.getIntegral()); userIntegralChanges.setInsertTime(new Date()); -- Gitblit v1.7.1