| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.account.dto.BindDto; |
| | | import com.dsh.account.dto.SelectDto; |
| | | import com.dsh.account.dto.UpdateInfoDto; |
| | | import com.dsh.account.dto.UserInfoQueryDTO; |
| | | import com.dsh.account.dto.*; |
| | | import com.dsh.account.entity.*; |
| | | import com.dsh.account.enums.RechargeRecordEnum; |
| | | import com.dsh.account.feignclient.activity.IntroduceRewardsClient; |
| | |
| | | import com.dsh.account.feignclient.other.model.TImgConfig; |
| | | import com.dsh.account.mapper.*; |
| | | import com.dsh.account.model.*; |
| | | import com.dsh.account.model.AppUserByNameAndPhoneDTO; |
| | | import com.dsh.account.model.dto.Coupon; |
| | | import com.dsh.account.model.query.appUserQuery.QueryAppUser; |
| | | import com.dsh.account.model.vo.DetailsListVo; |
| | |
| | | if(tAppUser.getState() == 2){ |
| | | return ResultUtil.error("您的账号已被冻结", ""); |
| | | } |
| | | if (tAppUser.getCode()==null){ |
| | | tAppUser.setCode(UUIDUtil.getNumberRandom(16)); |
| | | } |
| | | tAppUser.setPassword(password); |
| | | this.updateById(tAppUser); |
| | | return ResultUtil.success(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IndexOfUserBenefirVo queryBenefitDetails(Integer appUserId) { |
| | | public IndexOfUserBenefirVo queryBenefitDetails(Integer appUserId,String lon,String lat) { |
| | | IndexOfUserBenefirVo benefirVo = new IndexOfUserBenefirVo(); |
| | | |
| | | TAppUser appUser = this.getById(appUserId); |
| | |
| | | }else { |
| | | benefirVo.setIsMember("普通用户"); |
| | | } |
| | | List<IntegralCommodity> convertibleGoods = mcClient.getConvertibleGoods(); |
| | | |
| | | Location location = new Location(); |
| | | location.setLat(lat); |
| | | location.setLon(lon); |
| | | List<IntegralCommodity> convertibleGoods = mcClient.getConvertibleGoods(location); |
| | | benefirVo.setCommodities(convertibleGoods); |
| | | benefirVo.setImage(icfgClient.getImageConfig()); |
| | | return benefirVo; |
| | |
| | | details.add(consumeDetail); |
| | | } |
| | | } |
| | | |
| | | //2.0 |
| | | List<CourseCounsum> courseCounsums = paymentClient.getConsumes(requestVo); |
| | | |
| | | for (CourseCounsum courseCounsum : courseCounsums) { |
| | | ConsumeDetail consumeDetail = new ConsumeDetail(); |
| | | String[] split = courseCounsum.getReason().split(";"); |
| | | consumeDetail.setConsumeName(split[0]); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(courseCounsum.getInsertTime())); |
| | | // if (courseCounsum.getChangeType()==3){ |
| | | consumeDetail.setConsumeAmount("-" + split[1]); |
| | | consumeDetail.setType(2); |
| | | // } |
| | | // |
| | | // consumeDetail.setConsumeAmount("-" + coursePackagePayment.getAmount()); |
| | | // consumeDetail.setType(2); |
| | | details.add(consumeDetail); |
| | | } |
| | | |
| | | |
| | | // 4.场地预约 |
| | | RequestOfTypeVo allSiteBookingList = stClient.getAllSiteBookingList(requestVo); |
| | | if (ToolUtil.isNotEmpty(allSiteBookingList.getRequest())){ |
| | |
| | | consumeDetail.setConsumeAmount("-" + booking.getAmount()); |
| | | consumeDetail.setConsumeTime(booking.getTime()); |
| | | consumeDetail.setType(2); |
| | | details.add(consumeDetail); |
| | | }else { |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.CANCEL_VENUE_RESERVATION.getMsg()); |
| | | consumeDetail.setConsumeAmount("+" + booking.getAmount()); |
| | | consumeDetail.setConsumeTime(booking.getTime()); |
| | | consumeDetail.setType(1); |
| | | ConsumeDetail consumeDetail1 = new ConsumeDetail(); |
| | | consumeDetail1.setConsumeName(RechargeRecordEnum.CANCEL_VENUE_RESERVATION.getMsg()); |
| | | consumeDetail1.setConsumeAmount("+" + booking.getAmount()); |
| | | consumeDetail1.setConsumeTime(booking.getTime()); |
| | | consumeDetail1.setType(1); |
| | | details.add(consumeDetail1); |
| | | ConsumeDetail consumeDetail2 = new ConsumeDetail(); |
| | | consumeDetail2.setConsumeName(RechargeRecordEnum.VENUE_RESERVATION.getMsg()); |
| | | consumeDetail2.setConsumeAmount("-" + booking.getAmount()); |
| | | consumeDetail2.setConsumeTime(booking.getTime1()); |
| | | consumeDetail2.setType(1); |
| | | details.add(consumeDetail2); |
| | | |
| | | } |
| | | details.add(consumeDetail); |
| | | // details.add(consumeDetail); |
| | | } |
| | | } |
| | | |
| | |
| | | case 2: |
| | | commodity.setGoodId(vicinityGood.getId()); |
| | | CoursePackage coursePackage = cpageClient.queryCoursePackageById(vicinityGood.getCoursePackageId()); |
| | | commodity.setGoodImg(coursePackage.getCoverDrawing()); |
| | | // commodity.setGoodImg(coursePackage.getCoverDrawing()); |
| | | commodity.setGoodImg(vicinityGood.getCover()); |
| | | commodity.setGoodName(coursePackage.getName()); |
| | | commodity.setCondition(vicinityGood.getRedemptionMethod()); |
| | | if (vicinityGood.getRedemptionMethod() == 1) { |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ResultUtil productRedemptionOperation(Integer userIdFormRedis, GoodsExchangeVo exchangeType) { |
| | | public synchronized ResultUtil productRedemptionOperation(Integer userIdFormRedis, GoodsExchangeVo exchangeType) { |
| | | System.out.println("exchangeType:--->"); |
| | | |
| | | |
| | | |
| | | ReturnModel returnModel = new ReturnModel(); |
| | | Long returnId = null; |
| | |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | PointsMerchandise merchandise = mcClient.selectPointsMerchandiseById(exchangeType.getGoodId()); |
| | | |
| | | |
| | | |
| | | |
| | | if (ToolUtil.isEmpty(merchandise)){ |
| | | return ResultUtil.error("商品不存在"); |
| | | } |
| | |
| | | }else { |
| | | goodsNums = exchangeType.getNums(); |
| | | } |
| | | |
| | | TAppUser user = appUserService.getById(userIdFormRedis); |
| | | if (user.getIntegral()<merchandise.getIntegral().intValue()*goodsNums){ |
| | | return new ResultUtil<>(0,"当前用户积分不足"); |
| | | } |
| | | |
| | | |
| | | AppUserGoodResp goodResp = new AppUserGoodResp(); |
| | | goodResp.setAppUserId(userIdFormRedis); |
| | | goodResp.setGoodId(merchandise.getId()); |
| | | int count = mcClient.queryUserHasGoodsNums(goodResp); |
| | | if (ToolUtil.isNotEmpty(count) && count >= merchandise.getPickUpQuantity()){ |
| | | if (ToolUtil.isNotEmpty(count) && count+exchangeType.getNums() > merchandise.getPickUpQuantity()){ |
| | | return ResultUtil.error("超过限领数量"); |
| | | } |
| | | int count1 = mcClient.queryUserHasGoodsNums1(goodResp); |
| | | if (ToolUtil.isNotEmpty(count1) && count1 >= merchandise.getQuantityIssued()){ |
| | | return ResultUtil.error("超过发放数量"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | for (int i = 0; i < goodsNums; i++) { |
| | | // 新增积分商品兑换记录 |
| | |
| | | pointsMerchandise.setUserId(userIdFormRedis); |
| | | pointsMerchandise.setStatus(1); |
| | | pointsMerchandise.setState(1); |
| | | pointsMerchandise.setPayStatus(1); |
| | | if (exchangeType.getExchangeType()==1) { |
| | | pointsMerchandise.setPayStatus(2); |
| | | }else { |
| | | pointsMerchandise.setPayStatus(1); |
| | | } |
| | | if (merchandise.getUseScope() == 3){ |
| | | if (exchangeType.getGoodsType() == 2){ |
| | | CoursePackage coursePackage = cpageClient.queryCoursePackageById(merchandise.getCoursePackageId()); |
| | |
| | | packagePayment.setStatus(1); |
| | | packagePayment.setState(1); |
| | | packagePayment.setCode(code); |
| | | paymentClient.savePaymentCoursePackage(packagePayment); |
| | | // paymentClient.savePaymentCoursePackage(packagePayment); |
| | | |
| | | OrderDto orderDto = new OrderDto(); |
| | | orderDto.setAppUserId(userIdFormRedis); |
| | | String joinedString = String.join(",", exchangeType.getStuIds().stream().map(Object::toString).collect(Collectors.toList())); |
| | | orderDto.setStuIds(joinedString); |
| | | orderDto.setClassId(merchandise.getCoursePackageId()); |
| | | orderDto.setClassHours(packagePayment.getClassHours()); |
| | | paymentClient.orderClass(orderDto); |
| | | |
| | | |
| | | } |
| | | break; |
| | | case 4: |
| | |
| | | UserIntegralChanges userIntegralChanges = new UserIntegralChanges(); |
| | | userIntegralChanges.setAppUserId(appUserId); |
| | | userIntegralChanges.setOldIntegral(appUser.getIntegral()); |
| | | userIntegralChanges.setType(2); |
| | | userIntegralChanges.setType(5); |
| | | appUser.setIntegral(null == appUser.getIntegral() ? points : appUser.getIntegral() - points); |
| | | userIntegralChanges.setNewIntegral(appUser.getIntegral()); |
| | | userIntegralChanges.setInsertTime(new Date()); |
| | |
| | | |
| | | private ResultUtil AlipayPayment(BigDecimal cash, String code,Long returnId) { |
| | | System.out.println("金额:"+cash); |
| | | ResultUtil alipay = payMoneyUtil.alipay("课包续费", "课包续费", String.valueOf(returnId), code, cash.toString(), |
| | | ResultUtil alipay = payMoneyUtil.alipay("优惠卷", "优惠卷", String.valueOf(returnId), code, cash.toString(), |
| | | "/base/pointMer/exchangeGoodPaymentAliCallback"); |
| | | if(alipay.getCode() == 200){ |
| | | new Thread(new Runnable() { |
| | |
| | | String tradeNo = resultUtil.getTradeNo(); |
| | | String tradeStatus = resultUtil.getTradeStatus(); |
| | | System.out.println("ssssss"+tradeStatus); |
| | | if("REFUND".equals(tradeStatus) || "NOTPAY".equals(tradeStatus) || "CLOSED".equals(tradeStatus) || "REVOKED".equals(tradeStatus) || "PAYERROR".equals(tradeStatus) || num == 10){ |
| | | mcClient.deletePaymentRecord(code); |
| | | break; |
| | | } |
| | | |
| | | if("TRADE_SUCCESS".equals(tradeStatus)){ |
| | | for (UserPointsMerchandise userPointsMerchandise : userPointsMerchandises) { |
| | | userPointsMerchandise.setPayStatus(2); |
| | | userPointsMerchandise.setOrderNumber(tradeNo); |
| | | userPointsMerchandise.setPayType(2); |
| | | userPointsMerchandise.setInsertTime(null); |
| | | userPointsMerchandise.setUserId(null); |
| | | mcClient.updateDetailsUserPointMercase(userPointsMerchandise); |
| | | } |
| | | moneyOut(tradeNo,tradeNo); |
| | | break; |
| | | } |
| | | // if("REFUND".equals(tradeStatus) || "NOTPAY".equals(tradeStatus) || "CLOSED".equals(tradeStatus) || "REVOKED".equals(tradeStatus) || "PAYERROR".equals(tradeStatus) || num == 10){ |
| | | // mcClient.deletePaymentRecord(code); |
| | | // break; |
| | | // } |
| | | |
| | | if("WAIT_BUYER_PAY".equals(tradeStatus)){ |
| | | num++; |
| | | } |