| | |
| | | import net.bytebuddy.asm.Advice; |
| | | import org.aspectj.weaver.ast.Var; |
| | | import io.swagger.models.auth.In; |
| | | import org.checkerframework.checker.units.qual.C; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | private CoursePackageStudentService coursePackageStudentService; |
| | | |
| | | private final SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm"); |
| | | |
| | | /** |
| | | * 查询学员入学时间 根据第一次购买课包的时间 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/coursePackagePayment/getTime") |
| | | public String getTime(@RequestBody Integer studentId){ |
| | | List<TCoursePackagePayment> list = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("studentId", studentId) |
| | | .orderByDesc("insertTime") |
| | | .last("LIMIT 1")); |
| | | if (list.size()>0){ |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date insertTime = list.get(0).getInsertTime(); |
| | | String format1 = format.format(list.get(0).getInsertTime()); |
| | | return format1; |
| | | } |
| | | return ""; |
| | | } |
| | | /** |
| | | * 添加购课记录-后台 |
| | | * @return |
| | |
| | | .eq("appUserId",student.getAppUserId()) |
| | | .eq("studentId",stuId).eq("payStatus",2)); |
| | | |
| | | Date date = new Date(); |
| | | |
| | | if (byUserId.size() > 0 ){ |
| | | for (TCoursePackagePayment tCoursePackagePayment : byUserId) { |
| | | TCoursePackage tCoursePackage = tcpService.getById(tCoursePackagePayment.getCoursePackageId()); |
| | | |
| | | if (tCoursePackagePayment.getUseTime()!=null) { |
| | | if (tCoursePackagePayment.getUseTime().after(date)) { |
| | | date = tCoursePackagePayment.getUseTime(); |
| | | } |
| | | } |
| | | if (tCoursePackage.getType()==3){ |
| | | continue; |
| | | } |
| | |
| | | }else { |
| | | resp.setIsAble(1); |
| | | } |
| | | if (tCoursePackage.getValidDays()!=null){ |
| | | String afterDayDate = DateUtil.getAfterDayDate2(tCoursePackage.getInsertTime(),tCoursePackage.getValidDays() + ""); |
| | | resp.setPeriodOfValidity(afterDayDate); |
| | | |
| | | if (tCoursePackagePayment.getUseTime()!=null){ |
| | | // String afterDayDate = DateUtil.getAfterDayDate2(tCoursePackage.getInsertTime(),tCoursePackage.getValidDays() + ""); |
| | | // resp.setPeriodOfValidity(afterDayDate); |
| | | |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String str = sdf.format(tCoursePackagePayment.getUseTime()); |
| | | resp.setPeriodOfValidity(str); |
| | | } |
| | | |
| | | |
| | | |
| | | resps.add(resp); |
| | | } |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String str = sdf.format(date); |
| | | |
| | | for (StuCourseResp resp : resps) { |
| | | |
| | | |
| | | resp.setPeriodOfValidity(str); |
| | | } |
| | | |
| | | |
| | | return resps; |
| | | } |
| | | |
| | |
| | | .in("id", collect)); |
| | | list.forEach(vo -> { |
| | | StuSessionDetailsVo detVo = new StuSessionDetailsVo(); |
| | | detVo.setSessionid(vo.getId()); |
| | | detVo.setSessionName(vo.getName()); |
| | | String afterDayDate = DateUtil.getAfterDayDate2(vo.getInsertTime(),vo.getValidDays() + ""); |
| | | detVo.setPeriodOfValidity(afterDayDate); |
| | | detailsVos.add(detVo); |
| | | if (vo.getType()!=2) { |
| | | detVo.setSessionid(vo.getId()); |
| | | detVo.setSessionName(vo.getName()); |
| | | String afterDayDate = DateUtil.getAfterDayDate2(vo.getInsertTime(), vo.getValidDays() + ""); |
| | | detVo.setPeriodOfValidity(afterDayDate); |
| | | detailsVos.add(detVo); |
| | | } |
| | | }); |
| | | } |
| | | return detailsVos; |
| | |
| | | Collections.sort(payCourseInfoReq.getDay(), Comparator.comparing(String::toString)); |
| | | |
| | | |
| | | return ResultUtil.success(packagePaymentService.payCourseInfo(courseId)); |
| | | return ResultUtil.success(payCourseInfoReq); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | |
| | | @ApiOperation(value = "已报名课程详情", tags = {"APP-开始上课"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "经度", name = "lon", dataType = "string", required = false), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = false), |
| | | @ApiImplicitParam(name = "coursePayId" ,value = "课包记录id",dataType = "long"), |
| | | @ApiImplicitParam(name = "orderId" ,value = "订单id",dataType = "int") |
| | | |
| | | }) |
| | | public ResultUtil<CourseDetailsResponse> getRegisteredData(Long coursePayId){ |
| | | public ResultUtil<CourseDetailsResponse> getRegisteredData(Long coursePayId, String lon, String lat,Integer orderId){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | |
| | | } |
| | | return ResultUtil.success(packagePaymentService.queryRegisteredCourseDetails(coursePayId,appUserId)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e.getMessage()); |
| | | // return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | |
| | | TCoursePackagePayment pay = packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("coursePackageId", coursePackagePayment.getCoursePackageId()).eq("studentId", coursePackagePayment.getStudentId())); |
| | | |
| | | Date today = new Date(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DATE, -1); |
| | | today = calendar.getTime(); |
| | | |
| | | |
| | | Integer laveClassHours = pay.getLaveClassHours(); |
| | | Integer codeTime = tCoursePackage.getCodeTime(); |
| | |
| | | for (CancelledClasses cancelledClasses : voucher) { |
| | | TCoursePackagePayment coursePackagePayment = packagePaymentService.getById(cancelledClasses.getCoursePackagePaymentId()); |
| | | coursePackagePayment.setLaveClassHours(coursePackagePayment.getLaveClassHours() + cancelledClasses.getCancelledClassesNumber()); |
| | | coursePackagePayment.setAppUserId(null); |
| | | packagePaymentService.updateById(coursePackagePayment); |
| | | |
| | | cancelledClassesService.removeById(cancelledClasses.getId()); |
| | |
| | | HashMap<String, Object> weeksOfCourseDetailsList(@RequestBody CourseDetailReq courseDetailReq){ |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | ArrayList<DetailsListVo> objects = new ArrayList<>(); |
| | | try { |
| | | // try { |
| | | String time = courseDetailReq.getTime(); |
| | | Date parse = new SimpleDateFormat("yyyy-MM-dd").parse(time); |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(parse)-1; |
| | | Date parse = null; |
| | | try { |
| | | parse = new SimpleDateFormat("yyyy-MM-dd").parse(time); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(parse)-1; |
| | | String week = week(i); |
| | | Store store = sreClient.queryStoreById(courseDetailReq.getStoreId()); |
| | | String lat = store.getLat(); |
| | |
| | | |
| | | List<CoursePackageStudent> list5 = cspsService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", courseDetailReq.getStuId()).eq("coursePackageId",tCoursePackage.getId())); |
| | | |
| | | if(list5.size()>0){ |
| | | if(list5.size()>0&&list4.size()>0){ |
| | | Integer signInOrNot = list4.get(0).getSignInOrNot(); |
| | | detailsListVo.setType(1); |
| | | |
| | |
| | | map.put("data",objects); |
| | | |
| | | return map; |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return map; |
| | | // } catch (ParseException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return map; |
| | | } |
| | | |
| | | private String week(int i){ |