From f6ba3e15355e22767e69f8fc14ae22523f8db8dc Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期三, 22 十一月 2023 19:33:58 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/PlayPai --- cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java | 180 +++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 118 insertions(+), 62 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 44f4d18..a7d0bc2 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 @@ -263,14 +263,35 @@ return appUserMapper.groupCityInfo(dto); } @Override - public ClassInfoVo queryUserOfStus(Integer id) { - TAppUser tAppUser = this.baseMapper.selectById(id); + public ClassInfoVo queryUserOfStus(Integer id,Integer uid) { + TAppUser tAppUser = this.baseMapper.selectById(uid); ClassInfoVo classInfoVo = new ClassInfoVo(); - if (ToolUtil.isNotEmpty(tAppUser)){ - List<TStudent> tStudents = tsmapper.selectList(new QueryWrapper<TStudent>() +// if (ToolUtil.isNotEmpty(tAppUser)){ + +// + + List<TStudent> tStudents = new ArrayList<>(); + if (id!=null) { + tStudents = tsmapper.selectList(new QueryWrapper<TStudent>() + .eq("id", id).eq("state", 1)); + + if (tStudents.size() == 0) { + tStudents = tsmapper.selectList(new QueryWrapper<TStudent>() + .eq("appUserId", tAppUser.getId()) + .eq("state", 1)); + } + }else { + tStudents = tsmapper.selectList(new QueryWrapper<TStudent>() .eq("appUserId",tAppUser.getId()) .eq("state",1) .eq("isDefault",1)); + if (tStudents.isEmpty()){ + tStudents = tsmapper.selectList(new QueryWrapper<TStudent>() + .eq("appUserId",tAppUser.getId()) + .eq("state",1)) + ; + } + } if (tStudents.size() > 0 ){ TStudent tStudent = tStudents.get(0); classInfoVo.setStuId(tStudent.getId()); @@ -299,14 +320,16 @@ course.setDeductedNums(ToolUtil.isEmpty(tCoursePackagePayment.getDeductionNums()) ? 0 : tCoursePackagePayment.getDeductionNums()); course.setRemainingNums(ToolUtil.isEmpty(tCoursePackagePayment.getResidueNums())? 0 : tCoursePackagePayment.getResidueNums()); course.setPeriodOfValidity(tCoursePackagePayment.getPeriodOfValidity()); + course.setIsAble(tCoursePackagePayment.getIsAble()); + course.setCourseType(tCoursePackagePayment.getCourseType()); courseList.add(course); } } classInfoVo.setCourseList(courseList); // List<ExerciseVideo> stuCourseOfVideoList = voclClient.getStuCourseOfVideoList(coursePackIds); - List<ExerciseVideo> query = voclClient.query(id); - System.out.println("======queryqueryqueryquery=================="+query); - classInfoVo.setExerciseVideoList(query); + List<ExerciseVideo> query = voclClient.query(tStudent.getId()); + classInfoVo.setExerciseVideoList(query); + }else { classInfoVo.setIsThere(2); List<TImgConfig> tImgConfigs = configClient.getNoneStuImgs(); @@ -314,7 +337,7 @@ classInfoVo.setImgs(tImgConfigs.get(0).getContent()); } } - } +// } return classInfoVo; } @@ -397,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("账号已存在"); } @@ -413,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(); } @@ -742,17 +783,17 @@ } } // 3.课包购买 - BillingRequestVo amountPayRecord = paymentClient.getAmountPayRecord(requestVo); - if (ToolUtil.isNotEmpty(amountPayRecord.getRequests())){ - for (BillingRequest coursePackagePayment : amountPayRecord.getRequests()) { - ConsumeDetail consumeDetail = new ConsumeDetail(); - consumeDetail.setConsumeName(RechargeRecordEnum.COURSE_PACKAGE_PURCHASE.getMsg()); - consumeDetail.setConsumeTime(coursePackagePayment.getTime()); - consumeDetail.setConsumeAmount("-" + coursePackagePayment.getAmount()); - consumeDetail.setType(2); - details.add(consumeDetail); - } - } +// BillingRequestVo amountPayRecord = paymentClient.getAmountPayRecord(requestVo); +// if (ToolUtil.isNotEmpty(amountPayRecord.getRequests())){ +// for (BillingRequest coursePackagePayment : amountPayRecord.getRequests()) { +// ConsumeDetail consumeDetail = new ConsumeDetail(); +// consumeDetail.setConsumeName(RechargeRecordEnum.COURSE_PACKAGE_PURCHASE.getMsg()); +// consumeDetail.setConsumeTime(coursePackagePayment.getTime()); +// consumeDetail.setConsumeAmount("-" + coursePackagePayment.getAmount()); +// consumeDetail.setType(2); +// details.add(consumeDetail); +// } +// } //2.0 List<CourseCounsum> courseCounsums = paymentClient.getConsumes(requestVo); @@ -795,7 +836,7 @@ consumeDetail2.setConsumeName(RechargeRecordEnum.VENUE_RESERVATION.getMsg()); consumeDetail2.setConsumeAmount("-" + booking.getAmount()); consumeDetail2.setConsumeTime(booking.getTime1()); - consumeDetail2.setType(1); + consumeDetail2.setType(2); details.add(consumeDetail2); } @@ -827,7 +868,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); @@ -924,6 +965,7 @@ } commodity.setBelongsType(vicinityGood.getUserPopulation()); commodity.setGoodsType(1); + commodity.setUseScope(vicinityGood.getUseScope()); commodity.setNums(mcClient.getRedeemedQuantity(vicinityGood.getId())); List<Integer> integers = mcsClient.queryPointMerStoreIds(vicinityGood.getId()); commodity.setShopIds(integers); @@ -943,6 +985,8 @@ } commodity.setBelongsType(vicinityGood.getUserPopulation()); commodity.setGoodsType(2); + commodity.setUseScope(vicinityGood.getUseScope()); + commodity.setNums(mcClient.getRedeemedQuantity(vicinityGood.getId())); commodity.setShopIds(mcsClient.queryPointMerStoreIds(vicinityGood.getId())); break; @@ -950,6 +994,8 @@ commodity.setGoodId(vicinityGood.getId()); commodity.setGoodName(vicinityGood.getName()); commodity.setGoodImg(vicinityGood.getCover()); + commodity.setUseScope(vicinityGood.getUseScope()); + commodity.setCondition(vicinityGood.getRedemptionMethod()); if (vicinityGood.getRedemptionMethod() == 1) { commodity.setIntegral(vicinityGood.getIntegral().intValue()); @@ -980,7 +1026,9 @@ if (allCoupon.getRedemptionMethod() == 1) { commodity.setIntegral(allCoupon.getIntegral().intValue()); } else { - commodity.setIntegral(allCoupon.getIntegral().intValue()); + if (allCoupon.getIntegral()!=null) { + commodity.setIntegral(allCoupon.getIntegral().intValue()); + } commodity.setAmount(allCoupon.getCash()); } commodity.setBelongsType(allCoupon.getUserPopulation()); @@ -1003,7 +1051,7 @@ if (request.getShopId()!=null){ if (goods.size() > 0 ){ goods = goods.stream() - .filter( merchandise ->(merchandise.getGoodsType() == 4&&merchandise.getUseScope() == 2)||(merchandise.getGoodsType() == 4&&merchandise.getUseScope() == 1)||merchandise.getShopIds().contains(request.getShopId())) + .filter( merchandise ->(merchandise.getGoodsType() == 1&&merchandise.getUseScope() == 2)||(merchandise.getGoodsType() == 1&&merchandise.getUseScope() == 1)||(merchandise.getGoodsType() == 4&&merchandise.getUseScope() == 2)||(merchandise.getGoodsType() == 4&&merchandise.getUseScope() == 1)||merchandise.getShopIds().contains(request.getShopId())) .collect(Collectors.toList()); } } @@ -1132,7 +1180,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())){ @@ -1341,10 +1390,12 @@ } TAppUser user = appUserService.getById(userIdFormRedis); - if (user.getIntegral()<merchandise.getIntegral().intValue()*goodsNums){ - return new ResultUtil<>(0,"当前用户积分不足"); - } + if (merchandise.getIntegral()!=null) { + if (user.getIntegral() < merchandise.getIntegral().intValue() * goodsNums) { + return new ResultUtil<>(0, "当前用户积分不足"); + } + } AppUserGoodResp goodResp = new AppUserGoodResp(); goodResp.setAppUserId(userIdFormRedis); @@ -1366,7 +1417,12 @@ UserPointsMerchandise pointsMerchandise = new UserPointsMerchandise(); pointsMerchandise.setPointsMerchandiseId(exchangeType.getGoodId()); pointsMerchandise.setUserId(userIdFormRedis); - pointsMerchandise.setStatus(1); + if (exchangeType.getGoodsType()==2){ + pointsMerchandise.setStatus(2); + pointsMerchandise.setVerificationTime(new Date()); + }else { + pointsMerchandise.setStatus(1); + } pointsMerchandise.setState(1); if (exchangeType.getExchangeType()==1) { pointsMerchandise.setPayStatus(2); -- Gitblit v1.7.1