|
@@ -7,17 +7,22 @@ import com.miaxis.common.core.controller.BaseController;
|
|
|
import com.miaxis.common.core.domain.Response;
|
|
|
import com.miaxis.common.core.domain.entity.UserInfo;
|
|
|
import com.miaxis.common.enums.BusinessTypeEnum;
|
|
|
+import com.miaxis.common.exception.CustomException;
|
|
|
import com.miaxis.common.utils.SecurityUtils;
|
|
|
import com.miaxis.newgzpt.domain.GzptTrainRecord;
|
|
|
+import com.miaxis.newgzpt.domain.GzptUserInfo;
|
|
|
import com.miaxis.newgzpt.service.IGzptTrainRecordService;
|
|
|
+import com.miaxis.newgzpt.service.IGzptUserInfoService;
|
|
|
import com.miaxis.question.domain.QuestionCollection;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
+import sun.plugin.net.protocol.jar.CachedJarURLConnection;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
@@ -29,13 +34,16 @@ import javax.annotation.Resource;
|
|
|
* @since 2021-03-23
|
|
|
*/
|
|
|
@RestController
|
|
|
-@Api(tags = "【小程序-新增学时】")
|
|
|
+@Api(tags = "【小程序-学时管理】")
|
|
|
@RequestMapping(Constants.STUDENT_PREFIX+"/gzpt-train-record")
|
|
|
public class GzptTrainRecordController extends BaseController {
|
|
|
|
|
|
@Resource
|
|
|
IGzptTrainRecordService gzptTrainRecordService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IGzptUserInfoService gzptUserInfoService;
|
|
|
+
|
|
|
/**
|
|
|
* 新增学时
|
|
|
*/
|
|
@@ -43,6 +51,13 @@ public class GzptTrainRecordController extends BaseController {
|
|
|
@PostMapping
|
|
|
@ApiOperation("新增学时")
|
|
|
public Response add(@RequestBody GzptTrainRecord gzptTrainRecord){
|
|
|
+
|
|
|
+ UserInfo student = SecurityUtils.getLoginUser().getStudent();
|
|
|
+ GzptUserInfo gzptUserInfo = gzptUserInfoService.getInfoById(student.getGzptUserId());
|
|
|
+ if (gzptUserInfo == null) {
|
|
|
+ throw new CustomException("该用户未查到相关的学员信息");
|
|
|
+ }
|
|
|
+ gzptTrainRecord.setStudentId(gzptUserInfo.getOutId());
|
|
|
gzptTrainRecordService.saveGzptTrainRecord(gzptTrainRecord);
|
|
|
return Response.success();
|
|
|
}
|