nickchange
2023-11-17 a9564eae9f0169ca39329b2f14a8f13d13358a0a
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==null){
                     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,15 @@
                        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());
                        courseList.add(course);
                    }
                }
                classInfoVo.setCourseList(courseList);
//                List<ExerciseVideo> stuCourseOfVideoList = voclClient.getStuCourseOfVideoList(coursePackIds);
                List<ExerciseVideo> query = voclClient.query(id);
                System.out.println("======queryqueryqueryquery=================="+query);
                List<ExerciseVideo> query = voclClient.query(tStudent.getId());
                classInfoVo.setExerciseVideoList(query);
            }else {
                classInfoVo.setIsThere(2);
                List<TImgConfig> tImgConfigs = configClient.getNoneStuImgs();
@@ -314,7 +336,7 @@
                    classInfoVo.setImgs(tImgConfigs.get(0).getContent());
                }
            }
        }
//        }
        return classInfoVo;
    }
@@ -742,17 +764,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 +817,7 @@
                    consumeDetail2.setConsumeName(RechargeRecordEnum.VENUE_RESERVATION.getMsg());
                    consumeDetail2.setConsumeAmount("-" + booking.getAmount());
                    consumeDetail2.setConsumeTime(booking.getTime1());
                    consumeDetail2.setType(1);
                    consumeDetail2.setType(2);
                    details.add(consumeDetail2);
                }
@@ -924,6 +946,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 +966,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 +975,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 +1007,9 @@
                if (allCoupon.getRedemptionMethod() == 1) {
                    commodity.setIntegral(allCoupon.getIntegral().intValue());
                } else {
                    if (allCoupon.getIntegral()!=null) {
                    commodity.setIntegral(allCoupon.getIntegral().intValue());
                    }
                    commodity.setAmount(allCoupon.getCash());
                }
                commodity.setBelongsType(allCoupon.getUserPopulation());
@@ -1003,7 +1032,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());
            }
        }
@@ -1341,10 +1370,12 @@
            }
            TAppUser user = appUserService.getById(userIdFormRedis);
            if (merchandise.getIntegral()!=null) {
            if (user.getIntegral()<merchandise.getIntegral().intValue()*goodsNums){
                return  new ResultUtil<>(0,"当前用户积分不足");
            }
            }
            AppUserGoodResp goodResp = new AppUserGoodResp();
            goodResp.setAppUserId(userIdFormRedis);
@@ -1366,7 +1397,12 @@
                UserPointsMerchandise pointsMerchandise = new UserPointsMerchandise();
                pointsMerchandise.setPointsMerchandiseId(exchangeType.getGoodId());
                pointsMerchandise.setUserId(userIdFormRedis);
                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);