cloud-server-account/src/main/java/com/dsh/account/controller/ClassDetailsController.java
@@ -247,7 +247,7 @@ } List<StuListVo> stuListVos = new ArrayList<>(); List<TStudent> tStudents = istuService.list(new QueryWrapper<TStudent>() .eq("appUserId",userIdFormRedis)); .eq("appUserId",userIdFormRedis).eq("state",1)); if (tStudents.size() > 0){ tStudents.forEach(sts -> { StuListVo vo = new StuListVo(); cloud-server-account/src/main/java/com/dsh/account/controller/UseBenefitsController.java
@@ -2,6 +2,7 @@ import com.dsh.account.entity.TAppUser; import com.dsh.account.feignclient.activity.model.IntegralCommodity; import com.dsh.account.feignclient.other.SysLogClient; import com.dsh.account.model.vo.userBenefitDetail.*; import com.dsh.account.service.RechargeRecordsService; @@ -61,7 +62,13 @@ if(null == appUserId){ return ResultUtil.tokenErr(); } return ResultUtil.success(tauService.queryBenefitDetails(appUserId)); IndexOfUserBenefirVo indexOfUserBenefirVo = tauService.queryBenefitDetails(appUserId); List<IntegralCommodity> commodities = indexOfUserBenefirVo.getCommodities(); if (commodities.size() > 5) { commodities = commodities.subList(0, 5); } indexOfUserBenefirVo.setCommodities(commodities); return ResultUtil.success(indexOfUserBenefirVo); }catch (Exception e){ return ResultUtil.runErr(); } cloud-server-account/src/main/java/com/dsh/account/feignclient/activity/MerChandiseClient.java
@@ -2,10 +2,8 @@ import com.dsh.account.feignclient.activity.model.*; import com.dsh.account.model.vo.userBenefitDetail.ExchangeDetailsResponse; import com.dsh.account.model.vo.userBenefitDetail.ExchangeDetailsVo; import com.dsh.account.model.vo.userBenefitDetail.PointDetailsVo; import com.dsh.account.model.vo.userBenefitDetail.ProductDetailsVo; import com.dsh.account.feignclient.competition.model.BillingDataRequestVo; import com.dsh.account.model.vo.userBenefitDetail.*; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -65,8 +63,6 @@ void deletePaymentRecord(@RequestBody String code); @PostMapping("/base/pointMerchars/getConsumeDetails") List<ConsumeDetail> getConsumeDetails(@RequestBody BillingDataRequestVo requestVo); } cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java
@@ -277,9 +277,23 @@ break; } if("TRADE_SUCCESS".equals(tradeStatus)){ records.setAppUserId(null); records.setPayStatus(2); records.setPayTime(new Date()); records.setOrderNumber(tradeNo); rereMapper.updateById(records); // RechargeRecords rechargeRecords = rereMapper.selectOne(new QueryWrapper<RechargeRecords>() // .eq("code", code)); // if (rechargeRecords.getPayStatus() == 2){ // break; // } // // TAppUser tAppUser = tappMapper.selectById(rechargeRecords.getAppUserId()); // tAppUser.setPlayPaiCoins(null == tAppUser.getPlayPaiCoins()? rechargeRecords.getPlayPaiCoins(): tAppUser.getPlayPaiCoins() +rechargeRecords.getPlayPaiCoins() ); // tappMapper.updateById(tAppUser); break; } if("WAIT_BUYER_PAY".equals(tradeStatus)){ @@ -362,6 +376,7 @@ if (rechargeRecords.getPayStatus() == 2){ return ResultUtil.success(); } rechargeRecords.setAppUserId(null); rechargeRecords.setPayStatus(2); rechargeRecords.setPayTime(new Date()); rechargeRecords.setOrderNumber(orderNumber); cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
@@ -284,8 +284,9 @@ classInfoVo.setHeight(tStudent.getHeight()); classInfoVo.setWeight(tStudent.getWeight()); classInfoVo.setBmi(tStudent.getBmi()); classInfoVo.setBodyStatus(BMIBodyUtil.getBodyStatus(tStudent.getBmi())); if (tStudent.getBmi()!=null) { classInfoVo.setBodyStatus(BMIBodyUtil.getBodyStatus(tStudent.getBmi())); } List<RegisteredCourse> courseList = new ArrayList<>(); List<StuCourseResp> stuCoursePayment = paymentClient.getStuCoursePayment(tStudent.getId()); List<Integer> coursePackIds = new ArrayList<>(); @@ -302,7 +303,6 @@ course.setPeriodOfValidity(tCoursePackagePayment.getPeriodOfValidity()); courseList.add(course); } } classInfoVo.setCourseList(courseList); // List<ExerciseVideo> stuCourseOfVideoList = voclClient.getStuCourseOfVideoList(coursePackIds); @@ -799,6 +799,13 @@ details.add(consumeDetail); } } //8.积分商场 List<ConsumeDetail> consumeDetails = mcClient.getConsumeDetails(requestVo); details.addAll(consumeDetails); if (details.size() > 0 ){ Collections.sort(details, new Comparator<ConsumeDetail>() { @Override @@ -1321,7 +1328,10 @@ switch (exchangeType.getExchangeType()){ // 积分 case 1: boolean b = dealAppUserIntegral(userIdFormRedis,tAppUser,merchandise.getIntegral()); boolean b =true; for (int i = 0; i < goodsNums; i++) { b = dealAppUserIntegral(userIdFormRedis,tAppUser,merchandise.getIntegral()); } if (b){ switch (exchangeType.getGoodsType()){ case 2: @@ -1375,7 +1385,11 @@ break; case 2: // 积分+现金 boolean dealt = dealAppUserIntegral(userIdFormRedis,tAppUser,merchandise.getIntegral()); boolean dealt =true; for (int i = 0; i < goodsNums; i++) { dealt = dealAppUserIntegral(userIdFormRedis,tAppUser,merchandise.getIntegral()); } switch (exchangeType.getPayType()) { case 1: try { cloud-server-account/src/main/java/com/dsh/account/service/impl/UserIntegralChangesServiceImpl.java
@@ -98,7 +98,7 @@ if (null != recordId){ details = details.stream() .filter(obj -> obj instanceof IntegralsData) .filter(obj -> Objects.equals(obj.getDetailsType(), recordId)) .filter(obj -> !Objects.equals(obj.getDetailsType(), recordId)) .collect(Collectors.toList()); } } cloud-server-account/src/main/java/com/dsh/account/util/PayMoneyUtil.java
@@ -76,7 +76,7 @@ private String key = "";//微信商户号 private String callbackPath = "";//支付回调网关地址 private String callbackPath = "8.137.22.229:56666/account";//支付回调网关地址 private String app_cert_path = "C:/cert/alipay/user/app_cert_path.crt";//应用公钥证书路径 cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
@@ -719,9 +719,12 @@ if (merchandise.getRedemptionMethod() == 1){ detailsResponse.setExchangeType(1); detailsResponse.setIntegral(merchandise.getIntegral()); }else { }else if (merchandise.getRedemptionMethod() == 2){ detailsResponse.setExchangeType(2); detailsResponse.setIntegral(merchandise.getIntegral()); detailsResponse.setCash(merchandise.getCash()); }else if (merchandise.getRedemptionMethod() == 3){ detailsResponse.setExchangeType(3); detailsResponse.setCash(merchandise.getCash()); } detailsResponse.setStartTime(simpleDateFormat.format(merchandise.getStartTime())); @@ -861,6 +864,7 @@ if (c==null){ continue; } ExchangeDetailsResponse detailsResponse = new ExchangeDetailsResponse(); detailsResponse.setDetailsId(Long.valueOf(c.getId())); detailsResponse.setGoodName(c.getName()); @@ -1234,6 +1238,15 @@ } //拿到积分商品现金的消费记录 @ResponseBody @PostMapping("/base/pointMerchars/getConsumeDetails") public List<ConsumeDetail> getConsumeDetails(@RequestBody BillingDataRequestVo requestVo){ return upmseService.getConsumeDetails(requestVo); } public int dealTimeStatus(String startTime, String endTime){ cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java
@@ -171,19 +171,29 @@ @PostMapping("/userCoupon/queryUserCouponById") public UserCoupon queryUserCouponById(@RequestBody QueryUserCouponByIdAndUserId userCouponByIdAndUserId){ try { UserCoupon userCoupon = userCouponService.getOne(new LambdaQueryWrapper<UserCoupon>().eq(UserCoupon::getCouponId,userCouponByIdAndUserId.getId()).eq(UserCoupon::getUserId,userCouponByIdAndUserId.getUserId())); UserCoupon userCoupon = userCouponService.getOne(new LambdaQueryWrapper<UserCoupon>().eq(UserCoupon::getId,userCouponByIdAndUserId.getId()).eq(UserCoupon::getUserId,userCouponByIdAndUserId.getUserId())); return userCoupon; }catch (Exception e){ e.printStackTrace(); return null; } } @Autowired private ICouponService couponService; @PostMapping("/userCoupon/sendUserCoupon") public void sendUserCoupon(@RequestBody SendCouponReq sendCouponReq){ try { String couponIds = sendCouponReq.getCouponIds(); for (String s : couponIds.split(",")) { Coupon coupon = couponService.getById(s); //查询该优惠卷的数量够不够 List<Integer> queryIds = new ArrayList<>(); queryIds.add(coupon.getId()); int counts = userCouponService.count(new QueryWrapper<UserCoupon>().eq("couponId", s)); if (coupon.getQuantityIssued()<=counts){ continue; } UserCoupon userCoupon = new UserCoupon(); userCoupon.setCouponId(Integer.valueOf(s)); userCoupon.setUserId(sendCouponReq.getUserId()); @@ -205,6 +215,7 @@ @PostMapping("/userCoupon/updateUserCoupon") public void updateUserCoupon(@RequestBody UserCoupon userCoupon){ try { userCoupon.setUserId(null); userCouponService.updateById(userCoupon); }catch (Exception e){ e.printStackTrace(); cloud-server-activity/src/main/java/com/dsh/activity/entity/BillingDataRequestVo.java
New file @@ -0,0 +1,21 @@ package com.dsh.activity.entity; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; @Data public class BillingDataRequestVo { @ApiModelProperty(value = "开始时间") private String monthStart = null; @ApiModelProperty(value = "结束时间时间") private String monthEnd = null; @ApiModelProperty(value = "用户id") private Integer appUserId; } cloud-server-activity/src/main/java/com/dsh/activity/entity/ConsumeDetail.java
New file @@ -0,0 +1,22 @@ package com.dsh.activity.entity; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data public class ConsumeDetail { @ApiModelProperty(value = "名称") private String consumeName; @ApiModelProperty(value = "时间") private String consumeTime; @ApiModelProperty(value = "金额 例如 -90 ") private String consumeAmount; @ApiModelProperty(value = "1充值 2扣除") private Integer type; } cloud-server-activity/src/main/java/com/dsh/activity/mapper/UserPointsMerchandiseMapper.java
@@ -2,6 +2,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.dsh.activity.entity.BillingDataRequestVo; import com.dsh.activity.entity.ConsumeDetail; import com.dsh.activity.entity.UserPointsMerchandise; import com.dsh.activity.model.PointMerchandiseIncomeVo; import org.apache.ibatis.annotations.Param; @@ -24,4 +26,6 @@ Object changeState(List<Integer> ids, Integer state); List<ConsumeDetail> getConsumeDetails(BillingDataRequestVo requestVo); } cloud-server-activity/src/main/java/com/dsh/activity/service/UserPointsMerchandiseService.java
@@ -1,6 +1,8 @@ package com.dsh.activity.service; import com.baomidou.mybatisplus.extension.service.IService; import com.dsh.activity.entity.BillingDataRequestVo; import com.dsh.activity.entity.ConsumeDetail; import com.dsh.activity.entity.CourseChangeStateDTO; import com.dsh.activity.entity.UserPointsMerchandise; import com.dsh.activity.model.PointMerchandiseIncomeVo; @@ -22,4 +24,6 @@ List<PointMerchandiseIncomeVo> getAmount(); Object changeState(CourseChangeStateDTO dto); List<ConsumeDetail> getConsumeDetails(BillingDataRequestVo requestVo); } cloud-server-activity/src/main/java/com/dsh/activity/service/impl/UserPointsMerchandiseServiceImpl.java
@@ -1,6 +1,8 @@ package com.dsh.activity.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.dsh.activity.entity.BillingDataRequestVo; import com.dsh.activity.entity.ConsumeDetail; import com.dsh.activity.entity.CourseChangeStateDTO; import com.dsh.activity.entity.UserPointsMerchandise; import com.dsh.activity.mapper.UserPointsMerchandiseMapper; @@ -35,4 +37,9 @@ List<Integer> ids = dto.getIds(); return this.baseMapper.changeState(ids,dto.getState()); } @Override public List<ConsumeDetail> getConsumeDetails(BillingDataRequestVo requestVo) { return this.baseMapper.getConsumeDetails(requestVo); } } cloud-server-activity/src/main/resources/mapper/UserPointsMerchandiseMapper.xml
@@ -24,4 +24,29 @@ left join t_points_merchandise t2 on t1.pointsMerchandiseId = t2.id where t1.payStatus =2 </select> <select id="getConsumeDetails" resultType="com.dsh.activity.entity.ConsumeDetail"> SELECT CASE tm.type WHEN 1 THEN '实体购买' WHEN 2 THEN '课包购买' WHEN 3 THEN '门票购买' WHEN 4 THEN '优惠券购买' END AS consumeName ,DATE_FORMAT(pm.insertTime, '%m-%d %H:%i')as `consumeTime`,2 as type,CONCAT('-',tm.cash) as consumeAmount FROM t_user_points_merchandise pm LEFT JOIN t_points_merchandise tm ON tm.id = pm.pointsMerchandiseId WHERE pm.pointsMerchandiseId IN( SELECT id FROM t_points_merchandise WHERE redemptionMethod IN (2,3) ) <if test="null != monthStart and '' != monthStart and null != monthEnd and '' != monthEnd"> and DATE_FORMAT(pm.insertTime, '%Y-%m-%d %H:%i:%s') between #{monthStart} and #{monthEnd} </if> <if test="null != appUserId and '' != appUserId "> and pm.userId = #{appUserId} </if> </select> </mapper> cloud-server-competition/src/main/java/com/dsh/competition/feignclient/course/model/PaymentDeductionClassHour.java
@@ -24,4 +24,5 @@ * 用于支付的课程 */ private Long courseId; private Integer uid; } cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java
@@ -304,6 +304,7 @@ paymentDeductionClassHour.setClassHour(competition.getClassPrice()); paymentDeductionClassHour.setCode(code); paymentDeductionClassHour.setCourseId(paymentCompetitionVo.getCoursePaymentId()); paymentDeductionClassHour.setUid(uid); coursePackagePaymentClient.paymentDeductionClassHour(paymentDeductionClassHour); } paymentCompetition = paymentCompetitionService.getById(paymentCompetition.getId()); cloud-server-course/src/main/java/com/dsh/course/controller/CourseController.java
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.dsh.course.entity.*; import com.dsh.course.entity.dto.SelectDto; import com.dsh.course.feignclient.model.ExerciseVideo; import com.dsh.course.model.*; import com.dsh.course.model.dto.CourseChangeStateDTO; @@ -509,11 +510,15 @@ @Autowired private ICoursePackagePaymentConfigService packagePaymentConfigService; @PostMapping("/course/times") public List<Integer> times( @RequestBody Integer oneId){ public List<SelectDto> times(@RequestBody Integer oneId){ List<CoursePackagePaymentConfig> list = packagePaymentConfigService.list(new QueryWrapper<CoursePackagePaymentConfig>().eq("coursePackageId",oneId)); List<Integer> integerList = new ArrayList<>(); List<SelectDto> integerList = new ArrayList<>(); for (CoursePackagePaymentConfig coursePackagePaymentConfig : list) { integerList.add(coursePackagePaymentConfig.getClassHours()); // integerList.add(coursePackagePaymentConfig.getClassHours()); SelectDto selectDto = new SelectDto(); selectDto.setId(coursePackagePaymentConfig.getId()); selectDto.setValue(String.valueOf(coursePackagePaymentConfig.getClassHours())); integerList.add(selectDto); } cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackageController.java
@@ -185,11 +185,11 @@ @ApiImplicitParam(name = "lat",value = "纬度",dataType = "String"), }) public ResultUtil<ExchangeCoursePackageResponse> discountCourseDatas(Integer coursePackageDiscountId,String lon,String lat){ try { // try { return ResultUtil.success(tcpdService.getWeekFreeCourseDetails(coursePackageDiscountId,lat,lon)); }catch (Exception e){ return ResultUtil.runErr(); } // }catch (Exception e){ // return ResultUtil.runErr(); // } } cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java
@@ -54,10 +54,7 @@ import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Instant; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.ZoneId; import java.time.*; import java.time.temporal.ChronoUnit; import java.util.*; import java.util.stream.Collectors; @@ -437,6 +434,9 @@ if (byUserId.size() > 0 ){ for (TCoursePackagePayment tCoursePackagePayment : byUserId) { TCoursePackage tCoursePackage = tcpService.getById(tCoursePackagePayment.getCoursePackageId()); if (tCoursePackage.getType()==3){ continue; } StuCourseResp resp = new StuCourseResp(); resp.setCourseId(tCoursePackage.getId()); resp.setId(tCoursePackagePayment.getId()); @@ -1090,6 +1090,20 @@ } public static Date[] generateDateArray(int numDays,Date date) { // LocalDate tomorrow = LocalDate.now().plusDays(1); LocalDate tomorrow = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().plusDays(1); Date[] dates = new Date[numDays]; for (int i = 0; i < numDays; i++) { LocalDate currentDate = tomorrow.plusDays(i); dates[i] = Date.from(currentDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); } return dates; } @Autowired private TCoursePackageService packageService; @Autowired @@ -1103,18 +1117,23 @@ public void paymentDeductionClassHour(@RequestBody PaymentDeductionClassHour paymentDeductionClassHour){ try { // 2.0 用id进行查询 List<TCoursePackagePayment> list = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>().eq("id", paymentDeductionClassHour.getCourseId()).eq("payStatus", 2) TCoursePackagePayment coursePackagePayment= packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("id", paymentDeductionClassHour.getCourseId()).eq("payStatus", 2) .eq("status", 1).eq("state", 1).gt("laveClassHours", 0)); Integer classHour = paymentDeductionClassHour.getClassHour(); for (TCoursePackagePayment coursePackagePayment : list) { // for (TCoursePackagePayment coursePackagePayment : list) { if (coursePackagePayment.getLaveClassHours().compareTo(classHour) >= 0) { coursePackagePayment.setLaveClassHours(coursePackagePayment.getLaveClassHours() - classHour); coursePackagePayment.setAppUserId(null); packagePaymentService.updateById(coursePackagePayment); coursePackageSchedulingService.remove(new QueryWrapper<CoursePackageScheduling>().eq("courseId", coursePackagePayment.getCoursePackageId())); coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("coursePackageId", coursePackagePayment.getCoursePackageId())); // coursePackageSchedulingService.remove(new QueryWrapper<CoursePackageScheduling>().eq("courseId", coursePackagePayment.getCoursePackageId())); List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", coursePackagePayment.getStudentId()).eq("coursePackageId", coursePackagePayment.getCoursePackageId())); List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); coursePackageSchedulingService.remove(new QueryWrapper<CoursePackageScheduling>().in("id",collect)); coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", paymentDeductionClassHour.getId()).eq("coursePackageId", coursePackagePayment.getCoursePackageId())); @@ -1125,103 +1144,179 @@ String classWeeks = tCoursePackage.getClassWeeks(); List<Integer> week = week(classWeeks); List<TCoursePackagePayment> pays = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>().eq("coursePackageId", coursePackagePayment.getCoursePackageId()).eq("studentId", coursePackagePayment.getStudentId())); for (TCoursePackagePayment pay : pays) { List<CoursePackageStudent> studentCourse1 = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", pay.getStudentId()).eq("coursePackageId", pay.getCoursePackageId())); List<Long> collect1 = studentCourse1.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); //拿到最后一天的排课记录 CoursePackageScheduling cs = null; if (collect1.size()>0) { cs = coursePackageSchedulingService.getOne(new QueryWrapper<CoursePackageScheduling>().in("id", collect1).orderByDesc("classDate").last("limit 1")); } // // Calendar calendar = Calendar.getInstance(); // Date currentDate = calendar.getTime(); // calendar.add(Calendar.DAY_OF_MONTH, -1); // Date today = calendar.getTime(); Date today = new Date(); //判断最后一天是否超过当前日期 if (cs==null||cs.getClassDate().before(new Date())){ }else { today = cs.getClassDate(); } Integer laveClassHours = pay.getLaveClassHours(); Integer codeTime = tCoursePackage.getCodeTime(); Integer can = laveClassHours/codeTime; int count = 0; String[] split = tCoursePackage.getClassStartTime().split(","); String[] split1 = tCoursePackage.getClassEndTime().split(","); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); // 本周周几 int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date()) - 1; for (Integer integer : week) { if (integer < i) { // 找下一周的时间 Calendar instance = Calendar.getInstance(); instance.add(Calendar.DATE, 7 - (i - integer)); Date time = instance.getTime(); Date[] dates = generateDateArray(14,today); for (Date date : dates) { if (count==can){ break; } int wei = cn.hutool.core.date.DateUtil.dayOfWeek(date); if (week.contains(wei)){ for (int i1 = 0; i1 < split.length; i1++) { CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); Date parse = format1.parse(format.format(time) + " " + split[i1]); Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); coursePackageScheduling.setClassDate(parse); coursePackageScheduling.setEndDate(parse1); coursePackageScheduling.setStatus(1); coursePackageSchedulingService.save(coursePackageScheduling); CoursePackageStudent student1 = new CoursePackageStudent(); student1.setAppUserId(student.getAppUserId()); student1.setStudentId(student.getId()); student1.setCoursePackageId(tCoursePackage.getId()); student1.setCoursePackagePaymentId(coursePackagePayment.getId()); student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); student1.setSignInOrNot(1); student1.setReservationStatus(1); student1.setInsertTime(new Date()); studentService.save(student1); } } else if (integer > i) { Calendar instance = Calendar.getInstance(); instance.add(Calendar.DATE, integer - i); Date time1 = instance.getTime(); List<Date> list6 = new ArrayList<>(); list6.add(time1); instance.add(Calendar.DATE, 7); Date time2 = instance.getTime(); list6.add(time2); for (Date time : list6) { for (int i1 = 0; i1 < split.length; i1++) { CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); Date parse = format1.parse(format.format(time) + " " + split[i1]); Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); coursePackageScheduling.setClassDate(parse); coursePackageScheduling.setEndDate(parse1); coursePackageScheduling.setStatus(1); coursePackageSchedulingService.save(coursePackageScheduling); CoursePackageStudent student1 = new CoursePackageStudent(); student1.setAppUserId(student.getAppUserId()); student1.setStudentId(student.getId()); student1.setCoursePackageId(tCoursePackage.getId()); student1.setCoursePackagePaymentId(coursePackagePayment.getId()); student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); student1.setSignInOrNot(1); student1.setReservationStatus(1); student1.setInsertTime(new Date()); studentService.save(student1); if (count==can){ break; } } } else { Calendar instance = Calendar.getInstance(); instance.add(Calendar.DATE, 7); Date time = instance.getTime(); for (int i1 = 0; i1 < split.length; i1++) { CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); Date parse = format1.parse(format.format(time) + " " + split[i1]); Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); Date parse = format1.parse(format.format(date) + " " + split[i1]); Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); coursePackageScheduling.setClassDate(parse); coursePackageScheduling.setEndDate(parse1); coursePackageScheduling.setStatus(1); coursePackageSchedulingService.save(coursePackageScheduling); CoursePackageStudent student1 = new CoursePackageStudent(); student1.setAppUserId(student.getAppUserId()); student1.setStudentId(student.getId()); student1.setCoursePackageId(tCoursePackage.getId()); student1.setCoursePackagePaymentId(coursePackagePayment.getId()); student1.setAppUserId(pay.getAppUserId()); student1.setStudentId(pay.getStudentId()); student1.setCoursePackageId(pay.getCoursePackageId()); student1.setCoursePackagePaymentId(pay.getId()); student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); student1.setSignInOrNot(1); student1.setReservationStatus(1); student1.setInsertTime(new Date()); studentService.save(student1); count++; } } } } // // 本周周几 // int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date()) - 1; // for (Integer integer : week) { // if (integer < i) { // // 找下一周的时间 // Calendar instance = Calendar.getInstance(); // instance.add(Calendar.DATE, 7 - (i - integer)); // Date time = instance.getTime(); // // for (int i1 = 0; i1 < split.length; i1++) { // // CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); // coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); // Date parse = format1.parse(format.format(time) + " " + split[i1]); // Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); // coursePackageScheduling.setClassDate(parse); // coursePackageScheduling.setEndDate(parse1); // coursePackageScheduling.setStatus(1); // coursePackageSchedulingService.save(coursePackageScheduling); // CoursePackageStudent student1 = new CoursePackageStudent(); // student1.setAppUserId(student.getAppUserId()); // student1.setStudentId(student.getId()); // student1.setCoursePackageId(tCoursePackage.getId()); // student1.setCoursePackagePaymentId(coursePackagePayment.getId()); // student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); // student1.setSignInOrNot(1); // student1.setReservationStatus(1); // student1.setInsertTime(new Date()); // studentService.save(student1); // // } // // } else if (integer > i) { // Calendar instance = Calendar.getInstance(); // instance.add(Calendar.DATE, integer - i); // Date time1 = instance.getTime(); // List<Date> list6 = new ArrayList<>(); // list6.add(time1); // instance.add(Calendar.DATE, 7); // Date time2 = instance.getTime(); // list6.add(time2); // for (Date time : list6) { // for (int i1 = 0; i1 < split.length; i1++) { // CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); // coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); // Date parse = format1.parse(format.format(time) + " " + split[i1]); // Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); // coursePackageScheduling.setClassDate(parse); // coursePackageScheduling.setEndDate(parse1); // coursePackageScheduling.setStatus(1); // coursePackageSchedulingService.save(coursePackageScheduling); // // CoursePackageStudent student1 = new CoursePackageStudent(); // student1.setAppUserId(student.getAppUserId()); // student1.setStudentId(student.getId()); // student1.setCoursePackageId(tCoursePackage.getId()); // student1.setCoursePackagePaymentId(coursePackagePayment.getId()); // student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); // student1.setSignInOrNot(1); // student1.setReservationStatus(1); // student1.setInsertTime(new Date()); // studentService.save(student1); // } // } // // } else { // Calendar instance = Calendar.getInstance(); // instance.add(Calendar.DATE, 7); // Date time = instance.getTime(); // // for (int i1 = 0; i1 < split.length; i1++) { // CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); // coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); // Date parse = format1.parse(format.format(time) + " " + split[i1]); // Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); // coursePackageScheduling.setClassDate(parse); // coursePackageScheduling.setEndDate(parse1); // coursePackageScheduling.setStatus(1); // coursePackageSchedulingService.save(coursePackageScheduling); // // CoursePackageStudent student1 = new CoursePackageStudent(); // student1.setAppUserId(student.getAppUserId()); // student1.setStudentId(student.getId()); // student1.setCoursePackageId(tCoursePackage.getId()); // student1.setCoursePackagePaymentId(coursePackagePayment.getId()); // student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); // student1.setSignInOrNot(1); // student1.setReservationStatus(1); // student1.setInsertTime(new Date()); // studentService.save(student1); // } // } // } // 2.0 少于3课时 推送 @@ -1249,7 +1344,7 @@ cancelledClasses.setCancelledClassesNumber(classHour); cancelledClasses.setInsertTime(new Date()); cancelledClassesService.save(cancelledClasses); break; }else{ CancelledClasses cancelledClasses = new CancelledClasses(); cancelledClasses.setType(2); @@ -1265,7 +1360,7 @@ classHour -= cancelledClasses.getCancelledClassesNumber(); } } // } }catch (Exception e){ @@ -1712,13 +1807,18 @@ in(CoursePackageStudent::getCoursePackagePaymentId, ids) ); detailsListVo.setType(1); if(list4.size()>0){ Integer signInOrNot = list4.get(0).getSignInOrNot(); detailsListVo.setType(1); if(signInOrNot==2){ detailsListVo.setType(3); } detailsListVo.setIsType(list4.get(0).getType()); }else { detailsListVo.setType(2); } } else { cloud-server-course/src/main/java/com/dsh/course/feignclient/model/PaymentDeductionClassHour.java
@@ -24,4 +24,5 @@ * 用于支付的课程 */ private Long courseId; private Integer uid; } cloud-server-course/src/main/java/com/dsh/course/model/vo/RegisterCourseVo.java
@@ -36,5 +36,7 @@ @ApiModelProperty(value = "1常规 2假期 3体验") private Integer type; @ApiModelProperty(value = "假期课时间段") private String time; } cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageDiscountServiceImpl.java
@@ -319,7 +319,7 @@ JSONArray jsonArray = JSON.parseArray(coursePackageDiscount.getContent()); JSONObject jsonObject = jsonArray.getJSONObject(0); CoursePackagePaymentConfig paymentConfig = cppcMapper.selectById(coursePackageDiscount.getCoursePackagePaymentConfigId()); if (coursePackageDiscount.getType() == 3){ if (coursePackageDiscount.getType() == 3 ||coursePackageDiscount.getType() == 4){ Double cashPayment = jsonObject.getDouble("cashPayment"); packageResponse.setClassHours(paymentConfig.getClassHours()); packageResponse.setCostPrice(paymentConfig.getCashPayment()); cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java
@@ -388,6 +388,9 @@ registerCourseVo.setCourseTime(new SimpleDateFormat("yyyy-MM-dd").format(tCoursePackagePayment.getInsertTime())); Coach coach = coachClient.queryCoachById(coursePackage.getCoachId()); registerCourseVo.setCourseTeacher(ToolUtil.isEmpty(coach) ? "" : coach.getName()); if (coursePackage.getType()==2) { registerCourseVo.setTime(new SimpleDateFormat("yyyy-MM-dd").format(coursePackage.getStartTime()) + "-" + new SimpleDateFormat("yyyy-MM-dd").format(coursePackage.getEndTime())); } List<CoursePackageStudent> coursePackageStudents = cpsMapper.selectList(new QueryWrapper<CoursePackageStudent>() .eq("coursePackageId",coursePackage.getId()) .eq("studentId",appUserId )); @@ -840,8 +843,10 @@ }else if(coursePackageStudent.getSignInOrNot()==2){ recordVo.setStatus(5); }else { // CancelledClasses cancelledClasses = cacMapper.selectOne(new QueryWrapper<CancelledClasses>() // .eq("coursePackageId",coursePackageStudent.getCoursePackageId())); CancelledClasses cancelledClasses = cacMapper.selectOne(new QueryWrapper<CancelledClasses>() .eq("coursePackageId",coursePackageStudent.getCoursePackageId() )); .eq("coursePackageSchedulingId",byId.getId())); if (ToolUtil.isNotEmpty(cancelledClasses)){ recordVo.setStatus(3); // 消课 到课状态0 旷课 cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java
@@ -42,6 +42,8 @@ import java.math.RoundingMode; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.ZoneId; import java.util.*; import java.util.stream.Collectors; @@ -122,8 +124,11 @@ Map<String, String> geocode = gdMapGeocodingUtil.geocode(coursePackageList.getLon(), coursePackageList.getLat()); String provinceCode = geocode.get("provinceCode"); String cityCode = geocode.get("cityCode"); // QueryWrapper<TCoursePackage> wrapper = new QueryWrapper<TCoursePackage>().in("status", Arrays.asList(1, 2)) // .eq("auditStatus", 2).eq("state", 1).eq("provinceCode", provinceCode).eq("cityCode", cityCode); QueryWrapper<TCoursePackage> wrapper = new QueryWrapper<TCoursePackage>().in("status", Arrays.asList(1, 2)) .eq("auditStatus", 2).eq("state", 1).eq("provinceCode", provinceCode).eq("cityCode", cityCode); .eq("auditStatus", 2).eq("state", 1); if(null != coursePackageList.getCoursePackageTypeId()){ wrapper.eq("coursePackageTypeId", coursePackageList.getCoursePackageTypeId()); } @@ -141,7 +146,7 @@ wrapper.or().in("storeId", collect); } } List<TCoursePackage> list = this.list(wrapper.last(" order by sort, insertTime desc")); List<TCoursePackage> list = this.list(wrapper.last(" order by sort desc, insertTime desc")); List<CoursePackageListVo> listVos = new ArrayList<>(); for (TCoursePackage coursePackage : list) { Store store = storeClient.queryStoreById(coursePackage.getStoreId()); @@ -707,6 +712,15 @@ public ResultUtil paymentCourse(Integer uid, PaymentCourseVo paymentCourseVo) throws Exception { AppUser appUser = appUserClient.queryAppUser(uid); CoursePackageInfo coursePackageInfo = queryCourseInfo(uid, paymentCourseVo.getId(), null, null); //校验是否已经报满 Integer integer = coursePackagePaymentService.queryCountNumber(paymentCourseVo.getId()); TCoursePackage course = coursePackageService.getById(paymentCourseVo.getId()); if (integer>=course.getMaxSubscribeNumber()){ return ResultUtil.error("报名失败,已达最大报名人数"); } List<CoursePackagePaymentConfigVo> list = coursePackageInfo.getList(); String[] students = paymentCourseVo.getStudentIds().split(";"); @@ -996,16 +1010,14 @@ coursePackagePaymentService.updateBatchById(list); System.out.println("===========到达支付"); // 2.0 String[] coupons = coursePackagePaymentConfig.getCouponIds().split(","); userCouponClient.sendUserCoupon(new SendCouponReq(uid,coursePackagePaymentConfig.getCouponIds())); moneyOut(tradeNo,tradeNo); @@ -1132,6 +1144,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); for (String s : split) { TCoursePackagePayment coursePackagePayment = new TCoursePackagePayment(); coursePackagePayment.setCode(code); coursePackagePayment.setAppUserId(appUser.getId()); @@ -1156,7 +1169,7 @@ if(student!=null){ sId=student.getId(); } addPackageStudent(paymentCourseVo.getId(),appUser.getId(),sId,coursePackagePayment.getId()); addPackageStudent(paymentCourseVo.getId(),appUser.getId(), Integer.valueOf(s),coursePackagePayment.getId()); } Integer playPaiCoins = appUser.getPlayPaiCoins(); @@ -1173,6 +1186,9 @@ } private void addPackageStudent(Integer courseId, Integer userId, Integer sId,Long paymentId) throws ParseException { // 课包 TCoursePackage tCoursePackage = this.baseMapper.selectById(courseId); @@ -1184,26 +1200,74 @@ String[] split1 = tCoursePackage.getClassEndTime().split(","); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); //查出当前用户当前学员当前课包最后一天的排课数据 List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", sId).eq("coursePackageId", courseId)); List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); //拿到最后一天的排课记录 CoursePackageScheduling cs = null; if (collect.size()>0) { cs = coursePackageSchedulingService.getOne(new QueryWrapper<CoursePackageScheduling>().in("id", collect).orderByDesc("classDate").last("limit 1")); } int i = -1; // Calendar calendar = Calendar.getInstance(); // Date currentDate = calendar.getTime(); // calendar.add(Calendar.DAY_OF_MONTH, -1); // Date today = calendar.getTime(); Date today = new Date(); //判断最后一天是否超过当前日期 if (cs==null||cs.getClassDate().before(new Date())){ i = DateUtil.dayOfWeek(new Date())-1; }else { i = DateUtil.dayOfWeek(cs.getClassDate())-1; today = cs.getClassDate(); } TCoursePackagePayment pay = coursePackagePaymentService.getById(paymentId); Integer laveClassHours = pay.getLaveClassHours(); Integer codeTime = tCoursePackage.getCodeTime(); Integer can = 0; int count = 0; // 本周周几 int i = DateUtil.dayOfWeek(new Date())-1; for (Integer integer : week) { if(integer<i){ // 找下一周的时间 Calendar instance = Calendar.getInstance(); instance.add(Calendar.DATE,7-(i-integer)); Date time = instance.getTime(); // int i = DateUtil.dayOfWeek(new Date())-1; Date[] dates = generateDateArray(14,today); if (tCoursePackage.getType()==1){ can = laveClassHours/codeTime; } if (tCoursePackage.getType()==2){ Date startDate = tCoursePackage.getStartTime(); Date endDate = tCoursePackage.getEndTime(); dates = generateDateArray1(startDate, endDate); can = 999; } for (Date date : dates) { if (count==can){ break; } int wei = DateUtil.dayOfWeek(date); if (week.contains(wei)){ for (int i1 = 0; i1 < split.length; i1++) { if (count==can){ break; } CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); Date parse = format1.parse(format.format(time) + " " + split[i1]); Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); coursePackageScheduling.setClassDate(parse); coursePackageScheduling.setEndDate(parse1); coursePackageScheduling.setStatus(1); coursePackageSchedulingService.save(coursePackageScheduling); Date parse = format1.parse(format.format(date) + " " + split[i1]); Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); coursePackageScheduling.setClassDate(parse); coursePackageScheduling.setEndDate(parse1); coursePackageScheduling.setStatus(1); coursePackageSchedulingService.save(coursePackageScheduling); CoursePackageStudent student1 = new CoursePackageStudent(); student1.setAppUserId(userId); student1.setStudentId(sId); @@ -1214,75 +1278,151 @@ student1.setReservationStatus(1); student1.setInsertTime(new Date()); cpsMapper.insert(student1); } }else if(integer>i) { Calendar instance = Calendar.getInstance(); instance.add(Calendar.DATE,integer-i); Date time1 = instance.getTime(); List<Date> list = new ArrayList<>(); list.add(time1); instance.add(Calendar.DATE,7); Date time2 = instance.getTime(); list.add(time2); for (Date time : list) { for (int i1 = 0; i1 < split.length; i1++) { CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); Date parse = format1.parse(format.format(time) + " " + split[i1]); Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); coursePackageScheduling.setClassDate(parse); coursePackageScheduling.setEndDate(parse1); coursePackageScheduling.setStatus(1); coursePackageSchedulingService.save(coursePackageScheduling); CoursePackageStudent student1 = new CoursePackageStudent(); student1.setAppUserId(userId); student1.setStudentId(sId); student1.setCoursePackageId(tCoursePackage.getId()); student1.setCoursePackagePaymentId(paymentId); student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); student1.setSignInOrNot(1); student1.setReservationStatus(1); student1.setInsertTime(new Date()); cpsMapper.insert(student1); } } }else { Calendar instance = Calendar.getInstance(); instance.add(Calendar.DATE,7); Date time = instance.getTime(); for (int i1 = 0; i1 < split.length; i1++) { CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); Date parse = format1.parse(format.format(time) + " " + split[i1]); Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); coursePackageScheduling.setClassDate(parse); coursePackageScheduling.setEndDate(parse1); coursePackageScheduling.setStatus(1); coursePackageSchedulingService.save(coursePackageScheduling); CoursePackageStudent student1 = new CoursePackageStudent(); student1.setAppUserId(userId); student1.setStudentId(sId); student1.setCoursePackageId(tCoursePackage.getId()); student1.setCoursePackagePaymentId(paymentId); student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); student1.setSignInOrNot(1); student1.setReservationStatus(1); student1.setInsertTime(new Date()); cpsMapper.insert(student1); count++; } } } // for (Integer integer : week) { // if (count==can){ // break; // } // if(integer<i){ // // 找下一周的时间 // Calendar instance = Calendar.getInstance(); // if (cs==null||cs.getClassDate().before(new Date())){ // instance = Calendar.getInstance(); // }else { //// i = DateUtil.dayOfWeek(cs.getClassDate())-1; // instance.setTime(cs.getClassDate()); // } // instance.add(Calendar.DATE,7-(i-integer)); // Date time = instance.getTime(); // // for (int i1 = 0; i1 < split.length; i1++) { // if (count==can){ // break; // } // // CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); // coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); // Date parse = format1.parse(format.format(time) + " " + split[i1]); // Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); // coursePackageScheduling.setClassDate(parse); // coursePackageScheduling.setEndDate(parse1); // coursePackageScheduling.setStatus(1); // coursePackageSchedulingService.save(coursePackageScheduling); // // CoursePackageStudent student1 = new CoursePackageStudent(); // student1.setAppUserId(userId); // student1.setStudentId(sId); // student1.setCoursePackageId(tCoursePackage.getId()); // student1.setCoursePackagePaymentId(paymentId); // student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); // student1.setSignInOrNot(1); // student1.setReservationStatus(1); // student1.setInsertTime(new Date()); // cpsMapper.insert(student1); // count++; // } // // // }else if(integer>i) { // if (count==can){ // break; // } // //// Calendar instance = Calendar.getInstance(); // // Calendar instance = Calendar.getInstance(); // if (cs==null||cs.getClassDate().before(new Date())){ // instance = Calendar.getInstance(); // }else { //// i = DateUtil.dayOfWeek(cs.getClassDate())-1; // instance.setTime(cs.getClassDate()); // } // instance.add(Calendar.DATE,integer-i); // Date time1 = instance.getTime(); // List<Date> list = new ArrayList<>(); // list.add(time1); // instance.add(Calendar.DATE,7); // Date time2 = instance.getTime(); // list.add(time2); // for (Date time : list) { // for (int i1 = 0; i1 < split.length; i1++) { // CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); // coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); // Date parse = format1.parse(format.format(time) + " " + split[i1]); // Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); // coursePackageScheduling.setClassDate(parse); // coursePackageScheduling.setEndDate(parse1); // coursePackageScheduling.setStatus(1); // coursePackageSchedulingService.save(coursePackageScheduling); // // CoursePackageStudent student1 = new CoursePackageStudent(); // student1.setAppUserId(userId); // student1.setStudentId(sId); // student1.setCoursePackageId(tCoursePackage.getId()); // student1.setCoursePackagePaymentId(paymentId); // student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); // student1.setSignInOrNot(1); // student1.setReservationStatus(1); // student1.setInsertTime(new Date()); // cpsMapper.insert(student1); // count++; // // } // } // // }else { //// Calendar instance = Calendar.getInstance(); // Calendar instance = Calendar.getInstance(); // if (cs==null||cs.getClassDate().before(new Date())){ // instance = Calendar.getInstance(); // }else { //// i = DateUtil.dayOfWeek(cs.getClassDate())-1; // instance.setTime(cs.getClassDate()); // } // instance.add(Calendar.DATE,7); // Date time = instance.getTime(); // // for (int i1 = 0; i1 < split.length; i1++) { // if (count==can){ // break; // } // // CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); // coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); // Date parse = format1.parse(format.format(time) + " " + split[i1]); // Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); // coursePackageScheduling.setClassDate(parse); // coursePackageScheduling.setEndDate(parse1); // coursePackageScheduling.setStatus(1); // coursePackageSchedulingService.save(coursePackageScheduling); // // CoursePackageStudent student1 = new CoursePackageStudent(); // student1.setAppUserId(userId); // student1.setStudentId(sId); // student1.setCoursePackageId(tCoursePackage.getId()); // student1.setCoursePackagePaymentId(paymentId); // student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); // student1.setSignInOrNot(1); // student1.setReservationStatus(1); // student1.setInsertTime(new Date()); // cpsMapper.insert(student1); // count++; // // } // } // } // 2.0 TCourseInfoRecord tCourseInfoRecord = new TCourseInfoRecord(); tCourseInfoRecord.setUserId(userId); tCourseInfoRecord.setCourseId(courseId); tCourseInfoRecord.setName("报名假期班"); tCourseInfoRecord.setName("报名运动营"); tCourseInfoRecord.setNum(tCoursePackage.getNeedNum()); tCourseInfoRecord.setTime(new Date()); tCourseInfoRecord.setType(2); @@ -1290,6 +1430,28 @@ } public static Date[] generateDateArray1(Date startDate, Date endDate) { List<Date> dateList = new ArrayList<>(); Calendar calendar = Calendar.getInstance(); calendar.setTime(startDate); while (!calendar.getTime().after(endDate)) { Date currentDate = calendar.getTime(); dateList.add(currentDate); calendar.add(Calendar.DAY_OF_MONTH, 1); } return dateList.toArray(new Date[0]); } public static Date createDate1(int year, int month, int day) { Calendar calendar = Calendar.getInstance(); calendar.set(year, month - 1, day); return calendar.getTime(); } private List<Integer> week(String week){ String[] split = week.split(";"); ArrayList<Integer> integers = new ArrayList<>(); @@ -1322,6 +1484,20 @@ } public static Date[] generateDateArray(int numDays,Date date) { // LocalDate tomorrow = LocalDate.now().plusDays(1); LocalDate tomorrow = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().plusDays(1); Date[] dates = new Date[numDays]; for (int i = 0; i < numDays; i++) { LocalDate currentDate = tomorrow.plusDays(i); dates[i] = Date.from(currentDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); } return dates; } /** * 获取课包管理列表数据 * @param queryCoursePackageLists cloud-server-course/src/main/resources/mapper/TCoursePackagePaymentMapper.xml
@@ -38,7 +38,7 @@ SELECT count( 1 ) AS num FROM ( SELECT appUserId FROM t_course_package_payment WHERE payStatus = 2 AND state = 1 and coursePackageId = #{coursePackageId} GROUP BY appUserId SELECT studentId FROM t_course_package_payment WHERE payStatus = 2 AND state = 1 and coursePackageId = #{coursePackageId} GROUP BY studentId ) AS aa </select> @@ -52,7 +52,7 @@ <select id="billingDataRequestVo" resultType="com.dsh.course.model.BillingRequest"> SELECT DATE_FORMAT(insertTime, '%m-%d %H:%i')as `time`,IFNULL(playPaiCoin, cashPayment) AS amount from t_course_package_payment where payStatus = 2 and state = 1 and payType = 3 where payStatus = 2 and state = 1 and payType in (1,2) <if test="null != monthStart and '' != monthStart and null != monthEnd and '' != monthEnd"> and DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') between #{monthStart} and #{monthEnd} </if> cloud-server-management/src/main/java/com/dsh/course/feignClient/course/CourseClient.java
@@ -6,6 +6,7 @@ import com.dsh.course.model.AuditDiscount; import com.dsh.guns.modular.system.model.*; import com.dsh.guns.modular.system.model.dto.CoursePackage; import com.dsh.guns.modular.system.model.dto.SelectDto; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -135,5 +136,5 @@ Boolean auditDiscount(AuditDiscount auditDiscount); @PostMapping("/course/times") List<Integer> timeChange(@RequestBody Integer oneId); List<SelectDto> timeChange(@RequestBody Integer oneId); } cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCityController.java
@@ -22,6 +22,7 @@ import com.dsh.guns.modular.system.model.TCourse; import com.dsh.guns.modular.system.model.TStore; import com.dsh.guns.modular.system.model.User; import com.dsh.guns.modular.system.model.dto.SelectDto; import com.dsh.guns.modular.system.service.ICityService; import com.dsh.guns.modular.system.service.IStoreService; import org.springframework.beans.factory.annotation.Autowired; @@ -115,9 +116,8 @@ private CourseClient courseClient; @RequestMapping(value = "/timeChange") @ResponseBody public List<Integer> timeChange(Integer oneId) { List<Integer> integerList = courseClient.timeChange(oneId); public List<SelectDto> timeChange(Integer oneId) { List<SelectDto> integerList = courseClient.timeChange(oneId); return integerList ; } cloud-server-management/src/main/webapp/static/modular/system/tGoods/tGoods_info.js
@@ -1038,7 +1038,7 @@ var content='<option value="">Pilih franchisee Anda</option>'; } $.each(data, function(k,v) { content += "<option value='"+v+"'>"+v+"</option>"; content += "<option value='"+v.id+"'>"+v.value+"</option>"; }); $("#coursePackageConfigId").empty().append(content); } cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
@@ -351,7 +351,7 @@ if(reservationSite.getIsHalf()==2){ payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue() ; }else { payMoney = new BigDecimal(site.getPlayPaiCoinOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue() /2; payMoney = new BigDecimal(site.getPlayPaiCoinOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); } if(appUser.getPlayPaiCoins().compareTo(payMoney.intValue()) < 0){ @@ -361,7 +361,7 @@ if(reservationSite.getIsHalf()==2){ payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue() ; }else { payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue() / 2; payMoney = new BigDecimal(site.getCashPriceOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); } } @@ -387,7 +387,7 @@ JSONObject jsonObject = JSON.parseObject(coupon.getContent()); Double num1 = jsonObject.getDouble("conditionalAmount"); Double num2 = jsonObject.getDouble("deductionAmount"); if(payMoney.compareTo(num1) <= 0){ if(payMoney.compareTo(num1) < 0){ return ResultUtil.error("该优惠券无法使用"); }