| | |
| | | import com.dsh.account.model.LoginSMSCodeVo; |
| | | import com.dsh.account.model.LoginWeChatVo; |
| | | import com.dsh.account.model.vo.classDetails.CourseVenue; |
| | | import com.dsh.account.model.vo.classDetails.ExerciseVideo; |
| | | import com.dsh.account.model.vo.classDetails.RegisteredCourse; |
| | | import com.dsh.account.model.vo.classDetails.WeekedCourse; |
| | | import com.dsh.account.model.vo.classDetails.classInsVo.ClassInfoVo; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | |
| | | public class TAppUserServiceImpl extends ServiceImpl<TAppUserMapper, TAppUser> implements TAppUserService { |
| | | |
| | | |
| | | @Resource |
| | | @Autowired |
| | | private TStudentMapper tsmapper; |
| | | |
| | | @Resource |
| | |
| | | @Autowired |
| | | private JwtTokenUtil jwtTokenUtil; |
| | | |
| | | @Resource |
| | | @Autowired |
| | | private CoursePaymentClient paymentClient; |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public ClassInfoVo queryUserOfStus(Integer id,String longitude,String latitude) { |
| | | public ClassInfoVo queryUserOfStus(Integer id,String latitude,String longitude) { |
| | | TAppUser tAppUser = this.baseMapper.selectById(id); |
| | | ClassInfoVo classInfoVo = new ClassInfoVo(); |
| | | if (ToolUtil.isNotEmpty(tAppUser)){ |
| | | List<TStudent> tStudents = tsmapper.selectList(new QueryWrapper<TStudent>() |
| | | .eq("appUserId",tAppUser.getId()) |
| | | .eq("state",1) |
| | | .eq("isDefault",1)); |
| | | ClassInfoVo classInfoVo = new ClassInfoVo(); |
| | | if (tStudents.size() > 0 ){ |
| | | TStudent tStudent = tStudents.get(0); |
| | | classInfoVo.setIsThere(1); |
| | |
| | | classInfoVo.setRemainingNums(remain); |
| | | |
| | | List<CourseOfStoreVo> storeOfCourses = paymentClient.getStoreOfCourses(); |
| | | classInfoVo.setWeekCourseList(dealDatas(storeOfCourses,longitude,latitude)); |
| | | |
| | | List<WeekedCourse> courses = new ArrayList<>(); |
| | | List<ExerciseVideo> videos = new ArrayList<>(); |
| | | |
| | | |
| | | |
| | | |
| | | if (storeOfCourses.size() > 0){ |
| | | Map<Integer, List<CourseOfStoreVo>> map = storeOfCourses.stream().collect(Collectors.groupingBy(CourseOfStoreVo::getStoreId)); |
| | | for (Map.Entry<Integer, List<CourseOfStoreVo>> integerListEntry : map.entrySet()) { |
| | | WeekedCourse weekedCourse = new WeekedCourse(); |
| | | |
| | | Integer key = integerListEntry.getKey(); |
| | | System.out.println(key); |
| | | List<CourseOfStoreVo> value = integerListEntry.getValue(); |
| | | System.out.println(value); |
| | | } |
| | | |
| | | } |
| | | // classInfoVo.setWeekCourseList(); |
| | | classInfoVo.setExerciseVideoList(videos); |
| | | }else { |
| | | classInfoVo.setIsThere(2); |
| | | List<TImgConfig> tImgConfigs = configClient.getNoneStuImgs(); |
| | |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | return classInfoVo; |
| | | } |
| | | |
| | | /** |
| | | * 处理数据 |
| | | * @param storeOfCourses |
| | | * @param longitude |
| | | * @param latitude |
| | | * @return |
| | | */ |
| | | public List<WeekedCourse> dealDatas(List<CourseOfStoreVo> storeOfCourses){ |
| | | public List<WeekedCourse> dealDatas(List<CourseOfStoreVo> storeOfCourses,String longitude ,String latitude){ |
| | | List<WeekedCourse> weekedCourses = new ArrayList<>(); |
| | | |
| | | int weekStr = LocalDateTimeUtils.getWeekStr(); |
| | | for (int i = 1; i < 8; i++) { |
| | | if (weekStr == i){ |
| | | for (CourseOfStoreVo storeOfCours : storeOfCourses) { |
| | | String[] split = storeOfCours.getClassWeeks().split(";"); |
| | | List<String> list = Arrays.asList(split); |
| | | if (list.contains(weekStr)){ |
| | | WeekedCourse weekedCourse = new WeekedCourse(); |
| | | weekedCourse.setIsToday(1); |
| | | weekedCourse.setWeekNum(weekStr); |
| | | weekedCourse.setWeekStr(WeeksEnum.getStr(weekStr)); |
| | | String weekOfDays = LocalDateTimeUtils.getWeekOfDays(weekStr); |
| | | weekedCourse.setDayStr(weekOfDays); |
| | | |
| | | List<CourseVenue> courseVenues = new ArrayList<>(); |
| | | // courseVenues.add(); |
| | | weekedCourse.setDetails(courseVenues); |
| | | } |
| | | } |
| | | }else { |
| | | for (CourseOfStoreVo storeOfCours : storeOfCourses) { |
| | | String[] split = storeOfCours.getClassWeeks().split(";"); |
| | | List<String> list = Arrays.asList(split); |
| | | if (list.contains(i)){ |
| | | WeekedCourse weekedCourse = new WeekedCourse(); |
| | | weekedCourse.setIsToday(1); |
| | | weekedCourse.setWeekNum(weekStr); |
| | | weekedCourse.setWeekStr(WeeksEnum.getStr(weekStr)); |
| | | String weekOfDays = LocalDateTimeUtils.getWeekOfDays(weekStr); |
| | | weekedCourse.setDayStr(weekOfDays); |
| | | |
| | | } |
| | | } |
| | | WeekedCourse weekedCourse = new WeekedCourse(); |
| | | weekedCourse.setWeekNum(i); |
| | | weekedCourse.setWeekStr(WeeksEnum.getStr(i)); |
| | | String weekOfDays = LocalDateTimeUtils.getWeekOfDays(i); |
| | | weekedCourse.setDayStr(weekOfDays); |
| | | List<CourseVenue> courseVenues = new ArrayList<>(); |
| | | if (weekStr == i) { |
| | | weekedCourse.setIsToday(1); |
| | | } else { |
| | | weekedCourse.setIsToday(2); |
| | | } |
| | | Map<Integer, List<CourseOfStoreVo>> map = storeOfCourses.stream().collect(Collectors.groupingBy(CourseOfStoreVo::getStoreId)); |
| | | for (Map.Entry<Integer, List<CourseOfStoreVo>> integerListEntry : map.entrySet()) { |
| | | List<CourseOfStoreVo> value = integerListEntry.getValue(); |
| | | CourseVenue courseVenue = new CourseVenue(); |
| | | courseVenue.setStoreId(value.get(0).getStoreId()); |
| | | courseVenue.setAreaName(value.get(0).getStoreName()); |
| | | courseVenue.setSiteDistance(LonlatUtils.distance(Double.parseDouble(longitude), Double.parseDouble(latitude), |
| | | Double.parseDouble(value.get(0).getLon()), Double.parseDouble(value.get(0).getLat())) + ""); |
| | | |
| | | List<CourseVenue.CouList> courses = new ArrayList<>(); |
| | | for (CourseOfStoreVo courseOfStoreVo : value) { |
| | | CourseVenue.CouList couList = new CourseVenue.CouList(); |
| | | couList.setCourseID(courseOfStoreVo.getCourseId()); |
| | | couList.setCourseName(courseOfStoreVo.getCourseName()); |
| | | couList.setTimeStr(courseOfStoreVo.getClassStartTime() + "-" + courseOfStoreVo.getClassEndTime()); |
| | | couList.setDetail(""); |
| | | courses.add(couList); |
| | | } |
| | | courseVenue.setCourses(courses); |
| | | courseVenues.add(courseVenue); |
| | | } |
| | | weekedCourse.setDetails(courseVenues); |
| | | weekedCourses.add(weekedCourse); |
| | | } |
| | | return weekedCourses; |
| | | } |