From aa43a92c7ec9053dbaef92fe5ccb3011b670442c Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期三, 12 七月 2023 11:46:21 +0800 Subject: [PATCH] 更新线上视频奖励模块接口 --- cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java | 330 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 280 insertions(+), 50 deletions(-) diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java index 5be7f68..4ab69ac 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java +++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java @@ -2,27 +2,48 @@ 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.feignclient.activity.IntroduceRewardsClient; +import com.dsh.account.feignclient.activity.UserConponClient; +import com.dsh.account.feignclient.activity.model.IntrduceOfUserRequest; import com.dsh.account.feignclient.competition.DeductionCompetitionsClient; +import com.dsh.account.feignclient.competition.ParticipantClient; +import com.dsh.account.feignclient.competition.model.GetStuSourseList; import com.dsh.account.feignclient.competition.model.PurchaseRecordVo; +import com.dsh.account.feignclient.competition.model.SaveParticipant; import com.dsh.account.feignclient.course.CancelListClient; import com.dsh.account.feignclient.course.CoursePaymentClient; import com.dsh.account.feignclient.course.CourseRecordClient; import com.dsh.account.feignclient.course.CourseSessionNameClient; -import com.dsh.account.feignclient.course.model.StuSessionDetailsVo; -import com.dsh.account.feignclient.course.model.StuWithCoursesListVo; +import com.dsh.account.feignclient.course.model.*; +import com.dsh.account.feignclient.other.NoticeClient; +import com.dsh.account.feignclient.other.QuestionClient; +import com.dsh.account.feignclient.other.StoreClient; +import com.dsh.account.feignclient.other.model.*; +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.ClasspaymentRequest; import com.dsh.account.model.vo.classDetails.classInsVo.ClassDetailsInsVo; import com.dsh.account.model.vo.classDetails.classInsVo.StuDetailsReq; +import com.dsh.account.model.vo.classDetails.classInsVo.StuListVo; +import com.dsh.account.model.vo.exploreDetail.ExploreDatasVo; +import com.dsh.account.model.vo.exploreDetail.LonLatRequest; +import com.dsh.account.model.vo.exploreDetails.QuestionDetailsVo; +import com.dsh.account.model.vo.exploreDetails.QuestionIns; +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.service.TStudentService; import com.dsh.account.util.DateTimeHelper; +import com.dsh.account.util.DateUtil; +import com.dsh.account.util.ResultUtil; import com.dsh.account.util.ToolUtil; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -40,26 +61,47 @@ @Service public class TStudentServiceImpl extends ServiceImpl<TStudentMapper, TStudent> implements TStudentService { - @Autowired + @Resource private CourseSessionNameClient sessionNameClient; - @Autowired + @Resource private DeductionCompetitionsClient dcttClient; - @Autowired + @Resource private CancelListClient cancelcClient; - @Autowired + @Resource private IntroduceRewardsClient idrClient; - @Autowired + @Resource private CourseRecordClient crClient; - @Autowired + @Resource private CoursePaymentClient couPayClient; - @Autowired + @Resource + private UserConponClient userCClient; + + @Resource + private StoreClient storeClient; + + @Resource + private NoticeClient noClient; + + @Resource + private QuestionClient quesClient; + + @Resource private TAppUserMapper tauMapper; + + @Resource + private CoachMapper coachMapper; + + @Resource + private ParticipantClient participantClient; + + + @Override public void addStuOfAppUser(StuDetailsReq stu,Integer appUserId) { @@ -80,6 +122,18 @@ student.setInsertTime(new Date()); student.setState(1); this.baseMapper.insert(student); + + //同步信息到参赛人员信息中 + SaveParticipant saveParticipant = new SaveParticipant(); + saveParticipant.setAppUserId(appUserId); + saveParticipant.setName(student.getName()); + saveParticipant.setBirthday(student.getBirthday()); + saveParticipant.setGender(student.getSex()); + saveParticipant.setHeight(student.getHeight().intValue()); + saveParticipant.setWeight(student.getWeight()); + saveParticipant.setPhone(student.getPhone()); + saveParticipant.setIdcard(student.getIdCard()); + participantClient.saveParticipant(saveParticipant); } @Override @@ -87,7 +141,12 @@ ClassDetailsInsVo insVo = new ClassDetailsInsVo(); Date localMonthStart = DateTimeHelper.getCurrentMouthStart(); Date localMonthEnd = DateTimeHelper.getCurrentMouthEnd(); - List<StuSessionDetailsVo> stuSessionList = sessionNameClient.getStuSessionList(localMonthStart,localMonthEnd,stuId,userIdFormRedis); + GetStuSessionList getStuSessionList = new GetStuSessionList(); + getStuSessionList.setStartTime(localMonthStart); + getStuSessionList.setEndTime(localMonthEnd); + getStuSessionList.setStuId(stuId); + getStuSessionList.setAppUserId(userIdFormRedis); + List<StuSessionDetailsVo> stuSessionList = sessionNameClient.getStuSessionList(getStuSessionList); TStudent tStudent = this.baseMapper.selectById(stuId); if (ToolUtil.isNotEmpty(tStudent)){ insVo.setStuId(tStudent.getId()); @@ -95,30 +154,201 @@ insVo.setStuImage(tStudent.getHeadImg()); List<PurchaseRecordVo> purchaseRecordVoList = new ArrayList<>(); - - List<PurchaseRecordVo> stuSourseList = dcttClient.getStuSourseList(localMonthStart,localMonthEnd,userIdFormRedis); + GetStuSourseList getStuSourseList = new GetStuSourseList(); + getStuSourseList.setStartTime(localMonthStart); + getStuSourseList.setEndTime(localMonthEnd); + getStuSourseList.setAppUserId(userIdFormRedis); + List<PurchaseRecordVo> stuSourseList = dcttClient.getStuSourseList(getStuSourseList); purchaseRecordVoList.addAll(stuSourseList); - List<PurchaseRecordVo> cancelCourseList = cancelcClient.getCancelCourseList(localMonthStart,localMonthEnd,stuId,userIdFormRedis); + + GetStuSessionList sessionList = new GetStuSessionList(); + sessionList.setStartTime(localMonthStart); + sessionList.setEndTime(localMonthEnd); + sessionList.setStuId(stuId); + sessionList.setAppUserId(userIdFormRedis); + List<PurchaseRecordVo> cancelCourseList = cancelcClient.getCancelCourseList(sessionList); + purchaseRecordVoList.addAll(cancelCourseList); - List<PurchaseRecordVo> purchaseRecordVos = sessionNameClient.queryCourseDetails(localMonthStart,localMonthEnd,stuId,userIdFormRedis); + List<PurchaseRecordVo> purchaseRecordVos = sessionNameClient.queryCourseDetails(getStuSessionList); purchaseRecordVoList.addAll(purchaseRecordVos); List<TAppUser> tAppUsers = tauMapper.selectList(new QueryWrapper<TAppUser>() .eq("referralUserId",userIdFormRedis ) .between("insertTime",localMonthStart ,localMonthEnd)); List<Integer> userIds = tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList()); - List<PurchaseRecordVo> purchaseRecordVos1 = idrClient.queryAppUsersofIntroduce(localMonthStart, localMonthEnd, userIds); + IntrduceOfUserRequest request = new IntrduceOfUserRequest(); + request.setStartTime(localMonthStart); + request.setEndTime(localMonthEnd); + request.setUserIds(userIds); + List<PurchaseRecordVo> purchaseRecordVos1 = idrClient.queryAppUsersofIntroduce(request); purchaseRecordVoList.addAll(purchaseRecordVos1); insVo.setSessionNames(stuSessionList); insVo.setDetails(dealDataOfTime(purchaseRecordVoList)); - StuWithCoursesListVo stuOfCoursesDetails = couPayClient.getStuOfCoursesDetails(stuId, userIdFormRedis); + GetStuOfCoursesDetails getStuOfCoursesDetails = new GetStuOfCoursesDetails(); + getStuOfCoursesDetails.setStuId(stuId); + getStuOfCoursesDetails.setAppUserId(userIdFormRedis); + StuWithCoursesListVo stuOfCoursesDetails = couPayClient.getStuOfCoursesDetails(getStuOfCoursesDetails); insVo.setTotalNums(stuOfCoursesDetails.getTotalNums()); insVo.setDeductedNums(stuOfCoursesDetails.getDeductedNums()); insVo.setRemainingNums(stuOfCoursesDetails.getRemainingNums()); - Integer deductionClassHour = crClient.getDeductionClassHour(lessonId, stuId, userIdFormRedis); + GetStudentCourse course = new GetStudentCourse(); + course.setCourseId(lessonId); + course.setStuId(stuId); + course.setAppUserId(userIdFormRedis); + Integer deductionClassHour = crClient.getDeductionClassHour(course); insVo.setDeductionClassHours(deductionClassHour); } return insVo; + } + + @Override + public List<PurchaseRecordVo> queryDeduRecordDetails(RecordTimeRequest timeRequest,Integer appUserId) { + List<PurchaseRecordVo> purchaseRecordVoList = new ArrayList<>(); + Date startTime = DateTimeHelper.getCurrentIdetMouthStart(timeRequest.getStartTime()); + Date endTime = DateTimeHelper.getCurrentIdeaMouthEnd(timeRequest.getEndTime()); + GetStuSourseList getStuSourseList = new GetStuSourseList(); + getStuSourseList.setStartTime(startTime); + getStuSourseList.setEndTime(endTime); + getStuSourseList.setAppUserId(appUserId); + List<PurchaseRecordVo> stuSourseList = dcttClient.getStuSourseList(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)); + 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); + + purchaseRecordVoList = dealDataOfTime(purchaseRecordVoList); + return purchaseRecordVoList; + } + + @Override + public List<CouponStuAvailableVo> queryStuOfConponDetails(Integer appUserId) { + List<CouponStuAvailableVo> availableVos = new ArrayList<>(); + availableVos = userCClient.queryUserWithConponList(appUserId); + return availableVos; + } + + @Override + public CourseDetailsOfContinuationResp queryStuOfCourseDetails(Integer lessonId, Integer stuId, Integer appUserId) { + CourseDetailsOfContinuationResp resp = new CourseDetailsOfContinuationResp(); + + GetStudentCourse getStudentCourse = new GetStudentCourse(); + getStudentCourse.setCourseId(lessonId); + getStudentCourse.setStuId(stuId); + getStudentCourse.setAppUserId(appUserId); + StudentOfCourseVo studentCourse = couPayClient.getStudentCourse(getStudentCourse); + resp.setCoursePackageId(studentCourse.getCoursePackageId()); + resp.setStuId(stuId); + resp.setPackageImg(studentCourse.getPackageImg()); + resp.setCourseName(studentCourse.getCourseName()); + Coach coach = coachMapper.selectById(studentCourse.getCoachId()); + resp.setTeacherName(coach.getName()); + resp.setCourseWeek(studentCourse.getCourseWeek()); + resp.setCourseTime(studentCourse.getCourseTime()); + + StoreDetailOfCourse courseOfStore = storeClient.getCourseOfStore(studentCourse.getStoreId()); + resp.setStoreName(courseOfStore.getStoreName()); + resp.setStoreAddr(courseOfStore.getStoreAddr()); + + resp.setTypeList(studentCourse.getTypeList()); + TStudent tStudent = this.baseMapper.selectById(stuId); + resp.setStuName(tStudent.getName()); + resp.setStuPhone(tStudent.getPhone()); + resp.setStuAge(DateUtil.age(tStudent.getBirthday())); + resp.setAmount(studentCourse.getAmount()); + resp.setVipAmount(studentCourse.getVipAmount()); + resp.setWpGold(studentCourse.getWpGold()); + return resp; + } + + @Override + public List<SysNotice> querySystemNoticeDetails() { + return noClient.getSysNoticeDetails(); + } + + @Override + public SysNotice queryNoticeData(Integer noId) { + return noClient.getSysNoticeBuId(noId); + } + + @Override + public QuestionDetailsVo queryQuestionData() { + return quesClient.getSysQuestionDetails(); + } + + @Override + public QuestionIns queryQuestionDataInfo(Integer quesId) { + return quesClient.getSysQuestionBuId(quesId); + } + + @Override + public List<String> queryCustomerDetails() { + return noClient.queryCustomerTel(); + } + + @Override + public ExploreDatasVo queryIndexOfExplores(LonLatRequest llrequest) { + ExploreDatasVo datasVo = new ExploreDatasVo(); + GetAllNearbyStoreList getAllNearbyStoreList = new GetAllNearbyStoreList(); + getAllNearbyStoreList.setLongitude(llrequest.getLongitude()); + getAllNearbyStoreList.setLatitude(llrequest.getLatitude()); + List<StoreInfo> allNearbyStoreList = storeClient.getAllNearbyStoreList(getAllNearbyStoreList); + List<StoreLonLatList> allStoreLonLats = storeClient.getAllStoreLonLats(getAllNearbyStoreList); + datasVo.setStoreLists(allNearbyStoreList); + datasVo.setLonLatLists(allStoreLonLats); + return datasVo; + } + + @Override + public List<StuListVo> switchStudentActions(Integer appUserId, Integer stuId) { + List<StuListVo> stuListVos = new ArrayList<>(); + List<TStudent> tStudents = this.baseMapper.selectList(new QueryWrapper<TStudent>() + .eq("appUserId", appUserId) + .eq("state",1)); + if (tStudents.size() > 0) { + tStudents.forEach(sts -> { + if (Objects.equals(sts.getId(), stuId)) { + sts.setIsDefault(1); + } else { + sts.setIsDefault(2); + } + this.baseMapper.updateById(sts); + + StuListVo vo = new StuListVo(); + vo.setStuId(sts.getId()); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + vo.setBirthday(simpleDateFormat.format(sts.getBirthday())); + vo.setStuName(sts.getName()); + vo.setStuAge(DateUtil.age(sts.getBirthday())); + vo.setStuHeight(sts.getHeight()); + vo.setStuWeight(sts.getWeight()); + vo.setIsNot(sts.getIsDefault()); + stuListVos.add(vo); + }); + } + return stuListVos; } @@ -142,37 +372,37 @@ return purchaseRecords; } + @Override + public ResultUtil renewClassPayment(Integer userIdFormRedis, ClasspaymentRequest request) { + // TODO: 2023/7/5 续课支付 + switch (request.getPayType()){ + case 1: + WeChatPayment(); + break; + case 2: + AlipayPayment(); + break; + case 3: + PlaypaiGoldPayment(); + break; + default: + break; + } + return ResultUtil.success(); + } -// public static List<String> dealDataOfTime(List<String> timeStrings) { -// Collections.sort(timeStrings, new Comparator<String>() { -// @Override -// public int compare(String time1, String time2) { -// String[] parts1 = time1.split(" "); -// String[] parts2 = time2.split(" "); -// String[] dateParts1 = parts1[0].split("-"); -// String[] dateParts2 = parts2[0].split("-"); -// String[] timeParts1 = parts1[1].split(":"); -// String[] timeParts2 = parts2[1].split(":"); -// int month1 = Integer.parseInt(dateParts1[0]); -// int day1 = Integer.parseInt(dateParts1[1]); -// int hour1 = Integer.parseInt(timeParts1[0]); -// int minute1 = Integer.parseInt(timeParts1[1]); -// int month2 = Integer.parseInt(dateParts2[0]); -// int day2 = Integer.parseInt(dateParts2[1]); -// int hour2 = Integer.parseInt(timeParts2[0]); -// int minute2 = Integer.parseInt(timeParts2[1]); -// // 倒序排序 -// if (month1 != month2) { -// return month2 - month1; -// } else if (day1 != day2) { -// return day2 - day1; -// } else if (hour1 != hour2) { -// return hour2 - hour1; -// } else { -// return minute2 - minute1; -// } -// } -// }); -// return timeStrings; -// } + + public void WeChatPayment(){ + + } + + public void AlipayPayment(){ + + } + + public void PlaypaiGoldPayment(){ + + } + + } -- Gitblit v1.7.1