| | |
| | | |
| | | Integer payType = tCoursePackagePayment.getPayType(); |
| | | BigDecimal cashPayment = tCoursePackagePayment.getCashPayment(); |
| | | double cashPaymentValue = cashPayment.doubleValue(); |
| | | double cashPaymentValue = 0.0; |
| | | if(cashPayment!=null){ |
| | | |
| | | cashPaymentValue = cashPayment.doubleValue(); |
| | | } |
| | | Integer playPaiCoin = tCoursePackagePayment.getPlayPaiCoin(); |
| | | TCoursePackageDiscount coursePackageDiscount = tcpdMapper.selectOne(new QueryWrapper<TCoursePackageDiscount>() |
| | | .eq("coursePackageId",coursePackage.getId() ) |
| | | .eq("type",1) |
| | | .eq("auditStatus",2)); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | String content = coursePackageDiscount.getContent(); |
| | | double discountMember = 0.0; |
| | | if(coursePackageDiscount!=null){ |
| | | String content = coursePackageDiscount.getContent(); |
| | | DiscountJsonDto discountJsonDto = null; |
| | | try { |
| | | discountJsonDto = objectMapper.readValue(content, DiscountJsonDto.class); |
| | |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | switch (payType) { |
| | | case 1: |
| | | case 2: |
| | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | | if (tCoursePackagePayments.size() > 0 ){ |
| | | for (TCoursePackagePayment tCoursePackagePayment : tCoursePackagePayments) { |
| | | |
| | | List<CoursePackageStudent> coursePackageStudent1 = cpsMapper.selectList(new QueryWrapper<CoursePackageStudent>() |
| | | .eq("coursePackageId",tCoursePackagePayment.getCoursePackageId() ) |
| | | .eq("studentId",stuId) |
| | | .eq("appUserId",appUserId) |
| | | .eq("reservationStatus",1)); |
| | | if (ToolUtil.isNotEmpty(coursePackageStudent1) && coursePackageStudent1.size() > 0){ |
| | | for (CoursePackageStudent coursePackageStudent : coursePackageStudent1) { |
| | | RecordAppoint recordVo = new RecordAppoint(); |
| | | recordVo.setCoursePackageId(tCoursePackagePayment.getCoursePackageId()); |
| | | |
| | |
| | | recordVo.setTimeFrame(simpleDateFormat.format(date)+" "+classStartTime+"-"+classEndTime); |
| | | Store store = stoClient.queryStoreById(coursePackage.getStoreId()); |
| | | recordVo.setStoreNameAddr(store.getName()+store.getAddress()); |
| | | CoursePackageStudent coursePackageStudent = cpsMapper.selectOne(new QueryWrapper<CoursePackageStudent>() |
| | | .eq("coursePackageId",tCoursePackagePayment.getCoursePackageId() ) |
| | | .eq("studentId",stuId) |
| | | .eq("appUserId",appUserId) |
| | | .eq("reservationStatus",1)); |
| | | if (ToolUtil.isNotEmpty(coursePackageStudent) && coursePackageStudent.getReservationStatus() == 1){ |
| | | |
| | | recordVo.setCourseStuRecordId(coursePackageStudent.getId()); |
| | | String classWeeks = coursePackage.getClassWeeks(); |
| | | String[] split = classWeeks.split(";"); |
| | |
| | | }else { |
| | | recordVo.setStatus(1); |
| | | } |
| | | recordVoList.add(recordVo); |
| | | } |
| | | |
| | | }else { |
| | | recordVo.setStatus(4); |
| | | // recordVo.setStatus(4); |
| | | } |
| | | recordVoList.add(recordVo); |
| | | |
| | | } |
| | | } |
| | | return recordVoList; |
| | |
| | | strings.add(s); |
| | | } |
| | | payCourseInfoReq.setTime(strings); |
| | | List<Integer> week = week(tCoursePackage.getClassWeeks()); |
| | | |
| | | // 今天周几 |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("MM.dd"); |
| | | ArrayList<String> strings1 = new ArrayList<>(); |
| | | |
| | | for (Integer integer : week) { |
| | | if(integer<i){ |
| | | // 找下一周的时间 |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.DATE,7-(i-integer)); |
| | | Date time = instance.getTime(); |
| | | strings1.add(format.format(time)); |
| | | |
| | | }else if(integer>i) { |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.DATE,integer-i); |
| | | Date time = instance.getTime(); |
| | | strings1.add(format.format(time)); |
| | | }else { |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.DATE,7); |
| | | Date time = instance.getTime(); |
| | | strings1.add(format.format(time)); |
| | | } |
| | | } |
| | | payCourseInfoReq.setDay(strings1); |
| | | return payCourseInfoReq; |
| | | } |
| | | private static List<Integer> week(String week){ |
| | | String[] split = week.split(";"); |
| | | ArrayList<Integer> integers = new ArrayList<>(); |
| | | for (String s : split) { |
| | | switch (s){ |
| | | case "周一": |
| | | integers.add(1); |
| | | break; |
| | | case "周二": |
| | | integers.add(2); |
| | | break; |
| | | case "周三": |
| | | integers.add(3); |
| | | break; |
| | | case "周四": |
| | | integers.add(4); |
| | | break; |
| | | case "周五": |
| | | integers.add(5); |
| | | break; |
| | | case "周六": |
| | | integers.add(6); |
| | | break; |
| | | case "周日": |
| | | integers.add(7); |
| | | break; |
| | | } |
| | | } |
| | | return integers; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | List<Integer> week = week("周一,周二"); |
| | | // 今天周几 |
| | | int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("MM.dd"); |
| | | |
| | | ArrayList<String> strings = new ArrayList<>(); |
| | | for (Integer integer : week) { |
| | | if(integer<i){ |
| | | // 找下一周的时间 |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.DATE,7-(i-integer)); |
| | | Date time = instance.getTime(); |
| | | strings.add(format.format(time)); |
| | | |
| | | }else if(integer>i) { |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.DATE,integer-i); |
| | | Date time = instance.getTime(); |
| | | strings.add(format.format(time)); |
| | | }else { |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.DATE,7); |
| | | Date time = instance.getTime(); |
| | | strings.add(format.format(time)); |
| | | } |
| | | } |
| | | System.out.println(strings); |
| | | } |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW) |
| | | public ResultUtil payCourse(PayCourseReq req,Integer userId){ |
| | |
| | | for (String s : time) { |
| | | for (int i = 0; i < split.length; i++) { |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCourseId(tCoursePackage.getId()); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | try { |
| | | Date parse = format.parse(s + " " + split[i]); |
| | | Date parse1 = format.parse(s + " " + split1[i]); |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void updateUseTime(Long id, Date date) { |
| | | this.baseMapper.updateUseTime(id,date); |
| | | } |
| | | |
| | | @Override |
| | | public List<Integer> getStudentIds(Integer payId) { |
| | | return this.baseMapper.getStudentIds(payId); |
| | | } |
| | | |
| | | |
| | | } |