| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.entity.CancelledClasses; |
| | | import com.dsh.course.entity.TCoursePackagePayment; |
| | | import com.dsh.course.feignclient.model.GetStuSessionList; |
| | | import com.dsh.course.feignclient.model.PurchaseRecordVo; |
| | | import com.dsh.course.service.CancelledClassesService; |
| | | import com.dsh.course.service.CourseCounsumService; |
| | | import com.dsh.course.service.TCoursePackagePaymentService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class CancelSourceController { |
| | | |
| | | |
| | | @Autowired |
| | | private CancelledClassesService caceService; |
| | |
| | | |
| | | /** |
| | | * 获取课包对应的消费记录 |
| | | * @param stuId 学员id |
| | | * @param appUserId 用户id |
| | | * |
| | | * @param sessionList |
| | | * @return |
| | | */ |
| | | @PostMapping("/cancelSource/cancelList") |
| | | public List<PurchaseRecordVo> getCancelCourseList(@RequestBody Date startTime,@RequestBody Date endTime,@RequestBody Integer stuId,@RequestBody Integer appUserId){ |
| | | @PostMapping("/base/cancelSource/cancelList") |
| | | public List<PurchaseRecordVo> getCancelCourseList(@RequestBody GetStuSessionList sessionList) { |
| | | List<PurchaseRecordVo> purchaseRecordVos = new ArrayList<>(); |
| | | List<TCoursePackagePayment> tCoursePackagePayments = tcppService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .between("insertTime", sessionList.getStartTime(), sessionList.getEndTime()) |
| | | .eq("appUserId", sessionList.getAppUserId()) |
| | | .eq("studentId", sessionList.getStuId())); |
| | | if (tCoursePackagePayments.size() > 0) { |
| | | List<Long> coursePackageIds = tCoursePackagePayments.stream().map(TCoursePackagePayment::getId).collect(Collectors.toList()); |
| | | |
| | | List<TCoursePackagePayment> tCoursePackagePayments = tcppService.queryAllCoursePackage(startTime,endTime,null,stuId, appUserId); |
| | | List<Integer> coursePackageIds = tCoursePackagePayments.stream().map(TCoursePackagePayment::getId).collect(Collectors.toList()); |
| | | |
| | | List<CancelledClasses> list = caceService.list(new QueryWrapper<CancelledClasses>() |
| | | .in("coursePackageId", coursePackageIds) |
| | | .between("insertTime",startTime,endTime)); |
| | | if (list.size() > 0){ |
| | | list.forEach( canse -> { |
| | | PurchaseRecordVo purchaseRecordVo = new PurchaseRecordVo(); |
| | | purchaseRecordVo.setPurchaseTime(format.format(canse.getInsertTime())); |
| | | purchaseRecordVo.setPurchaseType(""); |
| | | purchaseRecordVo.setPurchaseAmount("-"+canse.getCancelledClassesNumber()); |
| | | purchaseRecordVos.add(purchaseRecordVo); |
| | | }); |
| | | List<CancelledClasses> list = caceService.list(new QueryWrapper<CancelledClasses>() |
| | | .in("coursePackageId", coursePackageIds) |
| | | .between("insertTime", sessionList.getStartTime(), sessionList.getEndTime())); |
| | | if (list.size() > 0) { |
| | | list.forEach(canse -> { |
| | | PurchaseRecordVo purchaseRecordVo = new PurchaseRecordVo(); |
| | | purchaseRecordVo.setPurchaseTime(format.format(canse.getInsertTime())); |
| | | purchaseRecordVo.setPurchaseType(""); |
| | | purchaseRecordVo.setPurchaseAmount("-" + canse.getCancelledClassesNumber()); |
| | | purchaseRecordVos.add(purchaseRecordVo); |
| | | }); |
| | | } |
| | | } |
| | | return purchaseRecordVos; |
| | | } |