| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.AuditCourseOrderRefundDTO; |
| | | import com.ruoyi.system.model.TCourse; |
| | | import com.ruoyi.system.model.TCourseOrder; |
| | | import com.ruoyi.system.query.TCourseOrderQuery; |
| | | import com.ruoyi.system.query.TCourseQuery; |
| | | import com.ruoyi.system.service.TCourseOrderService; |
| | | import com.ruoyi.system.service.TCourseService; |
| | | import com.ruoyi.system.vo.TCourseOrderVO; |
| | | import com.ruoyi.system.vo.TCourseVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2025-11-06 |
| | | */ |
| | | @Api(tags = "课程订单管理") |
| | | @RestController |
| | | @RequestMapping("/t-course-order") |
| | | public class TCourseOrderController { |
| | | |
| | | private final TCourseService courseService; |
| | | private final TCourseOrderService courseOrderService; |
| | | private final TokenService tokenService; |
| | | @Autowired |
| | | public TCourseOrderController(TCourseService courseService, TCourseOrderService courseOrderService, TokenService tokenService) { |
| | | this.courseService = courseService; |
| | | this.courseOrderService = courseOrderService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | /** |
| | | * 获取课程订单管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取课程报名记录分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TCourseOrderVO>> pageList(@RequestBody TCourseOrderQuery query) { |
| | | return R.ok(courseOrderService.pageList(query)); |
| | | } |
| | | /** |
| | | * 获取课程申请退款记录分页列表 |
| | | */ |
| | | @ApiOperation(value = "获取课程申请退款记录分页列表") |
| | | @PostMapping(value = "/refundPageList") |
| | | public R<PageInfo<TCourseOrderVO>> refundPageList(@RequestBody TCourseOrderQuery query) { |
| | | return R.ok(courseOrderService.refundPageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 获取课程订单管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取课程订单管理列表") |
| | | @PostMapping(value = "/list") |
| | | public R<List<TCourseOrder>> list() { |
| | | return R.ok(courseOrderService.list(Wrappers.lambdaQuery(TCourseOrder.class).orderByDesc(TCourseOrder::getCreateTime))); |
| | | } |
| | | |
| | | /** |
| | | * 查看课程订单管理详情 |
| | | */ |
| | | @ApiOperation(value = "查看课程订单管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TCourseOrderVO> getDetailById(@RequestParam String id) { |
| | | TCourseOrder courseOrder = courseOrderService.getById(id); |
| | | TCourseOrderVO courseOrderVO = new TCourseOrderVO(); |
| | | BeanUtils.copyProperties(courseOrder, courseOrderVO); |
| | | // 查询课程信息 |
| | | TCourse course = courseService.getById(courseOrder.getCourseId()); |
| | | courseOrderVO.setCourseTitle(course.getCourseTitle()); |
| | | courseOrderVO.setCourseCost(course.getCourseCost()); |
| | | courseOrderVO.setCourseLecturer(course.getCourseLecturer()); |
| | | courseOrderVO.setCourseCover(course.getCourseCover()); |
| | | courseOrderVO.setCourseType(course.getCourseType()); |
| | | courseOrderVO.setReleaseTime(course.getCreateTime()); |
| | | return R.ok(courseOrderVO); |
| | | } |
| | | |
| | | /** |
| | | * 审核课程订单管理退款申请 |
| | | */ |
| | | @Log(title = "课程订单管理信息-审核课程订单管理退款申请", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "审核课程订单管理退款申请") |
| | | @PostMapping(value = "/auditCourseOrderRefund") |
| | | public R<String> auditCourseOrderRefund(@Validated @RequestBody AuditCourseOrderRefundDTO dto) { |
| | | TCourseOrder courseOrder = courseOrderService.getById(dto.getId()); |
| | | courseOrder.setRefundStatus(dto.getRefundStatus()); |
| | | if(dto.getRefundStatus() == 2){ |
| | | // 通过 |
| | | courseOrder.setRefundVoucher(dto.getRefundVoucher()); |
| | | // 修改支付状态为已退款 |
| | | courseOrder.setPayStatus(3); |
| | | } |
| | | if(dto.getRefundStatus() == 3){ |
| | | // 驳回 |
| | | courseOrder.setRejectReason(dto.getRejectReason()); |
| | | } |
| | | courseOrderService.updateById(courseOrder); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除课程订单管理 |
| | | */ |
| | | @Log(title = "课程订单管理信息-删除课程订单管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除课程订单管理") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(courseOrderService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除课程订单管理 |
| | | */ |
| | | @Log(title = "课程订单管理信息-删除课程订单管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除课程订单管理") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(courseService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | | |