| | |
| | | package com.dsh.account.service.impl; |
| | | |
| | | import com.alipay.api.response.AlipayTradeQueryResponse; |
| | | 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.mapper.CoachMapper; |
| | | import com.dsh.account.mapper.TAppUserMapper; |
| | | import com.dsh.account.mapper.TStudentMapper; |
| | | import com.dsh.account.model.vo.classDetails.AppointmentRecordVo; |
| | | import com.dsh.account.model.vo.classDetails.ClasspaymentRequest; |
| | | import com.dsh.account.model.vo.classDetails.StuEditInfoReq; |
| | | import com.dsh.account.model.vo.classDetails.classInsVo.ClassDetailsInsVo; |
| | |
| | | import com.dsh.account.model.vo.sourceDetail.CouponStuAvailableVo; |
| | | import com.dsh.account.model.vo.sourceDetail.CourseDetailsOfContinuationResp; |
| | | import com.dsh.account.model.vo.sourceDetail.RecordTimeRequest; |
| | | import com.dsh.account.model.vo.userBenefitDetail.Goods; |
| | | import com.dsh.account.service.TCourseInfoRecordService; |
| | | import com.dsh.account.service.TStudentService; |
| | | import com.dsh.account.util.*; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | student.setHeight(stu.getHeight()); |
| | | student.setWeight(stu.getWeight()); |
| | | BigDecimal bigDecimal = BigDecimal.valueOf(stu.getWeight()); |
| | | BigDecimal multiply = bigDecimal.subtract(BigDecimal.valueOf(stu.getHeight())).multiply(bigDecimal.subtract(BigDecimal.valueOf(stu.getHeight()))); |
| | | multiply.setScale(2); |
| | | student.setBmi(multiply.doubleValue()); |
| | | double v = stu.getHeight() / 100; |
| | | double v1 = v * v; |
| | | BigDecimal bigDecimal1 = new BigDecimal(v1).setScale(2, RoundingMode.HALF_UP); |
| | | double v2 = bigDecimal.doubleValue() / bigDecimal1.doubleValue(); |
| | | BigDecimal bigDecimal2 = new BigDecimal(v2).setScale(2, RoundingMode.HALF_UP); |
| | | student.setBmi(bigDecimal2.doubleValue()); |
| | | student.setInsertTime(new Date()); |
| | | student.setState(1); |
| | | |
| | | List<TStudent> tStudents = this.baseMapper.selectList(new LambdaQueryWrapper<TStudent>().eq(TStudent::getAppUserId, appUserId)); |
| | | if(tStudents.size()>0){ |
| | | student.setIsDefault(2); |
| | | }else { |
| | | student.setIsDefault(1); |
| | | } |
| | | this.baseMapper.insert(student); |
| | | |
| | | //同步信息到参赛人员信息中 |
| | |
| | | public List<PurchaseRecordVo> queryDeduRecordDetails(RecordTimeRequest timeRequest,Integer appUserId) { |
| | | List<PurchaseRecordVo> purchaseRecordVoList = new ArrayList<>(); |
| | | String time = timeRequest.getTime(); |
| | | Date monthStart = null; |
| | | Date monthEnd = null; |
| | | if (StringUtils.hasText(time)) { |
| | | monthStart = DateTimeHelper.getCurrentIdetMouthStart(time); |
| | | monthEnd = DateTimeHelper.getCurrentIdeaMouthEnd(time); |
| | | } else { |
| | | monthStart = DateTimeHelper.getCurrentMouthStart(); |
| | | monthEnd = DateTimeHelper.getCurrentMouthEnd(); |
| | | } |
| | | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM"); |
| | | Date startTime = DateTimeHelper.getCurrentIdetMouthStart(simpleDateFormat.format(monthStart)); |
| | | Date endTime = DateTimeHelper.getCurrentIdeaMouthEnd(simpleDateFormat.format(monthEnd)); |
| | | GetStuSourseList getStuSourseList = new GetStuSourseList(); |
| | | getStuSourseList.setStartTime(startTime); |
| | | getStuSourseList.setEndTime(endTime); |
| | | getStuSourseList.setAppUserId(appUserId); |
| | | // 报名赛事 |
| | | List<PurchaseRecordVo> stuSourseList = dcttClient.getStuSourseList(getStuSourseList); |
| | | purchaseRecordVoList.addAll(stuSourseList); |
| | | List<PurchaseRecordVo> record1 = sessionNameClient.getRecord(timeRequest); |
| | | |
| | | GetStuSessionList sessionList = new GetStuSessionList(); |
| | | sessionList.setStartTime(startTime); |
| | | sessionList.setEndTime(endTime); |
| | | sessionList.setStuId(timeRequest.getStuId()); |
| | | sessionList.setAppUserId(appUserId); |
| | | List<PurchaseRecordVo> cancelCourseList = cancelcClient.getCancelCourseList(sessionList); |
| | | |
| | | purchaseRecordVoList.addAll(cancelCourseList); |
| | | GetStuSessionList getStuSessionList = new GetStuSessionList(); |
| | | getStuSessionList.setStartTime(startTime); |
| | | getStuSessionList.setEndTime(endTime); |
| | | getStuSessionList.setStuId(timeRequest.getStuId()); |
| | | getStuSessionList.setAppUserId(appUserId); |
| | | // 购买课包 |
| | | List<PurchaseRecordVo> purchaseRecordVos = sessionNameClient.queryCourseDetails(getStuSessionList); |
| | | purchaseRecordVoList.addAll(purchaseRecordVos); |
| | | List<TAppUser> tAppUsers = tauMapper.selectList(new QueryWrapper<TAppUser>() |
| | | .eq("referralUserId",appUserId ) |
| | | .between("insertTime",startTime ,endTime)); |
| | | if (ToolUtil.isNotEmpty(tAppUsers)){ |
| | | List<Integer> userIds = tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | IntrduceOfUserRequest request = new IntrduceOfUserRequest(); |
| | | request.setStartTime(startTime); |
| | | request.setEndTime(endTime); |
| | | request.setUserIds(userIds); |
| | | // 介绍有礼 |
| | | List<PurchaseRecordVo> purchaseRecordVos1 = idrClient.queryAppUsersofIntroduce(request); |
| | | purchaseRecordVoList.addAll(purchaseRecordVos1); |
| | | } |
| | | |
| | | LambdaQueryWrapper<TCourseInfoRecord> eq = new LambdaQueryWrapper<TCourseInfoRecord>().eq(TCourseInfoRecord::getUserId, appUserId); |
| | | if(timeRequest.getType()!=null){ |
| | | eq.eq(TCourseInfoRecord::getType,timeRequest.getType()); |
| | | } |
| | | // 2.0其他记录 |
| | | List<TCourseInfoRecord> list = courseInfoRecordService.list(eq); |
| | | List<PurchaseRecordVo> list1=new ArrayList<>(); |
| | | for (TCourseInfoRecord tCourseInfoRecord : list) { |
| | | PurchaseRecordVo purchaseRecordVo = new PurchaseRecordVo(); |
| | | purchaseRecordVo.setPurchaseTime(new SimpleDateFormat("MM-dd HH:mm").format(tCourseInfoRecord.getTime())); |
| | | purchaseRecordVo.setPurchaseType(tCourseInfoRecord.getName()); |
| | | if(tCourseInfoRecord.getType()==1){ |
| | | purchaseRecordVo.setPurchaseAmount("+"+tCourseInfoRecord.getNum()); |
| | | }else { |
| | | purchaseRecordVo.setPurchaseAmount("-"+tCourseInfoRecord.getNum()); |
| | | } |
| | | list1.add(purchaseRecordVo); |
| | | } |
| | | purchaseRecordVoList.addAll(list1); |
| | | |
| | | if (purchaseRecordVoList.size() > 0 ){ |
| | | purchaseRecordVoList = purchaseRecordVoList.stream() |
| | | .filter(record -> { |
| | | String fieldValue = record.getPurchaseAmount(); |
| | | if (ToolUtil.isNotEmpty(timeRequest.getType())){ |
| | | switch (timeRequest.getType()){ |
| | | case 1: |
| | | return fieldValue != null && !fieldValue.isEmpty() && fieldValue.charAt(0) == '-'; |
| | | case 2: |
| | | return fieldValue != null && !fieldValue.isEmpty() && fieldValue.charAt(0) == '+'; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | return false; |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | purchaseRecordVoList = dealDataOfTime(purchaseRecordVoList); |
| | | return purchaseRecordVoList; |
| | | // |
| | | // Date monthStart = null; |
| | | // Date monthEnd = null; |
| | | // if (StringUtils.hasText(time)) { |
| | | // monthStart = DateTimeHelper.getCurrentIdetMouthStart(time); |
| | | // monthEnd = DateTimeHelper.getCurrentIdeaMouthEnd(time); |
| | | // } else { |
| | | // monthStart = DateTimeHelper.getCurrentMouthStart(); |
| | | // monthEnd = DateTimeHelper.getCurrentMouthEnd(); |
| | | // } |
| | | // |
| | | // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM"); |
| | | // Date startTime = DateTimeHelper.getCurrentIdetMouthStart(simpleDateFormat.format(monthStart)); |
| | | // Date endTime = DateTimeHelper.getCurrentIdeaMouthEnd(simpleDateFormat.format(monthEnd)); |
| | | // GetStuSourseList getStuSourseList = new GetStuSourseList(); |
| | | // getStuSourseList.setStartTime(startTime); |
| | | // getStuSourseList.setEndTime(endTime); |
| | | // getStuSourseList.setAppUserId(appUserId); |
| | | // // 报名赛事 |
| | | // List<PurchaseRecordVo> stuSourseList = dcttClient.getStuSourseList1(getStuSourseList); |
| | | // purchaseRecordVoList.addAll(stuSourseList); |
| | | // |
| | | // GetStuSessionList sessionList = new GetStuSessionList(); |
| | | // sessionList.setStartTime(startTime); |
| | | // sessionList.setEndTime(endTime); |
| | | // sessionList.setStuId(timeRequest.getStuId()); |
| | | // sessionList.setAppUserId(appUserId); |
| | | // List<PurchaseRecordVo> cancelCourseList = cancelcClient.getCancelCourseList(sessionList); |
| | | // |
| | | // purchaseRecordVoList.addAll(cancelCourseList); |
| | | // GetStuSessionList getStuSessionList = new GetStuSessionList(); |
| | | // getStuSessionList.setStartTime(startTime); |
| | | // getStuSessionList.setEndTime(endTime); |
| | | // getStuSessionList.setStuId(timeRequest.getStuId()); |
| | | // getStuSessionList.setAppUserId(appUserId); |
| | | // // 购买课包 |
| | | // List<PurchaseRecordVo> purchaseRecordVos = sessionNameClient.queryCourseDetails(getStuSessionList); |
| | | // purchaseRecordVoList.addAll(purchaseRecordVos); |
| | | // List<TAppUser> tAppUsers = tauMapper.selectList(new QueryWrapper<TAppUser>() |
| | | // .eq("referralUserId",appUserId ) |
| | | // .between("insertTime",startTime ,endTime)); |
| | | // if (ToolUtil.isNotEmpty(tAppUsers)){ |
| | | // List<Integer> userIds = tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | // IntrduceOfUserRequest request = new IntrduceOfUserRequest(); |
| | | // request.setStartTime(startTime); |
| | | // request.setEndTime(endTime); |
| | | // request.setUserIds(userIds); |
| | | // // 介绍有礼 |
| | | // List<PurchaseRecordVo> purchaseRecordVos1 = idrClient.queryAppUsersofIntroduce(request); |
| | | // purchaseRecordVoList.addAll(purchaseRecordVos1); |
| | | // } |
| | | // |
| | | // LambdaQueryWrapper<TCourseInfoRecord> eq = new LambdaQueryWrapper<TCourseInfoRecord>().eq(TCourseInfoRecord::getUserId, appUserId); |
| | | // if(timeRequest.getType()!=null){ |
| | | // eq.eq(TCourseInfoRecord::getType,timeRequest.getType()); |
| | | // } |
| | | // if (timeRequest.getLessionId()!=null){ |
| | | // eq.eq(TCourseInfoRecord::getCourseId,timeRequest.getLessionId()); |
| | | // |
| | | // } |
| | | // // 2.0其他记录 |
| | | // List<TCourseInfoRecord> list = courseInfoRecordService.list(eq); |
| | | // List<PurchaseRecordVo> list1=new ArrayList<>(); |
| | | // for (TCourseInfoRecord tCourseInfoRecord : list) { |
| | | // PurchaseRecordVo purchaseRecordVo = new PurchaseRecordVo(); |
| | | // purchaseRecordVo.setPurchaseTime(new SimpleDateFormat("MM-dd HH:mm").format(tCourseInfoRecord.getTime())); |
| | | // purchaseRecordVo.setPurchaseType(tCourseInfoRecord.getName()); |
| | | // if(tCourseInfoRecord.getType()==1){ |
| | | // purchaseRecordVo.setPurchaseAmount("+"+tCourseInfoRecord.getNum()); |
| | | // }else { |
| | | // purchaseRecordVo.setPurchaseAmount("-"+tCourseInfoRecord.getNum()); |
| | | // } |
| | | // list1.add(purchaseRecordVo); |
| | | // } |
| | | // purchaseRecordVoList.addAll(list1); |
| | | // |
| | | // if (purchaseRecordVoList.size() > 0 ){ |
| | | // purchaseRecordVoList = purchaseRecordVoList.stream() |
| | | // .filter(record -> { |
| | | // String fieldValue = record.getPurchaseAmount(); |
| | | // if (ToolUtil.isNotEmpty(timeRequest.getType())){ |
| | | // switch (timeRequest.getType()){ |
| | | // case 2: |
| | | // return fieldValue != null && !fieldValue.isEmpty() && fieldValue.charAt(0) == '-'; |
| | | // case 1: |
| | | // return fieldValue != null && !fieldValue.isEmpty() && fieldValue.charAt(0) == '+'; |
| | | // default: |
| | | // break; |
| | | // } |
| | | // } |
| | | // return true; |
| | | // }) |
| | | // .collect(Collectors.toList()); |
| | | // } |
| | | // |
| | | // purchaseRecordVoList = dealDataOfTime(purchaseRecordVoList); |
| | | return record1; |
| | | } |
| | | |
| | | @Override |
| | |
| | | if(coursePackagePayment.getPayStatus() == 2){ |
| | | break; |
| | | } |
| | | ResultUtil<Map<String, String>> resultUtil = payMoneyUtil.queryALIOrder(code); |
| | | if(resultUtil.getCode() == 200 && coursePackagePayment.getPayStatus() == 1){ |
| | | AlipayTradeQueryResponse resultUtil = payMoneyUtil.queryALIOrder(code); |
| | | |
| | | if(resultUtil.getCode().equals("10000") && coursePackagePayment.getPayStatus() == 1){ |
| | | /** |
| | | * WAIT_BUYER_PAY(交易创建,等待买家付款)、 |
| | | * TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、 |
| | | * TRADE_SUCCESS(交易支付成功)、 |
| | | * TRADE_FINISHED(交易结束,不可退款) |
| | | */ |
| | | Map<String, String> data1 = resultUtil.getData(); |
| | | String s = data1.get("tradeStatus"); |
| | | String tradeNo = data1.get("tradeNo"); |
| | | if("TRADE_CLOSED".equals(s) || "TRADE_FINISHED".equals(s) || num == 10){ |
| | | // Map<String, String> data1 = resultUtil.getData(); |
| | | // String s = data1.get("tradeStatus"); |
| | | // String tradeNo = data1.get("tradeNo"); |
| | | String tradeNo = resultUtil.getTradeNo(); |
| | | String tradeStatus = resultUtil.getTradeStatus(); |
| | | System.out.println("ssssss"+tradeStatus); |
| | | if("TRADE_CLOSED".equals(tradeStatus) || "TRADE_FINISHED".equals(tradeStatus) || num == 10){ |
| | | coursePackagePayment.setState(3); |
| | | couPayClient.delPaymentCoursePackage(coursePackagePayment.getId()); |
| | | break; |
| | | } |
| | | if("TRADE_SUCCESS".equals(s)){ |
| | | if("TRADE_SUCCESS".equals(tradeStatus)){ |
| | | coursePackagePayment.setPayStatus(2); |
| | | coursePackagePayment.setTotalClassHours(hour); |
| | | coursePackagePayment.setLaveClassHours(hour); |
| | | coursePackagePayment.setOrderNumber(tradeNo); |
| | | couPayClient.updatePaymentCoursePackage(coursePackagePayment); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | break; |
| | | } |
| | | if("WAIT_BUYER_PAY".equals(s)){ |
| | | if("WAIT_BUYER_PAY".equals(tradeStatus)){ |
| | | num++; |
| | | } |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<RecordAppoint> getAppointmentRecords(Integer stuId, Integer appUserId,Integer appointStatus,Integer timeType,String search) { |
| | | public List<RecordAppoint> getAppointmentRecords(Integer stuId, Integer appUserId,Integer appointStatus,Integer timeType,String search,Integer pageNum) { |
| | | WeeksOfCourseRest courseRest = new WeeksOfCourseRest(); |
| | | courseRest.setAppUserId(appUserId); |
| | | courseRest.setStuId(stuId); |
| | | courseRest.setPageNum(pageNum); |
| | | List<RecordAppoint> recordAppoints = couPayClient.obtainStudentClassDetailsData(courseRest); |
| | | if (recordAppoints.size() > 0) { |
| | | if (ToolUtil.isNotEmpty(appointStatus) && appointStatus != 0) { |
| | | if (appointStatus ==2){ |
| | | recordAppoints = recordAppoints.stream() |
| | | .filter(record -> record.getStatus().equals(3)) |
| | | .collect(Collectors.toList()); |
| | | }else if (appointStatus ==3){ |
| | | recordAppoints = recordAppoints.stream() |
| | | .filter(record -> record.getStatus().equals(4)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | else { |
| | | |
| | | recordAppoints = recordAppoints.stream() |
| | | .filter(record -> record.getStatus().equals(appointStatus)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | } |
| | | if (ToolUtil.isNotEmpty(search)) { |
| | | recordAppoints = recordAppoints.stream() |
| | |
| | | } |
| | | |
| | | if (ToolUtil.isNotEmpty(timeType) && timeType != 0) { |
| | | Date lastOfDate = DateUtil.getLastOfDate(); |
| | | // Date lastOfDate = DateUtil.getLastOfDate(); |
| | | Date lastOfDate = DateUtil.getDate(); |
| | | switch (timeType) { |
| | | case 1: |
| | | Date lastWeekStartDate = DateUtil.getLastWeekStartDate(); |
| | |
| | | .filter(record -> { |
| | | try { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | Date time = sdf.parse(record.getTimeFrame().substring(11)); |
| | | String substring = record.getTimeFrame().substring(11); |
| | | Date time = sdf.parse(substring); |
| | | return !time.before(lastWeekStartDate) && !time.after(lastOfDate); |
| | | } catch (ParseException e) { |
| | | return false; |
| | |
| | | detailsVo.setLon(store.getLon()); |
| | | detailsVo.setLat(store.getLat()); |
| | | detailsVo.setPhone(store.getPhone()); |
| | | detailsVo.setVenueList(steClient.getAppUserSiteList()); |
| | | detailsVo.setVenueList(steClient.getAppUserSiteList(storeId)); |
| | | List<StoreOfCourseVo> storeOfCourseList = culisClient.getStoreOfCourseList(storeId); |
| | | System.out.println(storeOfCourseList); |
| | | for (StoreOfCourseVo storeOfCourseVo : storeOfCourseList) { |
| | | if (storeOfCourseVo.getClassHours().equals("0")){ |
| | | storeOfCourseVo.setClassHours(null); |
| | | } |
| | | if (storeOfCourseVo.getClassStartTime().equals("-")){ |
| | | storeOfCourseVo.setClassStartTime(null); |
| | | } |
| | | } |
| | | detailsVo.setCourseVoList(storeOfCourseList); |
| | | return detailsVo; |
| | | } |
| | |
| | | return this.baseMapper.getGiftSelect(giftSearchDto); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> queryCom(Integer id) { |
| | | return this.baseMapper.queryCom(id); |
| | | } |
| | | |
| | | |
| | | } |