| | |
| | | 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.entity.Coach; |
| | | import com.dsh.account.entity.TAppUser; |
| | | import com.dsh.account.entity.TStudent; |
| | | import com.dsh.account.dto.*; |
| | | import com.dsh.account.entity.*; |
| | | import com.dsh.account.feignclient.activity.IntroduceRewardsClient; |
| | | import com.dsh.account.feignclient.activity.UserConponClient; |
| | | import com.dsh.account.feignclient.activity.model.IntrduceOfUserRequest; |
| | |
| | | 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.exploreDetail.LonLatRequest; |
| | | import com.dsh.account.model.vo.exploreDetail.QuestionIns; |
| | | import com.dsh.account.model.vo.exploreDetail.StoreDetailsVo; |
| | | import com.dsh.account.model.vo.exploreDetail.StoreOfCourseVo; |
| | | 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 org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | @Resource |
| | | private CourseListClient culisClient; |
| | | |
| | | @Autowired |
| | | private TCourseInfoRecordService courseInfoRecordService; |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | 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); |
| | | |
| | | //同步信息到参赛人员信息中 |
| | |
| | | getStuSourseList.setStartTime(startTime); |
| | | getStuSourseList.setEndTime(endTime); |
| | | getStuSourseList.setAppUserId(appUserId); |
| | | // 报名赛事 |
| | | List<PurchaseRecordVo> stuSourseList = dcttClient.getStuSourseList(getStuSourseList); |
| | | purchaseRecordVoList.addAll(stuSourseList); |
| | | |
| | |
| | | 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>() |
| | |
| | | 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() |
| | |
| | | packagePayment.setInsertTime(new Date()); |
| | | couPayClient.savePaymentCoursePackage(packagePayment); |
| | | |
| | | Integer hour = couPayClient.getClassHour(request.getCourseConfigId()); |
| | | |
| | | try { |
| | | switch (request.getPayType()) { |
| | | case 1: |
| | | return WeChatPayment(code,request.getPayAmount()); |
| | | return WeChatPayment(code,request.getPayAmount(),hour); |
| | | case 2: |
| | | return AlipayPayment(code,request.getPayAmount()); |
| | | return AlipayPayment(code,request.getPayAmount(),hour); |
| | | case 3: |
| | | int i = PlaypaiGoldPayment(code,request); |
| | | switch (i){ |
| | |
| | | } |
| | | |
| | | |
| | | public ResultUtil WeChatPayment(String code,BigDecimal amount) throws Exception { |
| | | public ResultUtil WeChatPayment(String code,BigDecimal amount,Integer hour) throws Exception { |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("课包续费", "", code, amount.toString(), |
| | | "/base/coursePackage/wechatPaymentCallback", "APP", ""); |
| | | if(weixinpay.getCode() == 200){ |
| | |
| | | } |
| | | if("SUCCESS".equals(s)){ |
| | | coursePackagePayment.setPayStatus(2); |
| | | coursePackagePayment.setTotalClassHours(hour); |
| | | coursePackagePayment.setLaveClassHours(hour); |
| | | coursePackagePayment.setOrderNumber(transaction_id); |
| | | couPayClient.updatePaymentCoursePackage(coursePackagePayment); |
| | | break; |
| | |
| | | return weixinpay; |
| | | } |
| | | |
| | | public ResultUtil AlipayPayment(String code,BigDecimal amount){ |
| | | public ResultUtil AlipayPayment(String code,BigDecimal amount,Integer hour){ |
| | | ResultUtil alipay = payMoneyUtil.alipay("课包续费", "课包续费", "", code, amount.toString(), |
| | | "/base/coursePackage/alipayPaymentCallback"); |
| | | if(alipay.getCode() == 200){ |
| | |
| | | } |
| | | if("TRADE_SUCCESS".equals(s)){ |
| | | coursePackagePayment.setPayStatus(2); |
| | | coursePackagePayment.setTotalClassHours(hour); |
| | | coursePackagePayment.setLaveClassHours(hour); |
| | | coursePackagePayment.setOrderNumber(tradeNo); |
| | | couPayClient.updatePaymentCoursePackage(coursePackagePayment); |
| | | break; |
| | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param stuId 学员id |
| | | * @param appUserId 用户id |
| | | * @param appointStatus 预约状态 0=全部 1=待上课 2=已完成 3=已取消 |
| | | * @param timeType 时间类型 0=全部 1=近一周 2=近一个月 3=近一年 |
| | | * @param search 课程名称 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public AppointmentRecordVo getAppointmentRecords(Integer stuId, Integer appUserId,Integer appointStatus,Integer timeType,String search) { |
| | | AppointmentRecordVo recordVo = new AppointmentRecordVo(); |
| | | TStudent tStudent = this.baseMapper.selectOne(new QueryWrapper<TStudent>() |
| | | .eq("id",stuId ) |
| | | .eq("appUserId",appUserId)); |
| | | if (ToolUtil.isNotEmpty(tStudent)){ |
| | | recordVo.setStuId(tStudent.getId()); |
| | | recordVo.setStuName(tStudent.getName()); |
| | | WeeksOfCourseRest courseRest = new WeeksOfCourseRest(); |
| | | courseRest.setAppUserId(appUserId); |
| | | courseRest.setStuId(stuId); |
| | | List<RecordAppoint> recordAppoints = couPayClient.obtainStudentClassDetailsData(courseRest); |
| | | if (ToolUtil.isEmpty(appointStatus)){ |
| | | recordVo.setAppointStatus(0); |
| | | }else { |
| | | recordVo.setAppointStatus(appointStatus); |
| | | if (recordAppoints.size() > 0 ){ |
| | | public List<RecordAppoint> getAppointmentRecords(Integer stuId, Integer appUserId,Integer appointStatus,Integer timeType,String search) { |
| | | WeeksOfCourseRest courseRest = new WeeksOfCourseRest(); |
| | | courseRest.setAppUserId(appUserId); |
| | | courseRest.setStuId(stuId); |
| | | List<RecordAppoint> recordAppoints = couPayClient.obtainStudentClassDetailsData(courseRest); |
| | | if (recordAppoints.size() > 0) { |
| | | if (ToolUtil.isNotEmpty(appointStatus) && appointStatus != 0) { |
| | | recordAppoints = recordAppoints.stream() |
| | | .filter(record -> record.getStatus().equals(appointStatus)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | } |
| | | if (ToolUtil.isNotEmpty(search)){ |
| | | recordVo.setAppointStatus(appointStatus); |
| | | if (recordAppoints.size() > 0 ){ |
| | | if (ToolUtil.isNotEmpty(search)) { |
| | | recordAppoints = recordAppoints.stream() |
| | | .filter(record -> record.getCoursePackageName().contains(search)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | } |
| | | if (ToolUtil.isNotEmpty(timeType)){ |
| | | |
| | | if (ToolUtil.isNotEmpty(timeType) && timeType != 0) { |
| | | Date lastOfDate = DateUtil.getLastOfDate(); |
| | | switch (timeType){ |
| | | switch (timeType) { |
| | | case 1: |
| | | Date lastWeekStartDate = DateUtil.getLastWeekStartDate(); |
| | | if (recordAppoints.size() > 0 ){ |
| | | recordAppoints = recordAppoints.stream() |
| | | .filter(record -> { |
| | | try { |
| | |
| | | } |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | break; |
| | | case 2: |
| | | Date lastMonthStartDate = DateUtil.getLastMonthStartDate(); |
| | | if (recordAppoints.size() > 0 ){ |
| | | recordAppoints = recordAppoints.stream() |
| | | .filter(record -> { |
| | | try { |
| | |
| | | } |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | break; |
| | | case 3: |
| | | Date lastYearStartDate = DateUtil.getLastYearStartDate(); |
| | | if (recordAppoints.size() > 0 ){ |
| | | recordAppoints = recordAppoints.stream() |
| | | .filter(record -> { |
| | | try { |
| | |
| | | } |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | break; |
| | | default: |
| | | break; |
| | | |
| | | } |
| | | } |
| | | recordVo.setAppointList(recordAppoints); |
| | | } |
| | | return recordVo; |
| | | return recordAppoints; |
| | | } |
| | | |
| | | @Override |
| | |
| | | Store store = storeClient.queryStoreById(storeId); |
| | | StoreDetailsVo detailsVo = new StoreDetailsVo(); |
| | | String realPicture = store.getRealPicture(); |
| | | String[] split = realPicture.split(","); |
| | | detailsVo.setImages(Arrays.asList(split)); |
| | | if (ToolUtil.isNotEmpty(realPicture)){ |
| | | String[] split = realPicture.split(","); |
| | | detailsVo.setImages(Arrays.asList(split)); |
| | | } |
| | | detailsVo.setStoreId(store.getId()); |
| | | detailsVo.setStoreName(store.getName()); |
| | | detailsVo.setStoreAddress(store.getAddress()); |
| | |
| | | detailsVo.setLat(store.getLat()); |
| | | detailsVo.setPhone(store.getPhone()); |
| | | detailsVo.setVenueList(steClient.getAppUserSiteList()); |
| | | detailsVo.setCourseVoList(culisClient.getStoreOfCourseList(storeId)); |
| | | List<StoreOfCourseVo> storeOfCourseList = culisClient.getStoreOfCourseList(storeId); |
| | | System.out.println(storeOfCourseList); |
| | | detailsVo.setCourseVoList(storeOfCourseList); |
| | | return detailsVo; |
| | | } |
| | | |
| | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | | public List<TStudentDto> listAll(StudentSearch search) { |
| | | return this.baseMapper.selectAll(search); |
| | | } |
| | | |
| | | @Override |
| | | public TStudentDto listOne(Integer id) { |
| | | return this.baseMapper.selectWebOne(id); |
| | | } |
| | | |
| | | @Override |
| | | public void createHistory(CreateHistoryDto createHistoryDto) { |
| | | this.baseMapper.createHistory(createHistoryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<GetHistoryDto> getHistory() { |
| | | return this.baseMapper.getHistory(); |
| | | } |
| | | |
| | | @Override |
| | | public Integer getGiftSelect(GiftSearchDto giftSearchDto) { |
| | | return this.baseMapper.getGiftSelect(giftSearchDto); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |