| | |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.entity.*; |
| | | import com.dsh.course.entity.TAppUser; |
| | | import com.dsh.course.feignclient.account.AppUserClient; |
| | | import com.dsh.course.feignclient.account.StudentClient; |
| | | import com.dsh.course.feignclient.account.model.AppUser; |
| | | import com.dsh.course.feignclient.account.model.Student; |
| | | import com.dsh.course.feignclient.account.model.TCourseInfoRecord; |
| | | import com.dsh.course.feignclient.account.model.TStudent; |
| | | import com.dsh.course.feignclient.activity.CouponClient; |
| | | import com.dsh.course.feignclient.activity.model.Coupon; |
| | | import com.dsh.course.feignclient.model.*; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private CoursePackageSchedulingMapper coursePackageSchedulingMapper; |
| | | |
| | | @Autowired |
| | | private ICoursePackageSchedulingService coursePackageSchedulingService; |
| | | @Autowired |
| | | private CoursePackageStudentService coursePackageStudentService; |
| | | |
| | | private final SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm"); |
| | | /** |
| | | * 添加购课记录-后台 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/coursePackagePayment/add") |
| | | public Object addCoursePackagePayment(@RequestBody TCoursePackagePayment packagePayment){ |
| | | packagePayment.setInsertTime(new Date()); |
| | | packagePayment.setInsertTime(new Date()); |
| | | Integer studentId = packagePayment.getStudentId(); |
| | | // 添加学员上课记录 |
| | | CoursePackageStudent coursePackageStudent = new CoursePackageStudent(); |
| | | TCoursePackagePayment one = packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("studentId", packagePayment) |
| | | .orderByDesc("insertTime") |
| | | .last("LIMIT 1")); |
| | | |
| | | if (one!=null){ |
| | | Integer totalClassHours = one.getTotalClassHours(); |
| | | Integer absencesNumber = one.getAbsencesNumber(); |
| | | // 没有过期 |
| | | if (one.getUseTime().after(new Date())){ |
| | | if (one.getLaveClassHours()-packagePayment.getClassHours()<0){ |
| | | return 5002; |
| | | } |
| | | packagePayment.setTotalClassHours(one.getTotalClassHours()); |
| | | packagePayment.setLaveClassHours(one.getLaveClassHours()-packagePayment.getClassHours()); |
| | | packagePayment.setAbsencesNumber(one.getAbsencesNumber()); |
| | | } |
| | | packagePayment.setTotalClassHours(packagePayment.getClassHours()); |
| | | packagePayment.setLaveClassHours(packagePayment.getClassHours()); |
| | | packagePayment.setAbsencesNumber(one.getAbsencesNumber()); |
| | | }else{ |
| | | packagePayment.setTotalClassHours(packagePayment.getClassHours()); |
| | | packagePayment.setLaveClassHours(packagePayment.getClassHours()); |
| | | packagePayment.setAbsencesNumber(0); |
| | | } |
| | | // 生成排课数据 |
| | | TCoursePackage coursePackage = tcpService.getById(packagePayment.getCoursePackageId()); |
| | | //生成排课数据 |
| | | try { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date date = sdf1.parse(sdf.format(new Date()) + " 00:00:00"); |
| | | List<String> list = Arrays.asList(coursePackage.getClassWeeks().split(";")); |
| | | String value = coursePackage.getClassStartTime(); |
| | | String value1 = coursePackage.getClassEndTime(); |
| | | |
| | | String[] star = value.split(","); |
| | | String[] end = value1.split(","); |
| | | for (int i = 0; i < star.length; i++) { |
| | | // int index = star[i].indexOf(","); |
| | | // |
| | | // |
| | | // String result = value.substring(0, index).trim(); |
| | | String classStartTime = star[i]; |
| | | String[] split = classStartTime.split(":"); |
| | | // String value1 = en; |
| | | int index1 = value1.indexOf(","); |
| | | // String result1 = value.substring(0, index1).trim(); |
| | | String classEndTime = end[i]; |
| | | String[] split1 = classEndTime.split(":"); |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(date); |
| | | s.set(Calendar.DAY_OF_YEAR, s.get(Calendar.DAY_OF_YEAR) + 1); |
| | | s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | s.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | s.set(Calendar.SECOND, 0); |
| | | |
| | | Calendar e = Calendar.getInstance(); |
| | | e.setTime(date); |
| | | e.set(Calendar.DAY_OF_YEAR, s.get(Calendar.DAY_OF_YEAR) + 13); |
| | | long timeInMillis = e.getTimeInMillis(); |
| | | |
| | | while (true){ |
| | | int w = s.get(Calendar.DAY_OF_WEEK); |
| | | WeekEnum weekEnum = WeekEnum.getWeekEnum(w); |
| | | if(list.contains(weekEnum.getChineseName())){ |
| | | Calendar classDate = Calendar.getInstance(); |
| | | classDate.setTime(s.getTime()); |
| | | classDate.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | classDate.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | classDate.set(Calendar.SECOND, 0); |
| | | |
| | | Calendar endDate = Calendar.getInstance(); |
| | | endDate.setTime(s.getTime()); |
| | | endDate.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split1[0])); |
| | | endDate.set(Calendar.MINUTE, Integer.valueOf(split1[1])); |
| | | endDate.set(Calendar.SECOND, 0); |
| | | |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(coursePackage.getId()); |
| | | coursePackageScheduling.setClassDate(classDate.getTime()); |
| | | coursePackageScheduling.setEndDate(endDate.getTime()); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.save(coursePackageScheduling); |
| | | coursePackageStudent.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | |
| | | List<CoursePackageScheduling> list1 = coursePackageSchedulingService.list(new QueryWrapper<CoursePackageScheduling>() |
| | | .eq("coursePackageId", coursePackage.getId()) |
| | | .eq("classDate", classDate.getTime()) |
| | | .eq("endDate", endDate.getTime())); |
| | | if (list.size()+1>coursePackage.getMaxSubscribeNumber()){ |
| | | // 当前课包预约人数已满 |
| | | return 5001; |
| | | } |
| | | } |
| | | s.set(Calendar.DAY_OF_YEAR, s.get(Calendar.DAY_OF_YEAR) + 1); |
| | | if(s.getTimeInMillis() > timeInMillis){ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | coursePackageStudent.setStudentId(packagePayment.getStudentId()); |
| | | coursePackageStudent.setCoursePackageId(packagePayment.getCoursePackageId()); |
| | | |
| | | |
| | | coursePackageStudent.setSignInOrNot(0); |
| | | coursePackageStudent.setReservationStatus(1); |
| | | coursePackageStudent.setInsertTime(new Date()); |
| | | coursePackageStudent.setAppUserId(packagePayment.getAppUserId()); |
| | | packagePaymentService.save(packagePayment); |
| | | coursePackageStudent.setCoursePackagePaymentId(packagePayment.getId()); |
| | | return coursePackageStudentService.save(coursePackageStudent); |
| | | } |
| | | /** |
| | | * 手动支付 |
| | | * @return |
| | |
| | | List<CoursePackagePaymentVO> result = new ArrayList<>(); |
| | | for (CoursePackagePaymentVO re : res) { |
| | | if (re.getCashPayment()==null){ |
| | | String value = String.valueOf(re.getPlayPaiCoin()); |
| | | re.setCashPayment(new BigDecimal(value)); |
| | | if (re.getPlayPaiCoin()!=null){ |
| | | String value = String.valueOf(re.getPlayPaiCoin()); |
| | | re.setCashPayment(new BigDecimal(value)); |
| | | } |
| | | } |
| | | |
| | | Store store = storeClient.queryStoreById(re.getStoreId()); |
| | | AppUser appUser = appUserClient.queryAppUser(re.getAppUserId()); |
| | | TAppUser appUser = appUserClient.queryAppUser1(re.getAppUserId()); |
| | | Student student = studentClient.queryStudentById(re.getStudentId()); |
| | | re.setPayStudent(student.getName()); |
| | | re.setPayUser(appUser.getName()); |
| | |
| | | List<AppUser> appUsers = appUserClient.queryAppUserListByName(query.getPayUser()); |
| | | for (AppUser user : appUsers) { |
| | | if (appUser.getName().equals(user.getName())){ |
| | | result.add(re); |
| | | } |
| | | } |
| | | } |
| | | if (query.getPayStudent()== null || query.getPayStudent().equals("")){ |
| | | }else{ |
| | | List<Student> students = studentClient.queryStudentListByName(query.getPayStudent()); |
| | | for (Student student1 : students) { |
| | | if (student.getName().equals(student1.getName())){ |
| | | result.add(re); |
| | | if (query.getPayStudent()== null || query.getPayStudent().equals("")){ |
| | | }else{ |
| | | List<Student> students = studentClient.queryStudentListByName(query.getPayStudent()); |
| | | for (Student student1 : students) { |
| | | if (student.getName().equals(student1.getName())){ |
| | | result.add(re); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (re.getPayType()==1){ |
| | | re.setBuyTypeName("微信支付"); |
| | | }else if(re.getPayType()==2){ |
| | | re.setBuyTypeName("支付宝支付"); |
| | | }else if(re.getPayType()==3){ |
| | | re.setBuyTypeName("玩湃币支付"); |
| | | }else if(re.getPayType()==4){ |
| | | re.setBuyTypeName("积分支付"); |
| | | }else if(re.getPayType()==5){ |
| | | re.setBuyTypeName("积分+微信支付"); |
| | | }else if(re.getPayType()==6){ |
| | | re.setBuyTypeName("积分+支付宝支付"); |
| | | }else if(re.getPayType()==7){ |
| | | re.setBuyTypeName("手动支付"+"-"+re.getBuyTypeName()); |
| | | if (re.getPayType()!=null){ |
| | | if (re.getPayType()==1){ |
| | | re.setBuyTypeName("微信支付"); |
| | | }else if(re.getPayType()==2){ |
| | | re.setBuyTypeName("支付宝支付"); |
| | | }else if(re.getPayType()==3){ |
| | | re.setBuyTypeName("玩湃币支付"); |
| | | }else if(re.getPayType()==4){ |
| | | re.setBuyTypeName("积分支付"); |
| | | }else if(re.getPayType()==5){ |
| | | re.setBuyTypeName("积分+微信支付"); |
| | | }else if(re.getPayType()==6){ |
| | | re.setBuyTypeName("积分+支付宝支付"); |
| | | }else if(re.getPayType()==7){ |
| | | re.setBuyTypeName("手动支付"+"-"+re.getBuyTypeName()); |
| | | } |
| | | } |
| | | // 如果支付用户类型为平台 则购买方式则为1线下购买 |
| | | if (re.getPayUserType()== 2){ |
| | | re.setBuyType(1); |
| | | }else{ |
| | | // 如果当前课包有折扣 则为3折扣购买 |
| | | if (discountService.list(new QueryWrapper<TCoursePackageDiscount>() |
| | | .eq("coursePackageId",re.getCoursePackageId()).eq("auditStatus",2)).size()>0){ |
| | | re.setBuyType(3); |
| | | re.setDiscountAmount(re.getOriginalPrice().subtract(re.getPayMoney())); |
| | | |
| | | // 如果支付用户类型为管理员 则购买方式则为1线下购买 |
| | | if (re.getPayUserType()!=null){ |
| | | if (re.getPayUserType()== 2){ |
| | | re.setBuyType(1); |
| | | }else{ |
| | | re.setBuyType(2); |
| | | // 如果当前课包有折扣 则为3折扣购买 |
| | | if (discountService.list(new QueryWrapper<TCoursePackageDiscount>() |
| | | .eq("coursePackageId",re.getCoursePackageId()).eq("auditStatus",2)).size()>0){ |
| | | re.setBuyType(3); |
| | | re.setDiscountAmount(re.getOriginalPrice().subtract(re.getPayMoney())); |
| | | }else{ |
| | | re.setBuyType(2); |
| | | } |
| | | } |
| | | } |
| | | // 不为空则计算 |
| | | if (re.getUserCouponId()!=null){ |
| | | |
| | | } |
| | | // todo 计算优惠金额 |
| | | // Coupon coupon = couponClient.queryCouponById(re.getUserCouponId().intValue()); |
| | | } |
| | | if (query.getPayStudent()== null || query.getPayStudent().equals("")){ |
| | | if (query.getPayUser()== null || query.getPayUser().equals("")){ |
| | | return res; |
| | |
| | | }else{ |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取报名订单记录列表 |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/registerOrder/listAllRegister") |
| | | public List<RegisterOrderVO> listAllRegister(@RequestBody RegisterOrderQuery query){ |
| | | if (query.getStudentName()!=null){ |
| | | if (!query.getStudentName().equals("")){ |
| | | List<TStudent> students1 = studentClient.queryTStudentListByName(query.getStudentName()); |
| | | List<Integer> studentIds = students1.stream().map(TStudent::getId).collect(Collectors.toList()); |
| | | query.setStudentIds(studentIds); |
| | | if (students1.size()==0){ |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<RegisterOrderVO> res = packagePaymentService.listAllRegister(query); |
| | | List<RegisterOrderVO> result = new ArrayList<>(); |
| | | for (RegisterOrderVO re : res) { |
| | | if(re.getSalesName()==null){ |
| | | re.setSalesName("无"); |
| | | } |
| | | if(re.getPayType()!=null){ |
| | | if (re.getPayType() == 3){ |
| | | re.setPayMoneyAndType(re.getPlayPaiCoin()+"玩湃币"); |
| | | }else{ |
| | | re.setPayMoneyAndType("¥"+re.getMoney()); |
| | | } |
| | | } |
| | | Store store = storeClient.queryStoreById(re.getStoreId()); |
| | | TAppUser appUser = appUserClient.queryAppUser1(re.getAppUserId()); |
| | | Student student = studentClient.queryStudentById(re.getStudentId()); |
| | | re.setPayStudent(student.getName()); |
| | | re.setPayUser(appUser.getName()); |
| | | re.setPhone(appUser.getPhone()); |
| | | re.setStoreName(store.getName()); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | @PostMapping("/base/coursePack/getCoursePackagePaymentById") |
| | | public TCoursePackagePayment getCoursePackagePaymentById(@RequestBody Integer id){ |
| | | return packagePaymentService.getById(id); |
| | | public TCoursePackagePayment getCoursePackagePaymentById(@RequestBody Long id){ |
| | | TCoursePackagePayment byId = packagePaymentService.getById(id); |
| | | System.out.println("======byId=========="+byId); |
| | | return byId; |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/coursePack/delPaymentCoursePackage") |
| | | public boolean delPaymentCoursePackage(@RequestBody Integer payId){ |
| | | return packagePaymentService.removeById(payId); |
| | |
| | | |
| | | @PostMapping("/base/coursePack/savePaymentCoursePackage") |
| | | public boolean savePaymentCoursePackage(@RequestBody TCoursePackagePayment packagePayment){ |
| | | packagePayment.setInsertTime(new Date()); |
| | | |
| | | return packagePaymentService.save(packagePayment); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/coursePack/obtainStudentClassDetails") |
| | | public List<RecordAppoint> obtainStudentClassDetailsData(@RequestBody WeeksOfCourseRest stuId){ |
| | | try { |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/coursePackagePayment/queryCoursePackagePaymentById") |
| | | public TCoursePackagePayment queryCoursePackagePaymentById(@RequestBody Long id){ |
| | | public TCoursePackagePayment queryCoursePackagePaymentById(@RequestParam("id")Long id){ |
| | | return packagePaymentService.getById(id); |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping("/coursePackagePayment/editCoursePackagePayment") |
| | | public void editCoursePackagePayment(TCoursePackagePayment coursePackagePayment){ |
| | | coursePackagePayment.setAppUserId(null); |
| | | packagePaymentService.updateById(coursePackagePayment); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 修改数据 |
| | | * @param coursePackagePayment |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/coursePackagePayment/editCoursePackagePayment1") |
| | | public void editCoursePackagePayment1(@RequestBody TCoursePackagePayment coursePackagePayment){ |
| | | System.out.println("editCoursePackagePayment1====coursePackagePayment"+coursePackagePayment); |
| | | // coursePackagePayment.setCoursePackageId(null); |
| | | packagePaymentService.updateBytime(coursePackagePayment); |
| | | } |
| | | |
| | | |
| | |
| | | if (ToolUtil.isEmpty(packagePayment) || packagePayment.size()==0){ |
| | | return ResultUtil.error("该用户未购买该课包"); |
| | | } |
| | | List<CoursePackageScheduling> coursePackageSchedulings = coursePackageSchedulingMapper.selectList(new LambdaQueryWrapper<CoursePackageScheduling>() |
| | | .eq(CoursePackageScheduling::getCoursePackageId, Integer.valueOf(courseID)) |
| | | .like(CoursePackageScheduling::getClassDate, time) |
| | | ); |
| | | |
| | | List<CoursePackageStudent> coursePackageStudent = cspsService.list(new LambdaQueryWrapper<CoursePackageStudent>() |
| | | .in(CoursePackageStudent::getCoursePackagePaymentId,packagePayment.stream().map(TCoursePackagePayment::getId).collect(Collectors.toList())) |
| | | .in(CoursePackageStudent::getCoursePackageSchedulingId,coursePackageSchedulings.stream().map(CoursePackageScheduling::getId).collect(Collectors.toList())) |
| | | .eq(CoursePackageStudent::getCoursePackageId,courseID) |
| | | .eq(CoursePackageStudent::getStudentId,stuId) |
| | | .eq(CoursePackageStudent::getAppUserId,appUserId) |
| | |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | |
| | | String classEndTime = tCoursePackage.getClassEndTime(); |
| | | String[] split1 = classEndTime.split(","); |
| | | ArrayList<String> strings = new ArrayList<>(); |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | String s = split[i1] + "-" + split1[i1]; |
| | | strings.add(s); |
| | | if(ToolUtil.isNotEmpty(classStartTime)){ |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | String s = split[i1].substring(0,5) + "-" + split1[i1].substring(0,5); |
| | | strings.add(s); |
| | | } |
| | | } |
| | | |
| | | detailsListVo.setTime(strings); |
| | | List<CoursePackagePaymentConfig> list2 = icppcService.list(new LambdaQueryWrapper<CoursePackagePaymentConfig>().eq(CoursePackagePaymentConfig::getCoursePackageId, tCoursePackage.getId()).orderByAsc(CoursePackagePaymentConfig::getCashPayment)); |
| | | if (list2.size() > 0) { |
| | |
| | | .eq(CoursePackageScheduling::getCoursePackageId, tCoursePackage.getId()) |
| | | .like(CoursePackageScheduling::getClassDate, courseDetailReq.getTime()) |
| | | ); |
| | | if(list3.size()==0){ |
| | | break; |
| | | } |
| | | List<Long> collect2 = list3.stream().map(CoursePackageScheduling::getId).collect(Collectors.toList()); |
| | | if(collect2.size()==0){ |
| | | collect2.add(-1l); |
| | |
| | | in(CoursePackageStudent::getCoursePackagePaymentId, ids) |
| | | ); |
| | | |
| | | detailsListVo.setType(1); |
| | | detailsListVo.setType(1); |
| | | if(list4.size()>0){ |
| | | Integer signInOrNot = list4.get(0).getSignInOrNot(); |
| | | if(signInOrNot==2){ |
| | | detailsListVo.setType(3); |
| | | } |
| | | detailsListVo.setIsType(list4.get(0).getType()); |
| | | } |
| | | |
| | | } else { |
| | |
| | | return a; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/coursePackagePayment/queryCourseData") |
| | | public List<Map<String,Object>> queryCourseData(@RequestBody List<Integer> ids){ |
| | | // 找出课程类型 找出剩余的课时数 |
| | | List<TCoursePackageType> list = coursePackageTypeService.list(); |
| | | if(ids.size()==0){ |
| | | ids.add(-1); |
| | | } |
| | | List<TCoursePackagePayment> list1 = packagePaymentService.listOne(ids); |
| | | List<Integer> collect = list1.stream().map(TCoursePackagePayment::getCoursePackageId).collect(Collectors.toList()); |
| | | if(collect.size()==0){ |
| | | collect.add(-1); |
| | | } |
| | | List<TCoursePackage> list2 = tcpService.list(new LambdaQueryWrapper<TCoursePackage>().in(TCoursePackage::getId, collect)); |
| | | for (TCoursePackagePayment tCoursePackagePayment : list1) { |
| | | for (TCoursePackage tCoursePackage : list2) { |
| | | if(tCoursePackagePayment.getCoursePackageId().equals(tCoursePackage.getId())){ |
| | | tCoursePackagePayment.setType(tCoursePackage.getType()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | List<Map<String,Object>> mapList = new ArrayList<>(); |
| | | for (TCoursePackageType tCoursePackageType : list) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("name",tCoursePackageType.getName()); |
| | | int a =0; |
| | | for (TCoursePackagePayment tCoursePackagePayment : list1) { |
| | | if(tCoursePackagePayment.getType().equals(tCoursePackageType.getId())){ |
| | | a += tCoursePackagePayment.getLaveClassHours(); |
| | | } |
| | | } |
| | | map.put("value",a); |
| | | mapList.add(map); |
| | | } |
| | | |
| | | |
| | | return mapList; |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/coursePackagePayment/coursePt") |
| | | HashMap<String, Object> coursePt(@RequestBody List<Integer> userPt){ |
| | | if(userPt.size()==0){ |
| | | userPt.add(-1); |
| | | } |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | List<TCoursePackagePayment> tCoursePackagePayments = packagePaymentService.listOne(userPt); |
| | | int sum = tCoursePackagePayments.stream().mapToInt(TCoursePackagePayment::getTotalClassHours).sum(); |
| | | int sum1 = tCoursePackagePayments.stream().mapToInt(TCoursePackagePayment::getLaveClassHours).sum(); |
| | | map.put("allCourse",sum-sum1); |
| | | |
| | | //所有课包 |
| | | List<TCoursePackage> coursePackages = tcpService.list(); |
| | | |
| | | |
| | | // 年 |
| | | List<CoursePackageStudent> list = cspsService.list(new LambdaQueryWrapper<CoursePackageStudent>().in(CoursePackageStudent::getAppUserId, userPt)); |
| | | |
| | | |
| | | for (CoursePackageStudent coursePackageStudent : list) { |
| | | for (TCoursePackage coursePackage : coursePackages) { |
| | | if(coursePackageStudent.getCoursePackageId().equals(coursePackage.getId())){ |
| | | if(ToolUtil.isEmpty(coursePackage.getNeedNum())){ |
| | | coursePackageStudent.setNeedNum(0); |
| | | }else { |
| | | coursePackageStudent.setNeedNum(coursePackageStudent.getNeedNum()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | ArrayList<Object> integers = new ArrayList<>(); |
| | | int year = cn.hutool.core.date.DateUtil.year(new Date()); |
| | | for (int i = 0; i < 10; i++) { |
| | | integers.add(year-i); |
| | | } |
| | | List<Object> collect = integers.stream().sorted().collect(Collectors.toList()); |
| | | // 年 |
| | | ArrayList<Integer> years = new ArrayList<>(); |
| | | for (Object o : collect) { |
| | | String s = o.toString(); |
| | | List<CoursePackageStudent> collect1 = list.stream().filter(e -> e.getInsertTime().toString().contains(s)).collect(Collectors.toList()); |
| | | int sum2 = collect1.stream().mapToInt(CoursePackageStudent::getNeedNum).sum(); |
| | | years.add(sum2); |
| | | } |
| | | |
| | | map.put("yearData",years); |
| | | |
| | | |
| | | |
| | | ArrayList<Integer> months = new ArrayList<>(); |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | |
| | | // 月 |
| | | for (int i = 1; i <= 12; i++) { |
| | | String m=i+""; |
| | | if(i<10){ |
| | | m="0"+i; |
| | | } |
| | | String s = year + "-" + m; |
| | | List<CoursePackageStudent> collect1 = list.stream().filter(e -> format.format(e.getInsertTime()).contains(s)).collect(Collectors.toList()); |
| | | int sum2 = collect1.stream().mapToInt(CoursePackageStudent::getNeedNum).sum(); |
| | | months.add(sum2); |
| | | } |
| | | map.put("monthData",months); |
| | | |
| | | |
| | | |
| | | // 周 |
| | | // 获取最近四周 |
| | | LocalDateTime minNow = LocalDateTime.now().with(LocalTime.MIN); |
| | | LocalDateTime maxNow = LocalDateTime.now().with(LocalTime.MAX); |
| | | // 周度数据 |
| | | String s1 = minNow.minusDays(6).toString(); |
| | | String s2 = maxNow.toString(); |
| | | |
| | | String s3 = minNow.minusDays(13).toString(); |
| | | String s4 = maxNow.minusDays(6).toString(); |
| | | |
| | | |
| | | String s5 = minNow.minusDays(20).toString(); |
| | | String s6 = maxNow.minusDays(13).toString(); |
| | | |
| | | String s7 = minNow.minusDays(27).toString(); |
| | | String s8 = maxNow.minusDays(20).toString(); |
| | | |
| | | // |
| | | // int count = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect1).between(TStudent::getInsertTime, s7, s8)); |
| | | // |
| | | // int count1 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect1).between(TStudent::getInsertTime,s5,s6)); |
| | | // |
| | | // int count2 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect1).between(TStudent::getInsertTime,s3,s4)); |
| | | // |
| | | // int count3 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect1).between(TStudent::getInsertTime,s1,s2)); |
| | | |
| | | // map.put("count",count); |
| | | // map.put("count1",count1); |
| | | // map.put("count2",count2); |
| | | // map.put("count3",count3); |
| | | return null; |
| | | |
| | | } |
| | | |
| | | } |