| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.account.entity.RechargeRecords; |
| | | import com.dsh.account.entity.TAppUser; |
| | | import com.dsh.account.entity.TStudent; |
| | | import com.dsh.account.entity.VipPayment; |
| | | import com.dsh.account.entity.*; |
| | | import com.dsh.account.enums.RechargeRecordEnum; |
| | | import com.dsh.account.feignclient.activity.MerChandiseClient; |
| | | import com.dsh.account.feignclient.activity.MerChandiseStoreClient; |
| | | import com.dsh.account.feignclient.activity.UserConponClient; |
| | | import com.dsh.account.feignclient.activity.model.CommodityRequest; |
| | | import com.dsh.account.feignclient.activity.model.PointsMerchandise; |
| | | import com.dsh.account.feignclient.activity.model.*; |
| | | import com.dsh.account.feignclient.competition.DeductionCompetitionsClient; |
| | | import com.dsh.account.feignclient.competition.model.PaymentCompetition; |
| | | import com.dsh.account.feignclient.course.CoursePackageClient; |
| | | import com.dsh.account.feignclient.course.CoursePaymentClient; |
| | | import com.dsh.account.feignclient.course.model.CourseOfStoreVo; |
| | | import com.dsh.account.feignclient.course.model.CoursePackage; |
| | | import com.dsh.account.feignclient.course.model.QueryStoreList; |
| | | import com.dsh.account.feignclient.course.model.StuCourseResp; |
| | | import com.dsh.account.feignclient.course.model.*; |
| | | import com.dsh.account.feignclient.other.ImgConfigClient; |
| | | import com.dsh.account.feignclient.other.RechargeConfigClient; |
| | | import com.dsh.account.feignclient.other.StoreClient; |
| | | import com.dsh.account.feignclient.other.model.Store; |
| | | import com.dsh.account.feignclient.other.model.TImgConfig; |
| | | import com.dsh.account.mapper.RechargeRecordsMapper; |
| | | import com.dsh.account.mapper.TAppUserMapper; |
| | | import com.dsh.account.mapper.TStudentMapper; |
| | | import com.dsh.account.mapper.VipPaymentMapper; |
| | | import com.dsh.account.feignclient.other.model.*; |
| | | import com.dsh.account.mapper.*; |
| | | import com.dsh.account.model.AddAppUserVo; |
| | | import com.dsh.account.model.JoinPlayPaiVo; |
| | | import com.dsh.account.model.LoginSMSCodeVo; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | @Resource |
| | | private CoursePackageClient cpageClient; |
| | | |
| | | @Resource |
| | | private DeductionCompetitionsClient deducClient; |
| | | |
| | | @Resource |
| | | private UserIntegralChangesMapper uicMapper; |
| | | |
| | | @Resource |
| | | private MerChandiseStoreClient mcsClient; |
| | | |
| | | @Override |
| | | public ClassInfoVo queryUserOfStus(Integer id,String latitude,String longitude) { |
| | |
| | | @Override |
| | | public JoinPlayPaiVo queryJoinPlayPai(Integer uid, String lon, String lat) throws Exception { |
| | | TAppUser appUser = this.getById(uid); |
| | | if(ToolUtil.isEmpty(appUser.getProvince()) && ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)){ |
| | | if(ToolUtil.isEmpty(appUser.getProvince()) && ToolUtil.isNotEmpty(lon)){ |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(lon, lat); |
| | | if(null != geocode){ |
| | | String province = geocode.get("province"); |
| | |
| | | joinPlayPaiVo.setLon(s.getLon()); |
| | | joinPlayPaiVo.setLat(s.getLat()); |
| | | joinPlayPaiVo.setStoreId(s.getId()); |
| | | joinPlayPaiVo.setPhone(s.getPhone()); |
| | | } |
| | | return joinPlayPaiVo; |
| | | } |
| | |
| | | BillingDetailsVo vo = new BillingDetailsVo(); |
| | | List<BillingDetailsVo.ConsumeDetail> details = new ArrayList<>(); |
| | | |
| | | // TODO: 2023/7/11 账单记录查询 |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm"); |
| | | Date monthStart = null; |
| | | Date monthEnd = null; |
| | |
| | | monthEnd = DateTimeHelper.getCurrentMouthEnd(); |
| | | } |
| | | // 1.赛事报名 |
| | | // 2.课包购买 |
| | | |
| | | // 3.场地预约 |
| | | // 4.智慧球场 |
| | | // 5.年度会员 |
| | | List<PaymentCompetition> allCompetitionPayRecord = deducClient.getAllCompetitionPayRecord(appUserId); |
| | | if (allCompetitionPayRecord.size() > 0 ){ |
| | | for (PaymentCompetition paymentCompetition : allCompetitionPayRecord) { |
| | | BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail(); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.EVENT_REGISTRATION.getMsg()); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(paymentCompetition.getInsertTime())); |
| | | consumeDetail.setConsumeAmount("-" + paymentCompetition.getAmount()); |
| | | details.add(consumeDetail); |
| | | } |
| | | } |
| | | // 2.取消赛事报名 |
| | | List<PaymentCompetition> cancelOrderOfUserPayRecord = deducClient.getCancelOrderOfUserPayRecord(appUserId); |
| | | if (cancelOrderOfUserPayRecord.size() > 0 ){ |
| | | for (PaymentCompetition paymentCompetition : cancelOrderOfUserPayRecord) { |
| | | BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail(); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.CANCEL_EVENT_REGISTRATION.getMsg()); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(paymentCompetition.getInsertTime())); |
| | | consumeDetail.setConsumeAmount("+" + paymentCompetition.getAmount()); |
| | | details.add(consumeDetail); |
| | | } |
| | | } |
| | | // 3.课包购买 |
| | | List<TCoursePackagePayment> amountPayRecord = paymentClient.getAmountPayRecord(appUserId); |
| | | if (amountPayRecord.size() > 0 ){ |
| | | for (TCoursePackagePayment coursePackagePayment : amountPayRecord) { |
| | | BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail(); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.COURSE_PACKAGE_PURCHASE.getMsg()); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(coursePackagePayment.getInsertTime())); |
| | | consumeDetail.setConsumeAmount("-" + coursePackagePayment.getCashPayment()); |
| | | details.add(consumeDetail); |
| | | } |
| | | } |
| | | // 4.场地预约 |
| | | // 5.智慧球场 |
| | | // 6.年度会员 |
| | | List<VipPayment> vipPayments = vipPaymentMapper.selectList(new QueryWrapper<VipPayment>() |
| | | .eq("payStatus", 2) |
| | | .eq("appUserId", appUserId) |
| | |
| | | BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail(); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.ANNUAL_MEMBERSHIP.getMsg()); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(vipPayment.getInsertTime())); |
| | | consumeDetail.setConsumeAmount("+" + vipPayment.getAmount()); |
| | | consumeDetail.setConsumeAmount("-" + vipPayment.getAmount()); |
| | | details.add(consumeDetail); |
| | | } |
| | | } |
| | | // 6.续课 |
| | | // 7.充值 |
| | | List<RechargeRecords> rechargeRecords = rrMapper.selectList(new QueryWrapper<RechargeRecords>() |
| | | .eq("payStatus", 2) |
| | |
| | | BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail(); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.RECHARGE.getMsg() + ":" + rechargeRecord.getPlayPaiCoins()); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(rechargeRecord.getInsertTime())); |
| | | consumeDetail.setConsumeAmount("+" + rechargeRecord.getAmount()); |
| | | consumeDetail.setConsumeAmount("-" + rechargeRecord.getAmount()); |
| | | details.add(consumeDetail); |
| | | } |
| | | } |
| | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | | public ProductDetailsVo productDetails(Integer goodId, Integer goodsType ) { |
| | | ProductDetailRequest detailsVo = new ProductDetailRequest(); |
| | | detailsVo.setGoodsType(goodsType); |
| | | detailsVo.setGoodId(goodId); |
| | | return mcClient.getGoodDetailsWithId(detailsVo); |
| | | } |
| | | |
| | | @Override |
| | | public StuAndStoreResponse queryAppUserDefaultStuAndStore(Integer userIdFormRedis,Integer pointsMerId, String lat, String lon,Integer isCourse) { |
| | | StuAndStoreResponse response = new StuAndStoreResponse(); |
| | | if (isCourse == 1){ |
| | | List<TStudent> tStudents = tsmapper.selectList(new QueryWrapper<TStudent>() |
| | | .eq("appUserId",userIdFormRedis) |
| | | .eq("state",1) |
| | | .eq("isDefault",1)); |
| | | if (tStudents.size() > 0 ){ |
| | | response.setStuId(tStudents.get(0).getId()); |
| | | response.setStuName(tStudents.get(0).getName()); |
| | | response.setStuPhone(tStudents.get(0).getPhone()); |
| | | response.setStuAge(DateUtil.age(tStudents.get(0).getBirthday())); |
| | | } |
| | | return response; |
| | | }else { |
| | | PointsMerchandise pointsMerchandise = mcClient.selectPointsMerchandiseById(pointsMerId); |
| | | if (pointsMerchandise.getType() == 4){ |
| | | List<Integer> couponStoreIds = ucponClient.getCouponStoreIds(pointsMerId); |
| | | StoreDetailOfCourse courseOfStore = storeClient.getCourseOfStore(couponStoreIds.get(0)); |
| | | if(ToolUtil.isNotEmpty(courseOfStore)){ |
| | | response.setStoreId(couponStoreIds.get(0)); |
| | | response.setStoreName(courseOfStore.getStoreName()); |
| | | } |
| | | }else { |
| | | List<Integer> integers = mcsClient.queryPointMerStoreIds(pointsMerId); |
| | | StoreDetailOfCourse courseOfStore = storeClient.getCourseOfStore(integers.get(0)); |
| | | if(ToolUtil.isNotEmpty(courseOfStore)){ |
| | | response.setStoreId(integers.get(0)); |
| | | response.setStoreName(courseOfStore.getStoreName()); |
| | | } |
| | | } |
| | | return response; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public ResultUtil productRedemptionOperation(Integer userIdFormRedis, Integer goodId, Integer goodsType,Integer nums,Integer exchangeType,Integer payType) { |
| | | PointsMerchandise merchandise = mcClient.selectPointsMerchandiseById(goodId); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | for (int i = 0; i < nums; i++) { |
| | | UserPointsMerchandise pointsMerchandise = new UserPointsMerchandise(); |
| | | pointsMerchandise.setPointsMerchandiseId(goodId); |
| | | pointsMerchandise.setUserId(userIdFormRedis); |
| | | pointsMerchandise.setCode(code); |
| | | mcClient.saveDetailsUserPointMercase(pointsMerchandise); |
| | | } |
| | | |
| | | // 扣减积分 |
| | | TAppUser tAppUser = this.baseMapper.selectById(userIdFormRedis); |
| | | |
| | | |
| | | // 积分变更记录 |
| | | UserIntegralChanges userIntegralChanges = new UserIntegralChanges(); |
| | | userIntegralChanges.setAppUserId(userIdFormRedis); |
| | | userIntegralChanges.setOldIntegral(tAppUser.getIntegral()); |
| | | userIntegralChanges.setType(2); |
| | | tAppUser.setIntegral(null == tAppUser.getIntegral() ? merchandise.getIntegral() : tAppUser.getIntegral() +merchandise.getIntegral()); |
| | | userIntegralChanges.setNewIntegral(tAppUser.getIntegral()); |
| | | userIntegralChanges.setInsertTime(new Date()); |
| | | uicMapper.insert(userIntegralChanges); |
| | | |
| | | this.baseMapper.updateById(tAppUser); |
| | | // 现金支付 |
| | | if (exchangeType == 1){ |
| | | // 积分兑换 |
| | | switch (goodsType){ |
| | | case 2: |
| | | for (int i = 0; i < nums; i++) { |
| | | TCoursePackagePayment packagePayment = new TCoursePackagePayment(); |
| | | // packagePayment.setAppUserId(); |
| | | // TODO: 2023/7/14 |
| | | paymentClient.savePaymentCoursePackage(packagePayment); |
| | | } |
| | | break; |
| | | case 4: |
| | | for (int i = 0; i < nums; i++) { |
| | | UserCoupon coupon = new UserCoupon(); |
| | | coupon.setCouponId(goodId); |
| | | coupon.setUserId(userIdFormRedis); |
| | | coupon.setStatus(1); |
| | | coupon.setInsertTime(new Date()); |
| | | ucponClient.insertToAppuserCoupon(coupon); |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | }else { |
| | | switch (payType){ |
| | | case 1: |
| | | return WechatPayment(merchandise.getCash(),code); |
| | | case 2: |
| | | return AlipayPayment(merchandise.getCash(),code); |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | private ResultUtil AlipayPayment(BigDecimal cash, String code) { |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | private ResultUtil WechatPayment(BigDecimal cash, String code) { |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | | public ResultUtil exchangeAddPaymentCallback(String code, String orderNumber,Integer payType) { |
| | | List<UserPointsMerchandise> userPointsMerchandises = mcClient.queryUserPointMerchaseByCode(code); |
| | | if (userPointsMerchandises.size() > 1){ |
| | | for (int i = 0; i < userPointsMerchandises.size(); i++) { |
| | | userPointsMerchandises.get(i).setOrderNumber(orderNumber+ "-" + (i+1)); |
| | | mcClient.updateDetailsUserPointMercase(userPointsMerchandises.get(i)); |
| | | |
| | | Integer pointsMerchandiseId = userPointsMerchandises.get(i).getPointsMerchandiseId(); |
| | | PointsMerchandise pointsMerchandise = mcClient.selectPointsMerchandiseById(pointsMerchandiseId); |
| | | switch (pointsMerchandise.getType()){ |
| | | case 2: |
| | | TCoursePackagePayment packagePayment = new TCoursePackagePayment(); |
| | | |
| | | // packagePayment.setAppUserId(); |
| | | |
| | | paymentClient.savePaymentCoursePackage(packagePayment); |
| | | break; |
| | | case 4: |
| | | UserCoupon coupon = new UserCoupon(); |
| | | coupon.setCouponId(userPointsMerchandises.get(0).getPointsMerchandiseId()); |
| | | coupon.setUserId(userPointsMerchandises.get(0).getUserId()); |
| | | coupon.setStatus(1); |
| | | coupon.setInsertTime(new Date()); |
| | | ucponClient.insertToAppuserCoupon(coupon); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | }else { |
| | | userPointsMerchandises.get(0).setOrderNumber(orderNumber); |
| | | mcClient.updateDetailsUserPointMercase(userPointsMerchandises.get(0)); |
| | | Integer pointsMerchandiseId = userPointsMerchandises.get(0).getPointsMerchandiseId(); |
| | | PointsMerchandise pointsMerchandise = mcClient.selectPointsMerchandiseById(pointsMerchandiseId); |
| | | switch (pointsMerchandise.getType()){ |
| | | case 2: |
| | | TCoursePackagePayment packagePayment = new TCoursePackagePayment(); |
| | | |
| | | // packagePayment.setAppUserId(); |
| | | |
| | | paymentClient.savePaymentCoursePackage(packagePayment); |
| | | break; |
| | | case 4: |
| | | UserCoupon coupon = new UserCoupon(); |
| | | coupon.setCouponId(userPointsMerchandises.get(0).getPointsMerchandiseId()); |
| | | coupon.setUserId(userPointsMerchandises.get(0).getUserId()); |
| | | coupon.setStatus(1); |
| | | coupon.setInsertTime(new Date()); |
| | | ucponClient.insertToAppuserCoupon(coupon); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | | public List<StoreResponse> queryStoresOfExchange(Integer goodsType,Integer pointsMerId) { |
| | | List<StoreResponse> responses = new ArrayList<>(); |
| | | if (goodsType == 4){ |
| | | List<Integer> couponStoreIds = ucponClient.getCouponStoreIds(pointsMerId); |
| | | for (Integer couponStoreId : couponStoreIds) { |
| | | StoreDetailOfCourse courseOfStore = storeClient.getCourseOfStore(couponStoreId); |
| | | if(ToolUtil.isNotEmpty(courseOfStore)){ |
| | | StoreResponse response = new StoreResponse(); |
| | | response.setStoreId(couponStoreId); |
| | | response.setStoreName(courseOfStore.getStoreName()); |
| | | responses.add(response); |
| | | } |
| | | } |
| | | }else { |
| | | List<Integer> integers = mcsClient.queryPointMerStoreIds(pointsMerId); |
| | | for (Integer integer : integers) { |
| | | StoreDetailOfCourse courseOfStore = storeClient.getCourseOfStore(integer); |
| | | if(ToolUtil.isNotEmpty(courseOfStore)){ |
| | | StoreResponse response = new StoreResponse(); |
| | | response.setStoreId(integer); |
| | | response.setStoreName(courseOfStore.getStoreName()); |
| | | responses.add(response); |
| | | } |
| | | } |
| | | } |
| | | return responses; |
| | | } |
| | | |
| | | |
| | | } |