|
|
@@ -29,6 +29,8 @@ import java.sql.Timestamp;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
|
|
|
+import static org.apache.zookeeper.ZooDefs.OpCode.sync;
|
|
|
+
|
|
|
/**
|
|
|
* 企业信息service层
|
|
|
*
|
|
|
@@ -65,6 +67,11 @@ public class UserspaceServiceImpl implements UserspaceService {
|
|
|
|
|
|
@Override
|
|
|
public Userspace register(Userspace userspace, String appId) {
|
|
|
+ return register(userspace, appId, true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Userspace register(Userspace userspace, String appId, boolean isSyncSource) {
|
|
|
User admin = userspace.getAdmin();
|
|
|
if (admin == null) {
|
|
|
throw new VisibleError("管理员不能为空");
|
|
|
@@ -77,9 +84,9 @@ public class UserspaceServiceImpl implements UserspaceService {
|
|
|
checkBusinessCode(userspace.getBusinessCode());
|
|
|
|
|
|
// 设置域名
|
|
|
- if (StringUtils.isEmpty(userspace.getDomain())) {
|
|
|
- generateDefaultDomain(userspace);
|
|
|
- }
|
|
|
+ if (StringUtils.isEmpty(userspace.getDomain())) {
|
|
|
+ generateDefaultDomain(userspace);
|
|
|
+ }
|
|
|
|
|
|
// 设置uu号
|
|
|
Long maxUU = userspaceDao.findMaxUU();
|
|
|
@@ -122,11 +129,29 @@ public class UserspaceServiceImpl implements UserspaceService {
|
|
|
}
|
|
|
|
|
|
// 开通应用
|
|
|
- syncUserSpaceInfo(userspace.toView(), "企业注册", app);
|
|
|
+ syncUserSpaceInfo(userspace.toView(), "企业注册", app, isSyncSource ? null : app);
|
|
|
return userspace;
|
|
|
}
|
|
|
|
|
|
- private void syncUserSpaceInfo(final UserSpaceView userSpaceView, final String msg, App otherApp) {
|
|
|
+ /**
|
|
|
+ * 同步企业信息到其他应用
|
|
|
+ * @param userSpaceView 企业信息
|
|
|
+ * @param msg 同步日志信息
|
|
|
+ * @param otherApp 需要同步的其他应用
|
|
|
+ */
|
|
|
+ private void syncUserSpaceInfo(UserSpaceView userSpaceView, String msg, App otherApp) {
|
|
|
+ syncUserSpaceInfo(userSpaceView, msg, otherApp, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 同步企业信息到其他应用
|
|
|
+ * 如果需要同步的应用和不需要同步的应用相同,则不同步改应用
|
|
|
+ * @param userSpaceView 企业信息
|
|
|
+ * @param msg 同步日志信息
|
|
|
+ * @param otherApp 需要同步的其他应用
|
|
|
+ * @param noSyncApp 不需要同步的应用
|
|
|
+ */
|
|
|
+ private void syncUserSpaceInfo(final UserSpaceView userSpaceView, final String msg, App otherApp, App noSyncApp) {
|
|
|
// 封装数据
|
|
|
final UserView admin = userSpaceView.getAdmin();
|
|
|
userSpaceView.setAdminUU(userSpaceView.getAdmin().getUserUU());
|
|
|
@@ -139,6 +164,10 @@ public class UserspaceServiceImpl implements UserspaceService {
|
|
|
if (!apps.contains(otherApp)) {
|
|
|
apps.add(otherApp);
|
|
|
}
|
|
|
+ if (noSyncApp != null && apps.contains(noSyncApp)) {
|
|
|
+ apps.remove(noSyncApp);
|
|
|
+ }
|
|
|
+ System.out.println(apps.toString());
|
|
|
syncUserSpaceInfo(formData, msg, apps);
|
|
|
}
|
|
|
|