فهرست منبع

1.学生注册开放接口调整

yuanliang 1 سال پیش
والد
کامیت
cf575b4a45

+ 10 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/tenant/controller/open/OpenStudentController.java

@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSON;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.entity.Student;
+import com.yonge.cooleshow.biz.dal.entity.TenantGroup;
 import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
+import com.yonge.cooleshow.biz.dal.mapper.TenantGroupMapper;
 import com.yonge.cooleshow.biz.dal.service.ImGroupMemberService;
 import com.yonge.cooleshow.biz.dal.service.ImGroupService;
 import com.yonge.cooleshow.biz.dal.service.ImUserFriendService;
@@ -62,6 +64,9 @@ public class OpenStudentController extends BaseController {
     @Autowired
     private ImGroupMemberService imGroupMemberService;
 
+    @Autowired
+    private TenantGroupMapper tenantGroupMapper;
+
     @PostMapping("/save")
     @ApiOperation(value = "新增/修改", notes = "传入Student,换绑时按照返回错误码5004判断,是否需要换绑,updateTenant=true表示换绑")
     public HttpResponseResult<Boolean> save(@Validated @RequestBody StudentVo.Student student) {
@@ -80,6 +85,11 @@ public class OpenStudentController extends BaseController {
         if (tenantInfo == null) {
             throw new BizException("机构不存在");
         }
+        Long tenantGroupId = student.getTenantGroupId();
+        TenantGroup tenantGroup = tenantGroupMapper.selectById(tenantGroupId);
+        if (tenantGroup == null) {
+            throw new com.microsvc.toolkit.common.webportal.exception.BizException("机构小组不存在");
+        }
         Long studentId = student.getId();
 
         if (studentId == null) {

+ 3 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/tenant/vo/StudentVo.java

@@ -22,6 +22,9 @@ public class StudentVo {
         @ApiModelProperty("所属机构,开放接口必填")
         private Long tenantId;
 
+        @ApiModelProperty("机构小组ID")
+        private Long tenantGroupId;
+
         @ApiModelProperty("姓名")
         @NotNull
         private String name;

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

@@ -438,12 +438,6 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
             studentInfo.setTenantGroupId(-1L);
         }
 
-        Long tenantGroupId = studentInfo.getTenantGroupId();
-        TenantGroup tenantGroup = tenantGroupMapper.selectById(tenantGroupId);
-        if (tenantGroup == null) {
-            throw new BizException("机构小组不存在");
-        }
-
         if (studentInfo.getId() == null) {
             return createStudent(studentInfo);
         } else {

+ 11 - 1
cooleshow-user/user-tenant/src/main/java/com/yonge/cooleshow/tenant/controller/open/OpenStudentController.java

@@ -7,10 +7,12 @@ import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.entity.ImGroupMember;
 import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.entity.Teacher;
+import com.yonge.cooleshow.biz.dal.entity.TenantGroup;
 import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.enums.ImGroupMemberRoleType;
 import com.yonge.cooleshow.biz.dal.enums.MessageTypeEnum;
+import com.yonge.cooleshow.biz.dal.mapper.TenantGroupMapper;
 import com.yonge.cooleshow.biz.dal.service.ImGroupMemberService;
 import com.yonge.cooleshow.biz.dal.service.ImGroupService;
 import com.yonge.cooleshow.biz.dal.service.ImUserFriendService;
@@ -56,7 +58,7 @@ public class OpenStudentController extends BaseController {
     @Autowired
     private TenantInfoService tenantInfoService;
 
-    @Resource
+    @Autowired
     private SysUserFeignService sysUserFeignService;
 
     @Autowired
@@ -71,6 +73,9 @@ public class OpenStudentController extends BaseController {
     @Autowired
     private ImGroupMemberService imGroupMemberService;
 
+    @Autowired
+    private TenantGroupMapper tenantGroupMapper;
+
     @PostMapping("/save")
     @ApiOperation(value = "新增/修改", notes = "传入Student,换绑时按照返回错误码5004判断,是否需要换绑,updateTenant=true表示换绑")
     public HttpResponseResult<Boolean> save(@Validated @RequestBody StudentVo.Student student) {
@@ -89,6 +94,11 @@ public class OpenStudentController extends BaseController {
         if (tenantInfo == null) {
             throw new BizException("机构不存在");
         }
+        Long tenantGroupId = student.getTenantGroupId();
+        TenantGroup tenantGroup = tenantGroupMapper.selectById(tenantGroupId);
+        if (tenantGroup == null) {
+            throw new com.microsvc.toolkit.common.webportal.exception.BizException("机构小组不存在");
+        }
         Long studentId = student.getId();
 
         if (studentId == null) {