|
|
@@ -1,5 +1,6 @@
|
|
|
package com.uas.sso.controller;
|
|
|
|
|
|
+import com.uas.sso.core.Const;
|
|
|
import com.uas.sso.core.Status;
|
|
|
import com.uas.sso.entity.*;
|
|
|
import com.uas.sso.service.ChangeAdminService;
|
|
|
@@ -19,6 +20,8 @@ import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import static org.apache.coyote.http11.Constants.a;
|
|
|
+
|
|
|
/**
|
|
|
* @author wangmh
|
|
|
* @create 2018-01-15 10:24
|
|
|
@@ -282,6 +285,14 @@ public class ChangeAdminController extends BaseController {
|
|
|
|
|
|
// 获取新管理员
|
|
|
User afterAdmin = userService.findByMobile(mobile);
|
|
|
+ // 如果新管理员未注册,则注册个人账号
|
|
|
+ if (afterAdmin == null) {
|
|
|
+ afterAdmin = new User();
|
|
|
+ afterAdmin.setMobile(mobile);
|
|
|
+ afterAdmin.setVipName("管理员");
|
|
|
+ afterAdmin.setPassword("111111");
|
|
|
+ afterAdmin = userService.register(afterAdmin);
|
|
|
+ }
|
|
|
|
|
|
// 获取提交者
|
|
|
UserAccount userAccount = (UserAccount) existToken.getBind();
|
|
|
@@ -290,6 +301,10 @@ public class ChangeAdminController extends BaseController {
|
|
|
Userspace userspace = userspaceService.findOne(userAccount.getSpaceUU());
|
|
|
User beforeAdmin = userService.findOne(userspace.getAdminUU());
|
|
|
|
|
|
+ // 更换管理员
|
|
|
+ userspaceService.changeAdmin(userspace, afterAdmin);
|
|
|
+
|
|
|
+ // 更换管理员记录
|
|
|
ChangeAdmin changeAdmin = new ChangeAdmin();
|
|
|
changeAdmin.setSubmitterUU(userAccount.getUserUU());
|
|
|
changeAdmin.setBeforeAdminUU(beforeAdmin.getUserUU());
|