| | |
| | | import com.dsh.course.feignclient.account.AppUserClient; |
| | | import com.dsh.course.feignclient.account.CoachClient; |
| | | import com.dsh.course.feignclient.account.StudentClient; |
| | | import com.dsh.course.feignclient.account.model.AppUser; |
| | | import com.dsh.course.feignclient.account.model.Coach; |
| | | import com.dsh.course.feignclient.account.model.Student; |
| | | import com.dsh.course.feignclient.account.model.TCourseInfoRecord; |
| | | import com.dsh.course.feignclient.account.UserIntegralChangesClient; |
| | | import com.dsh.course.feignclient.account.model.*; |
| | | import com.dsh.course.feignclient.activity.BenefitVideoClient; |
| | | import com.dsh.course.feignclient.activity.CouponClient; |
| | | import com.dsh.course.feignclient.activity.model.BenefitsVideos; |
| | |
| | | @Autowired |
| | | private ICoursePackageSchedulingService coursePackageSchedulingService; |
| | | |
| | | |
| | | @Autowired |
| | | private RestTemplate internalRestTemplate; |
| | | |
| | | @Resource |
| | | private UserIntegralChangesClient userIntegralChangesClient; |
| | | |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public int changeState(CoursePackagePayDTO dto) { |
| | | List<String> ids = dto.getIds(); |
| | | List<Long> list = new ArrayList<>(); |
| | | for (String id : ids) { |
| | | long value = Long.parseLong(id); |
| | | list.add(value); |
| | | } |
| | | return cpConfigMapper.changeState(list, dto.getPayUserName(), dto.getUserId()); |
| | | |
| | | return cpConfigMapper.changeState(Long.valueOf(dto.getIds()), dto.getPayUserName(), dto.getUserId()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getStudentTotal(StudentQeryDto studentQeryDto) { |
| | | List<Map<String, Object>> studentTotal = this.baseMapper.getStudentTotal(studentQeryDto); |
| | | // String cityCode = studentQeryDto.getCityCode(); |
| | | // String start = studentQeryDto.getStart(); |
| | | // String end = studentQeryDto.getEnd(); |
| | | // //获取用户数据 |
| | | // List<Integer> appUserIds = null; |
| | | // if(ToolUtil.isNotEmpty(cityCode)){ |
| | | // List<AppUser> appUsers = appuClient.queryAppUserByCityCode(cityCode); |
| | | // if(appUsers.size() > 0){ |
| | | // appUserIds = appUsers.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | // } |
| | | // } |
| | | // QueryWrapper<CoursePackageStudent> status = new QueryWrapper<CoursePackageStudent>().eq("payStatus", 2).eq("status", 1); |
| | | // if(null != appUserIds){ |
| | | // status.in("appUserId", appUserIds); |
| | | // } |
| | | // List<Map<String, Object>> maps = this.baseMapper.getStudentTotal(appUserIds, studentQeryDto.getStart(), studentQeryDto.getEnd()); |
| | | // List<Map<String, Object>> list = new ArrayList<>(); |
| | | // for (Map<String, Object> objectMap : maps) { |
| | | // Integer studentId = Integer.valueOf(objectMap.get("studentId").toString()); |
| | | // Integer appUserId = Integer.valueOf(objectMap.get("appUserId").toString()); |
| | | // Integer coursePackageId = Integer.valueOf(objectMap.get("coursePackageId").toString()); |
| | | // Integer number = Integer.valueOf(objectMap.get("number").toString()); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // Student student = studentClient.queryStudentById(studentId); |
| | | // map.put("studentName", student.getName()); |
| | | // AppUser appUser = appuClient.queryAppUser(appUserId); |
| | | // map.put("province", appUser.getProvince()); |
| | | // map.put("provinceCode", appUser.getProvinceCode()); |
| | | // map.put("city", appUser.getCity()); |
| | | // map.put("cityCode", appUser.getCityCode()); |
| | | // TCoursePackage coursePackage = coursePackageService.getById(coursePackageId); |
| | | // map.put("courseName", coursePackage.getName()); |
| | | // map.put("totalClassHours", number); |
| | | // map.put("cashPayment", coursePackageOrder.getCashPayment()); |
| | | // map.put("hasHours", ) |
| | | // |
| | | // |
| | | // } |
| | | |
| | | for (Map<String, Object> student : studentTotal) { |
| | | Integer appUserId = (Integer) student.get("appUserId"); |
| | | AppUser appUser = appuClient.queryAppUser(appUserId); |
| | | student.put("province", appUser.getProvince()); |
| | | student.put("provinceCode", appUser.getProvinceCode()); |
| | | |
| | | student.put("city", appUser.getCity()); |
| | | student.put("cityCode", appUser.getCityCode()); |
| | | |
| | | Student studentId = studentClient.queryStudentById((Integer) student.get("studentId")); |
| | | student.put("studentName", studentId.getName()); |
| | | BigDecimal cashPayment = (BigDecimal) student.get("cashPayment"); |
| | | BigDecimal totalClassHours = (BigDecimal) student.get("totalClassHours"); |
| | | BigDecimal hasHours = (BigDecimal) student.get("hasHours"); |
| | | if (cashPayment == null) { |
| | | continue; |
| | | } |
| | | if (totalClassHours.compareTo(BigDecimal.ZERO) == 0) { |
| | | totalClassHours = totalClassHours.add(new BigDecimal("1")); |
| | | } |
| | | BigDecimal hasPayment = cashPayment.divide(totalClassHours, 2, RoundingMode.HALF_UP) |
| | | .multiply(hasHours).setScale(2, RoundingMode.HALF_UP); |
| | | student.put("hasPayment", hasPayment); |
| | | } |
| | | |
| | | if (studentQeryDto.getCityCode() != null && studentQeryDto.getCityCode() != "") { |
| | | String value = studentQeryDto.getCityCode(); |
| | | boolean allZeros = value.substring(value.length() - 4).endsWith("0000"); |
| | | System.out.println(allZeros); // Output: true |
| | | if (allZeros) { |
| | | Iterator<Map<String, Object>> iterator = studentTotal.iterator(); |
| | | while (iterator.hasNext()) { |
| | | Map<String, Object> student = iterator.next(); |
| | | String cityCode = (String) student.get("provinceCode"); |
| | | if (!cityCode.equals(studentQeryDto.getCityCode())) { |
| | | iterator.remove(); // Remove the element from the list |
| | | } |
| | | } |
| | | } else { |
| | | Iterator<Map<String, Object>> iterator = studentTotal.iterator(); |
| | | while (iterator.hasNext()) { |
| | | Map<String, Object> student = iterator.next(); |
| | | String cityCode = (String) student.get("cityCode"); |
| | | if (!cityCode.equals(studentQeryDto.getCityCode())) { |
| | | iterator.remove(); // Remove the element from the list |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (studentQeryDto.getStudentName() != null && studentQeryDto.getStudentName() != "") { |
| | | List<Map<String, Object>> totallike = new ArrayList<>(); |
| | | for (Map<String, Object> student : studentTotal) { |
| | | String studentName = (String) student.get("studentName"); |
| | | if (studentName.contains(studentQeryDto.getStudentName())) { |
| | | totallike.add(student); |
| | | } |
| | | |
| | | } |
| | | return totallike; |
| | | } |
| | | return studentTotal; |
| | | // List<Map<String, Object>> studentTotal = this.baseMapper.getStudentTotal(studentQeryDto); |
| | | // for (Map<String, Object> student : studentTotal) { |
| | | // Integer appUserId = (Integer) student.get("appUserId"); |
| | | // AppUser appUser = appuClient.queryAppUser(appUserId); |
| | | // student.put("province", appUser.getProvince()); |
| | | // student.put("provinceCode", appUser.getProvinceCode()); |
| | | // |
| | | // student.put("city", appUser.getCity()); |
| | | // student.put("cityCode", appUser.getCityCode()); |
| | | // |
| | | // Student studentId = studentClient.queryStudentById((Integer) student.get("studentId")); |
| | | // student.put("studentName", studentId.getName()); |
| | | // BigDecimal cashPayment = (BigDecimal) student.get("cashPayment"); |
| | | // BigDecimal totalClassHours = (BigDecimal) student.get("totalClassHours"); |
| | | // BigDecimal hasHours = (BigDecimal) student.get("hasHours"); |
| | | // if (cashPayment == null) { |
| | | // continue; |
| | | // } |
| | | // if (totalClassHours.compareTo(BigDecimal.ZERO) == 0) { |
| | | // totalClassHours = totalClassHours.add(new BigDecimal("1")); |
| | | // } |
| | | // BigDecimal hasPayment = cashPayment.divide(totalClassHours, 2, RoundingMode.HALF_UP) |
| | | // .multiply(hasHours).setScale(2, RoundingMode.HALF_UP); |
| | | // student.put("hasPayment", hasPayment); |
| | | // } |
| | | // |
| | | // if (studentQeryDto.getCityCode() != null && studentQeryDto.getCityCode() != "") { |
| | | // String value = studentQeryDto.getCityCode(); |
| | | // boolean allZeros = value.substring(value.length() - 4).endsWith("0000"); |
| | | // System.out.println(allZeros); // Output: true |
| | | // if (allZeros) { |
| | | // Iterator<Map<String, Object>> iterator = studentTotal.iterator(); |
| | | // while (iterator.hasNext()) { |
| | | // Map<String, Object> student = iterator.next(); |
| | | // String cityCode = (String) student.get("provinceCode"); |
| | | // if (!cityCode.equals(studentQeryDto.getCityCode())) { |
| | | // iterator.remove(); // Remove the element from the list |
| | | // } |
| | | // } |
| | | // } else { |
| | | // Iterator<Map<String, Object>> iterator = studentTotal.iterator(); |
| | | // while (iterator.hasNext()) { |
| | | // Map<String, Object> student = iterator.next(); |
| | | // String cityCode = (String) student.get("cityCode"); |
| | | // if (!cityCode.equals(studentQeryDto.getCityCode())) { |
| | | // iterator.remove(); // Remove the element from the list |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // if (studentQeryDto.getStudentName() != null && studentQeryDto.getStudentName() != "") { |
| | | // List<Map<String, Object>> totallike = new ArrayList<>(); |
| | | // for (Map<String, Object> student : studentTotal) { |
| | | // String studentName = (String) student.get("studentName"); |
| | | // if (studentName.contains(studentQeryDto.getStudentName())) { |
| | | // totallike.add(student); |
| | | // } |
| | | // |
| | | // } |
| | | // return totallike; |
| | | // } |
| | | // return studentTotal; |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public CourseOfVideoResponse queryVideoDetails(CourseWithDetailsRequest detailsRequest, Integer appUserId) { |
| | | CourseOfVideoResponse response = new CourseOfVideoResponse(); |
| | | // BenefitsVideos videosWithIds = bfvoClient.getVideosWithIds(detailsRequest.getVideoId()); |
| | | TCourse byId = courseService.getById(detailsRequest.getVideoId()); |
| | | TCoursePackage coursePackage = tcpmapper.selectById(detailsRequest.getCoursePackageId()); |
| | | CoursePackageScheduling byId1 = new CoursePackageScheduling(); |
| | |
| | | userVideoDetails.setState(2); |
| | | userVideoDetails.setUpdateTime(new Date()); |
| | | uvdmapper.updateById(userVideoDetails); |
| | | |
| | | CoursePackageScheduling coursePackageScheduling = coursePackageSchedulingService.getById(detailsRequest.getScId()); |
| | | //添加积分 |
| | | AppUser appUser = appuClient.queryAppUser(coursePackageScheduling.getAppUserId()); |
| | | appUser.setIntegral((null == appUser.getIntegral() ? 0 : appUser.getIntegral()) + (null == coursePackageScheduling.getIntegral() ? 0 : coursePackageScheduling.getIntegral())); |
| | | appuClient.updateAppUser(appUser); |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(coursePackageScheduling.getAppUserId()); |
| | | vo.setIntegral(coursePackageScheduling.getIntegral()); |
| | | vo.setType(4); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | return "SUCCESS"; |
| | | } |
| | | return "ERROR"; |
| | |
| | | AppUser appUser = appuClient.queryAppUser(appUserId); |
| | | CourseDetailsResponse response = new CourseDetailsResponse(); |
| | | CoursePackageOrder coursePackageOrder = coursePackageOrderService.getById(coursePayId); |
| | | if (coursePackageOrder==null){ |
| | | // student = coursePackageStudentService.getById(coursePayId); |
| | | CoursePackageOrderStudent student = coursePackageOrderStudentService.getById(coursePayId); |
| | | |
| | | coursePackageOrder = coursePackageOrderService.getOne(new QueryWrapper<CoursePackageOrder>().eq("appUserId", student.getAppUserId()).like("studentIds", student.getStudentId()).eq("coursePackageId", student.getCoursePackageId()).orderByDesc("insertTime").last("limit 1")); |
| | | |
| | | } |
| | | response.setOrinPrice(coursePackageOrder.getOriginalPrice()); |
| | | |
| | | |
| | | response.setChooseHours(coursePackageOrder.getClassHours()); |
| | | response.setStuIds(coursePackageOrder.getStudentIds().split(",")); |
| | | response.setPayType(coursePackageOrder.getPayType()); |
| | | response.setPayPrice(coursePackageOrder.getCashPayment()); |
| | | response.setCoinPrice(coursePackageOrder.getPlayPaiCoin()); |
| | | |
| | | if (null != coursePackageOrder) { |
| | | TCoursePackage coursePackage = tcpmapper.selectById(coursePackageOrder.getCoursePackageId()); |
| | |
| | | } |
| | | Store store = storeClient.queryStoreById(coursePackage.getStoreId()); |
| | | response.setStoreName(store.getName()); |
| | | response.setStoreAddress(store.getAddress()); |
| | | |
| | | if (ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)) { |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat()); |
| | |
| | | response.setIntroduceDrawing(coursePackage.getIntroduceDrawing()); |
| | | |
| | | Integer payType = coursePackageOrder.getPayType(); |
| | | if(null == payType){ |
| | | CoursePackagePaymentConfig config = coursePackagePaymentConfigService.list(new QueryWrapper<CoursePackagePaymentConfig>().eq("coursePackageId", coursePackage.getId()).orderByAsc("classHours")).get(0); |
| | | if (ToolUtil.isNotEmpty(config.getCashPayment()) && config.getCashPayment() > 0 && ToolUtil.isNotEmpty(config.getPlayPaiCoin()) && config.getPlayPaiCoin() > 0) { |
| | | payType = 3; |
| | | } else if (ToolUtil.isNotEmpty(config.getCashPayment()) && config.getCashPayment() > 0) { |
| | | payType = 1; |
| | | } else if (ToolUtil.isNotEmpty(config.getPlayPaiCoin()) && config.getPlayPaiCoin() > 0) { |
| | | payType = 2; |
| | | } |
| | | } |
| | | BigDecimal cashPayment = coursePackageOrder.getCashPayment(); |
| | | double cashPaymentValue = 0.0; |
| | | if (cashPayment != null) { |
| | |
| | | |
| | | switch (payType) { |
| | | case 1: |
| | | case 2: |
| | | case 3: |
| | | response.setAmount(cashPaymentValue); |
| | | response.setVipAmount(discountMember); |
| | | break; |
| | | case 3: |
| | | response.setWpGold(playPaiCoin); |
| | | case 2: |
| | | if (playPaiCoin!=null) { |
| | | response.setWpGold(playPaiCoin); |
| | | } |
| | | break; |
| | | } |
| | | |
| | |
| | | TCoursePackageDiscount discount = coursePackageDiscountService.getOne(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId()) |
| | | .eq("type", 2).eq("auditStatus", 2)); |
| | | |
| | | Double continuingMember = JSON.parseObject(discount.getContent()).getDouble("continuingUser"); |
| | | Double vipcontinuingMember = JSON.parseObject(discount.getContent()).getDouble("continuingMember"); |
| | | |
| | | |
| | | if (coursePackagePaymentConfigVo.getPaymentPrice() > continuingMember) { |
| | | coursePackagePaymentConfigVo.setPaymentPrice(continuingMember); |
| | | } |
| | | if (coursePackagePaymentConfigVo.getVipPrice() > vipcontinuingMember) { |
| | | coursePackagePaymentConfigVo.setVipPrice(vipcontinuingMember); |
| | | } |
| | | // Double continuingMember = JSON.parseObject(discount.getContent()).getDouble("continuingUser"); |
| | | // Double vipcontinuingMember = JSON.parseObject(discount.getContent()).getDouble("continuingMember"); |
| | | // |
| | | // |
| | | // if (coursePackagePaymentConfigVo.getPaymentPrice() > continuingMember) { |
| | | // coursePackagePaymentConfigVo.setPaymentPrice(continuingMember); |
| | | // } |
| | | // if (coursePackagePaymentConfigVo.getVipPrice() > vipcontinuingMember) { |
| | | // coursePackagePaymentConfigVo.setVipPrice(vipcontinuingMember); |
| | | // } |
| | | |
| | | |
| | | if (coursePackagePaymentConfigVo.getPaymentPrice() < coursePackagePaymentConfigVo.getVipPrice()) { |
| | |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | |
| | | if (coursePackage.getType()==1){ |
| | | list = this.baseMapper.queryRegistrationRecord(page, coursePackageId, userIds, studentIds);}else { |
| | | list = this.baseMapper.queryRegistrationRecord(page, coursePackageId, userIds, studentIds); |
| | | }else { |
| | | list = this.baseMapper.queryRegistrationRecord1(page, coursePackageId, userIds, studentIds); |
| | | } |
| | | |
| | | list.addAll(this.baseMapper.queryRegistrationRecord3(coursePackageId,userIds,studentIds)); |
| | | for (Map<String, Object> map : list) { |
| | | |
| | | |
| | | Long id = Long.valueOf(map.get("id").toString()); |
| | | Integer appUserId = Integer.valueOf(map.get("appUserId").toString()); |
| | |
| | | if (coursePackage.getType()==1) { |
| | | studentId = Integer.valueOf(map.get("studentId").toString()); |
| | | }else { |
| | | studentId = Integer.valueOf(map.get("studentIds").toString()); |
| | | studentId = Integer.valueOf(map.get("studentIds").toString().split(",")[0]); |
| | | } |
| | | |
| | | TAppUser appUser = appuClient.queryAppUser1(appUserId); |
| | |
| | | map.put("studentName", null != student ? student.getName() : ""); |
| | | Integer integer = cpsMapper.selectCount(new QueryWrapper<CoursePackageStudent>().eq("appUserId", appUserId) |
| | | .eq("studentId", studentId).eq("coursePackagePaymentId", id).eq("signInOrNot", 2)); |
| | | |
| | | int count = coursePackageStudentService.count(new QueryWrapper<CoursePackageStudent>().eq("coursePackageId", coursePackageId).eq("studentId", studentId).eq("signInOrNot",2)); |
| | | |
| | | map.put("absencesNumber", count); |
| | | |
| | | map.put("already", integer); |
| | | } |
| | | return list; |