Browse Source

Merge remote-tracking branch 'origin/master'

weifanli 2 years ago
parent
commit
52acc7d9b4

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleDao.java

@@ -117,5 +117,8 @@ public interface CourseScheduleDao extends BaseMapper<CourseSchedule> {
 
     //更新lock
     void updateLock(List<Long> list);
+
+    //根据课程id修改时间
+    void courseAdjust(CourseAdjustVo adjustVo);
 }
 

+ 2 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/CourseScheduleService.java

@@ -181,5 +181,7 @@ public interface CourseScheduleService extends IService<CourseSchedule> {
     void buyPracticeCourseSuccess(UserOrderDetailVo orderParam);
 
     void buyPracticeCourseFailed(String orderNo);
+
+    void courseAdjust(CourseAdjustVo adjustVo);
 }
 

+ 22 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java

@@ -580,6 +580,12 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
                 .orElseThrow(() -> new BizException("用户不存在"));
     }
 
+    private SysUser getSysUser(Long userId) {
+        return Optional.ofNullable(userId)
+                .map(sysUserFeignService::queryUserById)
+                .orElseThrow(() -> new BizException("用户不存在"));
+    }
+
     /**
      * 老师端-首页-我的课程-陪练课
      * search:{"classMonth":"2022-03","status":"COMPLETE","subjectId":1}
@@ -804,7 +810,9 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         log.info("学生购买陪练课,请求参数:{}", JSON.toJSONString(orderReqInfo));
         Long studentId = orderReqInfo.getUserId();
 
-//        PracticeScheduleDto scheduleDto= (PracticeScheduleDto) orderReqInfo.getBizContent();
+        //校验学生信息
+        getSysUser(studentId);
+
         ObjectMapper objectMapper = new ObjectMapper();
         PracticeScheduleDto scheduleDto = objectMapper.convertValue(orderReqInfo.getBizContent(), PracticeScheduleDto.class);
 
@@ -814,7 +822,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         scheduleDto.setMixStudentNum(1);
         scheduleDto.setStudentId(studentId);
 
-        //course_group
+        //写入course_group
         baseMapper.addCourseGroup(scheduleDto);
         Long groupId = scheduleDto.getGroupId();
 
@@ -833,7 +841,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
             schedule.setLock(1);
             schedule.setStatus(CourseScheduleEnum.NOT_START.getCode());
             schedule.setCreatedBy(scheduleDto.getStudentId());
-            //course_schedule
+            //写入course_schedule
             baseMapper.insert(schedule);
 
             Long scheduleId = schedule.getId();
@@ -846,7 +854,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
             payment.setOriginalPrice(unitPrice);
             payment.setExpectPrice(unitPrice);
             payment.setActualPrice(unitPrice);
-            //course_schedule_student_payment
+            //写入course_schedule_student_payment
             courseScheduleStudentPaymentService.save(payment);
         }
 
@@ -906,5 +914,15 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         //修改订单为失败
     }
 
+    /**
+     * @Description: 老师端-课表-日历-调课
+     * @Author: cy
+     * @Date: 2022/4/21
+     */
+    @Override
+    public void courseAdjust(CourseAdjustVo adjustVo) {
+        baseMapper.courseAdjust(adjustVo);
+    }
+
 }
 

+ 6 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java

@@ -57,6 +57,8 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
     private IdGeneratorService idGeneratorService;
     @Autowired
     private CourseGroupService courseGroupService;
+    @Autowired
+    private CourseScheduleService scheduleService;
 
     //验证订单是否可以下单
     private static final Map<GoodTypeEnum, Function<OrderReq.OrderReqInfo, HttpResponseResult<OrderCreateRes>>> orderCreate = new HashMap<>();
@@ -75,6 +77,8 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
         orderCreate.put(GoodTypeEnum.VIP, vipCardService::orderCreate);
         //直播课程购买
         orderCreate.put(GoodTypeEnum.LIVE, courseGroupService::buyLiveCourse);
+        //陪练课购买
+        orderCreate.put(GoodTypeEnum.PRACTICE, scheduleService::buyPracticeCourse);
 
         /**********订单生成后******************/
         //直播课程购买after
@@ -85,6 +89,8 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
         orderSuccess.put(GoodTypeEnum.VIP, vipCardService::orderSuccess);
         //直播课程购买
         orderSuccess.put(GoodTypeEnum.LIVE, courseGroupService::buyLiveCourseSuccess);
+        //陪练课购买
+        orderSuccess.put(GoodTypeEnum.PRACTICE, scheduleService::buyPracticeCourseSuccess);
 
         /**********订单取消后******************/
         //orderCancel.put();

+ 64 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/CourseAdjustVo.java

@@ -0,0 +1,64 @@
+package com.yonge.cooleshow.biz.dal.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Author: cy
+ * @Date: 2022/4/21
+ */
+@ApiModel(value = "CourseAdjustVo")
+public class CourseAdjustVo implements Serializable {
+    @ApiModelProperty(value = "课程id")
+    @NotNull(message = "课程id不能未空")
+    private Integer courseId;
+
+    @ApiModelProperty(value = "上课日期")
+    @NotNull(message = "上课日期")
+    private Date classDate;
+
+    @ApiModelProperty(value = "上课时间")
+    @NotNull(message = "上课时间")
+    private Date startTime;
+
+    @ApiModelProperty(value = "下课时间")
+    @NotNull(message = "下课时间")
+    private Date endTime;
+
+    public Integer getCourseId() {
+        return courseId;
+    }
+
+    public void setCourseId(Integer courseId) {
+        this.courseId = courseId;
+    }
+
+    public Date getClassDate() {
+        return classDate;
+    }
+
+    public void setClassDate(Date classDate) {
+        this.classDate = classDate;
+    }
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+}
+

+ 5 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -449,4 +449,9 @@
             #{item}
         </foreach>
     </update>
+    <update id="courseAdjust" parameterType="com.yonge.cooleshow.biz.dal.vo.CourseAdjustVo">
+        UPDATE course_schedule
+        SET class_date_=#{classDate},start_time_=#{startTime},end_time_=#{endTime}
+        WHERE id_ = #{courseId}
+    </update>
 </mapper>

+ 9 - 0
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherCourseScheduleController.java

@@ -7,6 +7,7 @@ import com.yonge.cooleshow.biz.dal.dto.search.MyCourseSearch;
 import com.yonge.cooleshow.biz.dal.entity.CourseCalendarEntity;
 import com.yonge.cooleshow.biz.dal.service.CourseScheduleService;
 import com.yonge.cooleshow.biz.dal.support.PageUtil;
+import com.yonge.cooleshow.biz.dal.vo.CourseAdjustVo;
 import com.yonge.cooleshow.biz.dal.vo.MyCourseVo;
 import com.yonge.cooleshow.biz.dal.vo.TeacherLiveCourseInfoVo;
 import com.yonge.cooleshow.common.controller.BaseController;
@@ -17,6 +18,7 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.http.HttpStatus;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -128,5 +130,12 @@ public class TeacherCourseScheduleController extends BaseController {
         search.setTeacherId(user.getId());
         return succeed(courseScheduleService.queryCourseUser(search));
     }
+
+    @ApiOperation(value = "老师端-课表-日历-调课")
+    @PostMapping("/courseAdjust")
+    public HttpResponseResult<Object> courseAdjust(@Validated @RequestBody CourseAdjustVo adjustVo) {
+        courseScheduleService.courseAdjust(adjustVo);
+        return succeed();
+    }
 }