|
@@ -0,0 +1,91 @@
|
|
|
+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.dao.EmployeeDao;
|
|
|
+import com.ym.mec.biz.dal.entity.Employee;
|
|
|
+import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
|
|
|
+import com.ym.mec.biz.dal.entity.Student;
|
|
|
+import com.ym.mec.biz.dal.page.ReplacementInstrumentActivityQueryInfo;
|
|
|
+import com.ym.mec.biz.service.ReplacementInstrumentActivityService;
|
|
|
+import com.ym.mec.biz.service.StudentService;
|
|
|
+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.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+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.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@RequestMapping("replacementInstrumentActivity")
|
|
|
+@Api(tags = "收费类型服务")
|
|
|
+@RestController
|
|
|
+public class ReplacementInstrumentActivityController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ReplacementInstrumentActivityService replacementInstrumentActivityService;
|
|
|
+ @Autowired
|
|
|
+ private SysUserFeignService sysUserFeignService;
|
|
|
+ @Autowired
|
|
|
+ private StudentService studentService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "新增调查问卷")
|
|
|
+ @PostMapping("/insert")
|
|
|
+ public Object add(ReplacementInstrumentActivity replacementInstrumentActivity) {
|
|
|
+ return succeed(replacementInstrumentActivityService.add(replacementInstrumentActivity));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "获取学员基本信息")
|
|
|
+ @GetMapping("queryUserInfo")
|
|
|
+ public Object queryUserInfo(Integer cooperationOrganId) {
|
|
|
+ SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
+ if (user == null) {
|
|
|
+ return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
+ }
|
|
|
+ ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityService.findByUserId(user.getId());
|
|
|
+ if(replacementInstrumentActivity == null){
|
|
|
+ Student student = studentService.get(user.getId());
|
|
|
+ replacementInstrumentActivity = new ReplacementInstrumentActivity();
|
|
|
+ replacementInstrumentActivity.setUserId(user.getId());
|
|
|
+ replacementInstrumentActivity.setClasses(student.getCurrentClass());
|
|
|
+ replacementInstrumentActivity.setGrade(student.getCurrentGradeNum().toString());
|
|
|
+ replacementInstrumentActivity.setCooperationOrganId(cooperationOrganId);
|
|
|
+ replacementInstrumentActivity.setUserName(StringUtils.isEmpty(user.getUsername())?user.getRealName():user.getUsername());
|
|
|
+ replacementInstrumentActivity.setMobileNo(user.getPhone());
|
|
|
+ String subjectIdList = student.getSubjectIdList();
|
|
|
+ if(StringUtils.isNotEmpty(subjectIdList)){
|
|
|
+ replacementInstrumentActivity.setSubjectId(Integer.parseInt(subjectIdList.split(",")[0]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return replacementInstrumentActivity;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "修改调查问卷")
|
|
|
+ @PostMapping("/update")
|
|
|
+ public Object update (ReplacementInstrumentActivity replacementInstrumentActivity) {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ throw new BizException("用户信息获取失败,请重新登陆");
|
|
|
+ }
|
|
|
+ replacementInstrumentActivityService.update(replacementInstrumentActivity);
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "获取调查问卷")
|
|
|
+ @GetMapping("/get")
|
|
|
+ public Object get (Integer id) {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ throw new BizException("用户信息获取失败,请重新登陆");
|
|
|
+ }
|
|
|
+ return succeed(replacementInstrumentActivityService.get(id));
|
|
|
+ }
|
|
|
+}
|