|
@@ -5,28 +5,36 @@ import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
import com.yonge.cooleshow.auth.api.dto.RealnameAuthReq;
|
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.search.QueryMyFollowSearch;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.Student;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.Subject;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.TenantUnbindRecord;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.SmsCodeService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.StudentService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.SysUserService;
|
|
|
-import com.yonge.cooleshow.biz.dal.vo.StudentVo;
|
|
|
-import com.yonge.toolset.base.exception.BizException;
|
|
|
-import com.yonge.toolset.mybatis.support.PageUtil;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.TenantUnbindRecordService;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.MyFollow;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.StudentHomeVo;
|
|
|
+import com.yonge.cooleshow.biz.dal.wrapper.StudentWrapper;
|
|
|
import com.yonge.cooleshow.common.controller.BaseController;
|
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
import com.yonge.toolset.base.page.PageInfo;
|
|
|
import com.yonge.toolset.base.util.StringUtil;
|
|
|
-import com.yonge.toolset.thirdparty.user.realname.RealnameAuthenticationPlugin;
|
|
|
+import com.yonge.toolset.mybatis.support.PageUtil;
|
|
|
import com.yonge.toolset.utils.idcard.IdcardInfoExtractor;
|
|
|
-import com.yonge.toolset.utils.idcard.IdcardValidator;
|
|
|
-import io.swagger.annotations.*;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-
|
|
|
-import com.yonge.cooleshow.biz.dal.entity.Student;
|
|
|
-import com.yonge.cooleshow.biz.dal.service.StudentService;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+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.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.List;
|
|
@@ -43,10 +51,16 @@ public class StudentController extends BaseController {
|
|
|
@Autowired
|
|
|
private SysUserService sysUserService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TenantUnbindRecordService tenantUnbindRecordService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SmsCodeService smsCodeService;
|
|
|
+
|
|
|
|
|
|
@ApiOperation(value = "查询指定学员信息")
|
|
|
@GetMapping("/queryUserById")
|
|
|
- public HttpResponseResult<StudentVo> queryUserById(String rongCloudUserId) {
|
|
|
+ public HttpResponseResult<com.yonge.cooleshow.biz.dal.vo.StudentVo> queryUserById(String rongCloudUserId) {
|
|
|
|
|
|
if (StringUtil.isEmpty(rongCloudUserId)) {
|
|
|
return failed("用户信息获取失败");
|
|
@@ -130,9 +144,51 @@ public class StudentController extends BaseController {
|
|
|
if (user == null || null == user.getId()) {
|
|
|
return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
}
|
|
|
- IdcardInfoExtractor idcardInfoExtractor = sysUserService.updateUserCard(realNameAuthDto, user,ClientEnum.STUDENT);
|
|
|
+ IdcardInfoExtractor idcardInfoExtractor = sysUserService.updateUserCard(realNameAuthDto, user,
|
|
|
+ ClientEnum.STUDENT);
|
|
|
return succeed(idcardInfoExtractor);
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/unbindTenant")
|
|
|
+ @ApiOperation(value = "解绑机构申请")
|
|
|
+ public HttpResponseResult<Boolean> unbindTenant(@RequestBody StudentWrapper.UnbindTenant unbindTenant) {
|
|
|
+ SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
+ if (user == null || null == user.getId()) {
|
|
|
+ return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(unbindTenant.getCode())) {
|
|
|
+ return failed("验证码不能为空");
|
|
|
+ }
|
|
|
+ boolean validCode = smsCodeService.verifyValidCode(user.getPhone(), unbindTenant.getCode(), "");
|
|
|
+ if (validCode) {
|
|
|
+ return failed("验证码错误");
|
|
|
+ }
|
|
|
+ if (user.getTenantId() == null || user.getTenantId() == -1) {
|
|
|
+ return failed("非机构用户不需要解绑");
|
|
|
+ }
|
|
|
+
|
|
|
+ Student student = studentService.getById(user.getId());
|
|
|
+ if (student == null) {
|
|
|
+ return failed("未查询到学生的信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ TenantUnbindRecord one = tenantUnbindRecordService.lambdaQuery()
|
|
|
+ .eq(TenantUnbindRecord::getTenantId, user.getTenantId())
|
|
|
+ .eq(TenantUnbindRecord::getUserType, "STUDENT")
|
|
|
+ .eq(TenantUnbindRecord::getUserId, user.getId())
|
|
|
+ .eq(TenantUnbindRecord::getStatus, "DOING")
|
|
|
+ .last("limit 1").one();
|
|
|
+ if (one != null) {
|
|
|
+ return failed("请勿重复申请");
|
|
|
+ }
|
|
|
+ TenantUnbindRecord tenantUnbindRecord = new TenantUnbindRecord();
|
|
|
+ tenantUnbindRecord.setTenantId(user.getTenantId());
|
|
|
+ tenantUnbindRecord.setUserId(user.getId());
|
|
|
+ tenantUnbindRecord.setUserType("STUDENT");
|
|
|
+ tenantUnbindRecord.setUnbindReason(unbindTenant.getUnbindReason());
|
|
|
+ tenantUnbindRecord.setStatus("DOING");
|
|
|
+ tenantUnbindRecordService.save(tenantUnbindRecord);
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
|
|
|
}
|