|
@@ -0,0 +1,59 @@
|
|
|
+package com.ym.mec.student.controller;
|
|
|
+
|
|
|
+import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
+import com.ym.mec.auth.api.entity.SysUser;
|
|
|
+import com.ym.mec.biz.dal.entity.PracticeLessonApply;
|
|
|
+import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
|
|
|
+import com.ym.mec.biz.service.ContractService;
|
|
|
+import com.ym.mec.biz.service.PracticeLessonApplyService;
|
|
|
+import com.ym.mec.common.controller.BaseController;
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+@RequestMapping("practiceLessonApply")
|
|
|
+@Api(tags = "陪练课服务")
|
|
|
+@RestController
|
|
|
+public class PracticeLessonApplyController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysUserFeignService sysUserFeignService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PracticeLessonApplyService practiceLessonApplyService;
|
|
|
+
|
|
|
+ @ApiOperation("新增陪练课申请")
|
|
|
+ @PostMapping(value = "add")
|
|
|
+ public Object add(String memo) {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ return failed("获取用户信息失败");
|
|
|
+ }
|
|
|
+ PracticeLessonApply lessonApply = practiceLessonApplyService.findByUserId(sysUser.getId());
|
|
|
+ if(lessonApply != null){
|
|
|
+ throw new BizException("您已申请过陪练课!");
|
|
|
+ }
|
|
|
+ PracticeLessonApply practiceLessonApply = new PracticeLessonApply();
|
|
|
+ practiceLessonApply.setCreateTime(new Date());
|
|
|
+ practiceLessonApply.setMemo(memo);
|
|
|
+ practiceLessonApply.setUserId(sysUser.getId());
|
|
|
+ return succeed(practiceLessonApplyService.insert(practiceLessonApply));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("根据用户编号查询是否申请过")
|
|
|
+ @GetMapping(value = "findPracticeByUser")
|
|
|
+ public Object findPracticeByUser() {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ return failed("获取用户信息失败");
|
|
|
+ }
|
|
|
+ return succeed(practiceLessonApplyService.findByUserId(sysUser.getId()));
|
|
|
+ }
|
|
|
+}
|