Open songhuiqing88 opened 6 years ago
package org.gtiles.components.organization.syncscope.service.impl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.gtiles.components.organization.organization.bean.OrganizationBean;
import org.gtiles.components.organization.organization.service.IOrganizationService;
import org.gtiles.components.organization.scope.bean.OrgScopeBean;
import org.gtiles.components.organization.scope.service.IOrgScopeService;
import org.gtiles.components.organization.syncscope.service.ISyncScopeAdminService;
import org.gtiles.components.securityworkbench.core.syncadmin.SyncRoleAdmin;
import org.gtiles.components.securityworkbench.core.syncadmin.service.ISyncAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
@Service("org.gtiles.components.organization.syncscope.service.impl.SyncScopeAdminServiceImpl")
public class SyncScopeAdminServiceImpl implements ISyncScopeAdminService {
@Autowired
private ISyncAdminService syncAdminService;
@Autowired
@Qualifier("org.gtiles.components.organization.scope.service.impl.OrgScopeServiceImpl")
private IOrgScopeService orgScopeService;
@Autowired
@Qualifier("org.gtiles.components.organization.organization.service.impl.OrganizationServiceImpl")
private IOrganizationService organizationService;
@Override
public void addSyncAdmin(SyncRoleAdmin syncAdmin, Map<String, String[]> orgScopeMap) {
String adminId = syncAdmin.getSyncUniqueId();
List<OrgScopeBean> orgScopeList = new ArrayList<OrgScopeBean>();
if(orgScopeMap==null) {
throw new RuntimeException("");
}
Set<String> keySet = orgScopeMap.keySet();
Iterator<String> ite = keySet.iterator();
while(ite.hasNext()) {
String orgNumber = ite.next();
OrganizationBean org = organizationService.findOrganizationByorgNumber(orgNumber);
if(org!=null && orgScopeMap.containsKey(orgNumber)) {
for(String dataCode:orgScopeMap.get(orgNumber)) {
OrgScopeBean scope = new OrgScopeBean();
scope.setAdminId(adminId);
scope.setDataCode(dataCode);
scope.setOrganizationId(org.getOrganizationId());
orgScopeList.add(scope);
}
}
}
syncAdminService.addSyncAdmin(syncAdmin);
orgScopeService.addBatchOrgScope(orgScopeList, adminId);
}
}
机构及用户同步
机构用户同步过程
引用方式如下
机构用户同步Service
管理员同步
管理员同步过程
引用方式如下
管理员同步Service