Business.java 18.8 KB
Newer Older
R
roo00 已提交
1 2
package com.x.cms.assemble.control;

R
Ray 已提交
3 4 5
import java.util.ArrayList;
import java.util.List;

6 7
import com.x.cms.core.entity.CategoryInfo;
import com.x.cms.core.entity.Document;
R
Ray 已提交
8 9
import org.apache.commons.lang3.StringUtils;

R
roo00 已提交
10 11 12 13
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.organization.OrganizationDefinition;
import com.x.base.core.project.tools.ListTools;
R
Ray 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
import com.x.cms.assemble.control.factory.AppDictFactory;
import com.x.cms.assemble.control.factory.AppDictItemFactory;
import com.x.cms.assemble.control.factory.AppInfoConfigFactory;
import com.x.cms.assemble.control.factory.AppInfoFactory;
import com.x.cms.assemble.control.factory.CategoryExtFactory;
import com.x.cms.assemble.control.factory.CategoryInfoFactory;
import com.x.cms.assemble.control.factory.CmsBatchOperationFactory;
import com.x.cms.assemble.control.factory.DocumentCommendFactory;
import com.x.cms.assemble.control.factory.DocumentCommentCommendFactory;
import com.x.cms.assemble.control.factory.DocumentCommentInfoFactory;
import com.x.cms.assemble.control.factory.DocumentFactory;
import com.x.cms.assemble.control.factory.DocumentViewRecordFactory;
import com.x.cms.assemble.control.factory.FileFactory;
import com.x.cms.assemble.control.factory.FileInfoFactory;
import com.x.cms.assemble.control.factory.FormFactory;
import com.x.cms.assemble.control.factory.FormFieldFactory;
import com.x.cms.assemble.control.factory.ItemFactory;
import com.x.cms.assemble.control.factory.LogFactory;
import com.x.cms.assemble.control.factory.ReviewFactory;
import com.x.cms.assemble.control.factory.ScriptFactory;
import com.x.cms.assemble.control.factory.SearchFactory;
import com.x.cms.assemble.control.factory.TemplateFormFactory;
import com.x.cms.assemble.control.factory.ViewCategoryFactory;
import com.x.cms.assemble.control.factory.ViewFactory;
import com.x.cms.assemble.control.factory.ViewFieldConfigFactory;
39 40
import com.x.cms.assemble.control.factory.portal.PortalFactory;
import com.x.cms.assemble.control.factory.process.ProcessFactory;
R
roo00 已提交
41 42 43
import com.x.cms.core.entity.AppInfo;
import com.x.organization.core.express.Organization;

O
o2sword 已提交
44 45
/**
 * 通用业务类
46
 *
O
o2sword 已提交
47 48
 * @author sword
 */
R
roo00 已提交
49 50 51 52 53 54 55 56 57 58 59 60 61 62
public class Business {

	private EntityManagerContainer emc;

	public Business(EntityManagerContainer emc) throws Exception {
		this.emc = emc;
	}

	public EntityManagerContainer entityManagerContainer() {
		return this.emc;
	}

	private TemplateFormFactory templateFormFactory;
	private AppInfoFactory appInfoFactory;
R
roo00 已提交
63
	private AppInfoConfigFactory appInfoConfigFactory;
R
roo00 已提交
64 65 66 67 68 69 70
	private CategoryInfoFactory categoryInfoFactory;
	private CategoryExtFactory categoryExtFactory;
	private FileInfoFactory fileInfoFactory;
	private LogFactory logFactory;
	private DocumentFactory documentFactory;
	private DocumentViewRecordFactory documentViewRecordFactory;
	private FormFactory formFactory;
R
roo00 已提交
71
	private FileFactory fileFactory;
R
roo00 已提交
72 73 74 75 76 77 78 79 80 81
	private ViewCategoryFactory viewCategoryFactory;
	private ViewFactory viewFactory;
	private ViewFieldConfigFactory viewFieldConfigFactory;
	private AppDictFactory appDictFactory;
	private AppDictItemFactory appDictItemFactory;
	private ScriptFactory scriptFactory;
	private SearchFactory searchFactory;
	private Organization organization;
	private ItemFactory itemFactory;
	private FormFieldFactory formFieldFactory;
R
fix  
roo00 已提交
82 83
	private CmsBatchOperationFactory cmsBatchOperationFactory;
	private DocumentCommendFactory documentCommendFactory;
R
roo00 已提交
84
	private DocumentCommentCommendFactory documentCommentCommendFactory;
R
fix  
roo00 已提交
85
	private DocumentCommentInfoFactory documentCommentInfoFactory;
R
roo00 已提交
86
	private ReviewFactory reviewFactory;
R
roo00 已提交
87

R
roo00 已提交
88 89 90 91 92 93 94
	public AppInfoConfigFactory appInfoConfigFactory() throws Exception {
		if (null == this.appInfoConfigFactory) {
			this.appInfoConfigFactory = new AppInfoConfigFactory(this);
		}
		return appInfoConfigFactory;
	}

R
roo00 已提交
95 96 97 98 99 100
	public DocumentCommentCommendFactory documentCommentCommendFactory() throws Exception {
		if (null == this.documentCommentCommendFactory) {
			this.documentCommentCommendFactory = new DocumentCommentCommendFactory(this);
		}
		return documentCommentCommendFactory;
	}
101

R
roo00 已提交
102 103 104 105 106 107
	public ReviewFactory reviewFactory() throws Exception {
		if (null == this.reviewFactory) {
			this.reviewFactory = new ReviewFactory(this);
		}
		return reviewFactory;
	}
108

R
fix  
roo00 已提交
109 110 111 112 113 114
	public CmsBatchOperationFactory cmsBatchOperationFactory() throws Exception {
		if (null == this.cmsBatchOperationFactory) {
			this.cmsBatchOperationFactory = new CmsBatchOperationFactory(this);
		}
		return cmsBatchOperationFactory;
	}
115

R
fix  
roo00 已提交
116 117 118 119 120 121
	public DocumentCommentInfoFactory documentCommentInfoFactory() throws Exception {
		if (null == this.documentCommentInfoFactory) {
			this.documentCommentInfoFactory = new DocumentCommentInfoFactory(this);
		}
		return documentCommentInfoFactory;
	}
122

R
fix  
roo00 已提交
123 124 125 126 127 128
	public DocumentCommendFactory documentCommendFactory() throws Exception {
		if (null == this.documentCommendFactory) {
			this.documentCommendFactory = new DocumentCommendFactory(this);
		}
		return documentCommendFactory;
	}
129

R
roo00 已提交
130 131 132 133 134 135
	public FileFactory fileFactory() throws Exception {
		if (null == this.fileFactory) {
			this.fileFactory = new FileFactory(this);
		}
		return fileFactory;
	}
136

R
roo00 已提交
137 138 139 140 141 142
	public FormFieldFactory formFieldFactory() throws Exception {
		if (null == this.formFieldFactory) {
			this.formFieldFactory = new FormFieldFactory(this);
		}
		return formFieldFactory;
	}
143

R
roo00 已提交
144 145 146 147 148 149
	public ItemFactory itemFactory() throws Exception {
		if (null == this.itemFactory) {
			this.itemFactory = new ItemFactory(this);
		}
		return itemFactory;
	}
150

R
roo00 已提交
151 152 153 154 155 156
	public CategoryExtFactory categoryExtFactory() throws Exception {
		if (null == this.categoryExtFactory) {
			this.categoryExtFactory = new CategoryExtFactory(this);
		}
		return categoryExtFactory;
	}
157

R
roo00 已提交
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
	public Organization organization() throws Exception {
		if (null == this.organization) {
			this.organization = new Organization(ThisApplication.context());
		}
		return organization;
	}

	public TemplateFormFactory templateFormFactory() throws Exception {
		if (null == this.templateFormFactory) {
			this.templateFormFactory = new TemplateFormFactory(this);
		}
		return templateFormFactory;
	}

	public DocumentViewRecordFactory documentViewRecordFactory() throws Exception {
		if (null == this.documentViewRecordFactory) {
			this.documentViewRecordFactory = new DocumentViewRecordFactory(this);
		}
		return documentViewRecordFactory;
	}

	public ViewCategoryFactory getViewCategoryFactory() throws Exception {
		if (null == this.viewCategoryFactory) {
			this.viewCategoryFactory = new ViewCategoryFactory(this);
		}
		return viewCategoryFactory;
	}

	public ViewFactory getViewFactory() throws Exception {
		if (null == this.viewFactory) {
			this.viewFactory = new ViewFactory(this);
		}
		return viewFactory;
	}

	public ViewFieldConfigFactory getViewFieldConfigFactory() throws Exception {
		if (null == this.viewFieldConfigFactory) {
			this.viewFieldConfigFactory = new ViewFieldConfigFactory(this);
		}
		return viewFieldConfigFactory;
	}

	public SearchFactory getSearchFactory() throws Exception {
		if (null == this.searchFactory) {
			this.searchFactory = new SearchFactory(this);
		}
		return searchFactory;
	}

	public ScriptFactory getScriptFactory() throws Exception {
		if (null == this.scriptFactory) {
			this.scriptFactory = new ScriptFactory(this);
		}
		return scriptFactory;
	}

	public FormFactory getFormFactory() throws Exception {
		if (null == this.formFactory) {
			this.formFactory = new FormFactory(this);
		}
		return formFactory;
	}

	public AppDictFactory getAppDictFactory() throws Exception {
		if (null == this.appDictFactory) {
			this.appDictFactory = new AppDictFactory(this);
		}
		return appDictFactory;
	}

	public AppDictItemFactory getAppDictItemFactory() throws Exception {
		if (null == this.appDictItemFactory) {
			this.appDictItemFactory = new AppDictItemFactory(this);
		}
		return appDictItemFactory;
	}

	public DocumentFactory getDocumentFactory() throws Exception {
		if (null == this.documentFactory) {
			this.documentFactory = new DocumentFactory(this);
		}
		return documentFactory;
	}

	public AppInfoFactory getAppInfoFactory() throws Exception {
		if (null == this.appInfoFactory) {
			this.appInfoFactory = new AppInfoFactory(this);
		}
		return appInfoFactory;
	}

	public CategoryInfoFactory getCategoryInfoFactory() throws Exception {
		if (null == this.categoryInfoFactory) {
			this.categoryInfoFactory = new CategoryInfoFactory(this);
		}
		return categoryInfoFactory;
	}

	public FileInfoFactory getFileInfoFactory() throws Exception {
		if (null == this.fileInfoFactory) {
			this.fileInfoFactory = new FileInfoFactory(this);
		}
		return fileInfoFactory;
	}
262

R
roo00 已提交
263 264 265 266 267 268 269
	public LogFactory getLogFactory() throws Exception {
		if (null == this.logFactory) {
			this.logFactory = new LogFactory(this);
		}
		return logFactory;
	}

270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
	private ProcessFactory process;

	public ProcessFactory process() throws Exception {
		if (null == this.process) {
			this.process = new ProcessFactory(this);
		}
		return process;
	}

	private PortalFactory portal;

	public PortalFactory portal() throws Exception {
		if (null == this.portal) {
			this.portal = new PortalFactory(this);
		}
		return portal;
	}

Z
zhourui 已提交
288 289
	public boolean isHasPlatformRole(String personName, String roleName) throws Exception {
		if (StringUtils.isEmpty(personName)) {
R
roo00 已提交
290 291
			throw new Exception("personName is null!");
		}
Z
zhourui 已提交
292
		if (StringUtils.isEmpty(roleName)) {
R
roo00 已提交
293 294 295
			throw new Exception("roleName is null!");
		}
		List<String> roleList = null;
Z
zhourui 已提交
296 297 298
		roleList = organization().role().listWithPerson(personName);
		if (roleList != null && !roleList.isEmpty()) {
			if (roleList.stream().filter(r -> roleName.equalsIgnoreCase(r)).count() > 0) {
R
roo00 已提交
299 300 301 302 303 304 305
				return true;
			}
		} else {
			return false;
		}
		return false;
	}
306

R
roo00 已提交
307
	/**
R
update  
roo00 已提交
308
	 * 判断用户是否管理员权限
309
	 *
R
update  
roo00 已提交
310
	 * @param person
R
roo00 已提交
311 312 313
	 * @return
	 * @throws Exception
	 */
R
update  
roo00 已提交
314
	public boolean isManager(EffectivePerson person) throws Exception {
R
roo00 已提交
315
		// 如果用户的身份是平台的超级管理员,那么就是超级管理员权限
Z
zhourui 已提交
316
		if (person.isManager()) {
R
roo00 已提交
317
			return true;
O
o2sword 已提交
318 319 320 321 322
		} else {
			if (organization().person().hasRole(person, OrganizationDefinition.Manager,
					OrganizationDefinition.CMSManager)) {
				return true;
			}
R
roo00 已提交
323 324 325 326
		}
		return false;
	}

O
o2sword 已提交
327 328
	/**
	 * 判断用户是否管理员权限
329
	 *
O
o2sword 已提交
330 331 332 333 334 335
	 * @param person
	 * @return
	 * @throws Exception
	 */
	public boolean isCreatorManager(EffectivePerson person) throws Exception {
		// 如果用户的身份是平台的超级管理员,那么就是超级管理员权限
Z
zhourui 已提交
336
		if (person.isManager()) {
O
o2sword 已提交
337 338 339 340 341 342 343 344 345 346
			return true;
		} else {
			if (organization().person().hasRole(person, OrganizationDefinition.Manager,
					OrganizationDefinition.CMSManager, OrganizationDefinition.CMSCreator)) {
				return true;
			}
		}
		return false;
	}

O
o2sword 已提交
347 348
	/**
	 * 是否是栏目管理员
349
	 *
O
o2sword 已提交
350 351 352 353 354 355
	 * @param person
	 * @param appInfo
	 * @return
	 * @throws Exception
	 */
	public boolean isAppInfoManager(EffectivePerson person, AppInfo appInfo) throws Exception {
Z
zhourui 已提交
356
		if (isManager(person)) {
O
o2sword 已提交
357 358
			return true;
		}
Z
zhourui 已提交
359
		if (appInfo != null) {
O
o2sword 已提交
360 361 362 363 364 365
			if (ListTools.isNotEmpty(appInfo.getManageablePersonList())) {
				if (appInfo.getManageablePersonList().contains(person.getDistinguishedName())) {
					return true;
				}
			}
			if (ListTools.isNotEmpty(appInfo.getManageableUnitList())) {
Z
zhourui 已提交
366 367
				List<String> unitNames = this.organization().unit()
						.listWithPersonSupNested(person.getDistinguishedName());
O
o2sword 已提交
368 369 370 371 372 373 374 375 376 377 378 379 380 381
				if (ListTools.containsAny(unitNames, appInfo.getManageableUnitList())) {
					return true;
				}
			}
			if (ListTools.isNotEmpty(appInfo.getManageableGroupList())) {
				List<String> groupNames = this.organization().group().listWithPerson(person.getDistinguishedName());
				if (ListTools.containsAny(groupNames, appInfo.getManageableGroupList())) {
					return true;
				}
			}
		}
		return false;
	}

O
o2sword 已提交
382 383
	/**
	 * 是否是栏目创建管理员
384
	 *
O
o2sword 已提交
385 386 387 388 389 390
	 * @param person
	 * @param appInfo
	 * @return
	 * @throws Exception
	 */
	public boolean isAppCreatorManager(EffectivePerson person, AppInfo appInfo) throws Exception {
Z
zhourui 已提交
391
		if (appInfo != null) {
O
o2sword 已提交
392 393 394 395 396 397 398 399 400
			if (isManager(person)) {
				return true;
			}
			if (ListTools.isNotEmpty(appInfo.getManageablePersonList())) {
				if (appInfo.getManageablePersonList().contains(person.getDistinguishedName())) {
					return true;
				}
			}
			if (ListTools.isNotEmpty(appInfo.getManageableUnitList())) {
Z
zhourui 已提交
401 402
				List<String> unitNames = this.organization().unit()
						.listWithPersonSupNested(person.getDistinguishedName());
O
o2sword 已提交
403 404 405 406 407 408 409 410 411 412
				if (ListTools.containsAny(unitNames, appInfo.getManageableUnitList())) {
					return true;
				}
			}
			if (ListTools.isNotEmpty(appInfo.getManageableGroupList())) {
				List<String> groupNames = this.organization().group().listWithPerson(person.getDistinguishedName());
				if (ListTools.containsAny(groupNames, appInfo.getManageableGroupList())) {
					return true;
				}
			}
Z
zhourui 已提交
413
		} else if (isCreatorManager(person)) {
O
o2sword 已提交
414 415 416 417 418
			return true;
		}
		return false;
	}

419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502
	/**
	 * 是否是文档的编辑者
	 * @param person
	 * @param appInfo
	 * @return
	 * @throws Exception
	 */
	public boolean isDocumentEditor(EffectivePerson person, AppInfo appInfo, CategoryInfo categoryInfo, Document document) throws Exception {
		if (isManager(person)) {
			return true;
		}
		List<String> unitNames = null;
		List<String> groupNames = null;
		if(document!=null){
			if( ListTools.isNotEmpty( document.getAuthorPersonList() )) {
				if( document.getAuthorPersonList().contains( getShortTargetFlag(person.getDistinguishedName()) ) ) {
					return true;
				}
			}
			if( ListTools.isNotEmpty( document.getAuthorUnitList() )) {
				unitNames = this.organization().unit()
						.listWithPersonSupNested(person.getDistinguishedName());
				if( ListTools.containsAny( getShortTargetFlag(unitNames), document.getAuthorUnitList())) {
					return true;
				}
			}
			if( ListTools.isNotEmpty( document.getAuthorGroupList() )) {
				groupNames = this.organization().group().listWithPerson(person.getDistinguishedName());
				if( ListTools.containsAny( getShortTargetFlag(groupNames), document.getAuthorGroupList())) {
					return true;
				}
			}
		}
		if (categoryInfo != null) {
			if (ListTools.isNotEmpty(categoryInfo.getManageablePersonList())) {
				if (categoryInfo.getManageablePersonList().contains(person.getDistinguishedName())) {
					return true;
				}
			}
			if (ListTools.isNotEmpty(categoryInfo.getManageableUnitList())) {
				if(unitNames == null) {
					unitNames = this.organization().unit()
							.listWithPersonSupNested(person.getDistinguishedName());
				}
				if (ListTools.containsAny(unitNames, categoryInfo.getManageableUnitList())) {
					return true;
				}
			}
			if (ListTools.isNotEmpty(categoryInfo.getManageableGroupList())) {
				if(groupNames == null) {
					groupNames = this.organization().group().listWithPerson(person.getDistinguishedName());
				}
				if (ListTools.containsAny(groupNames, categoryInfo.getManageableGroupList())) {
					return true;
				}
			}
		}
		if (appInfo != null) {
			if (ListTools.isNotEmpty(appInfo.getManageablePersonList())) {
				if (appInfo.getManageablePersonList().contains(person.getDistinguishedName())) {
					return true;
				}
			}
			if (ListTools.isNotEmpty(appInfo.getManageableUnitList())) {
				if(unitNames == null) {
					unitNames = this.organization().unit()
							.listWithPersonSupNested(person.getDistinguishedName());
				}
				if (ListTools.containsAny(unitNames, appInfo.getManageableUnitList())) {
					return true;
				}
			}
			if (ListTools.isNotEmpty(appInfo.getManageableGroupList())) {
				if(groupNames == null) {
					groupNames = this.organization().group().listWithPerson(person.getDistinguishedName());
				}
				if (ListTools.containsAny(groupNames, appInfo.getManageableGroupList())) {
					return true;
				}
			}
		}
		return false;
	}

R
roo00 已提交
503 504
	/**
	 * TODO (uncomplete)判断用户是否有权限进行:[表单模板管理]操作
R
update  
roo00 已提交
505
	 *
R
roo00 已提交
506 507 508 509
	 * @param person
	 * @return
	 * @throws Exception
	 */
Z
zhourui 已提交
510 511
	public boolean formEditAvailable(EffectivePerson person) throws Exception {
		if (isManager(person)) {
R
roo00 已提交
512 513 514
			return true;
		}
		// 其他情况暂时全部不允许操作
O
o2sword 已提交
515
		return true;
R
roo00 已提交
516 517 518 519
	}

	/**
	 * TODO (uncomplete)判断用户是否有权限进行:[视图配置管理]操作
R
update  
roo00 已提交
520
	 *
R
roo00 已提交
521 522 523 524
	 * @param person
	 * @return
	 * @throws Exception
	 */
Z
zhourui 已提交
525
	public boolean viewEditAvailable(EffectivePerson person) throws Exception {
R
update  
roo00 已提交
526
		if (isManager(person)) {
R
roo00 已提交
527 528 529
			return true;
		}
		// 其他情况暂时全部不允许操作
O
o2sword 已提交
530
		return true;
R
roo00 已提交
531 532
	}

Z
zhourui 已提交
533
	public boolean editable(EffectivePerson effectivePerson, AppInfo appInfo) throws Exception {
R
roo00 已提交
534
		if ((StringUtils.equals(appInfo.getCreatorPerson(), effectivePerson.getDistinguishedName()))
Z
zhourui 已提交
535 536
				|| effectivePerson.isManager()
				|| organization().person().hasRole(effectivePerson, OrganizationDefinition.CMSManager)) {
R
roo00 已提交
537 538
			return true;
		}
539

Z
zhourui 已提交
540 541 542
		// 判断effectivePerson是不是该栏目的管理者:涉及 个人,组织和群组
		List<String> unitNameList = this.organization().unit()
				.listWithPersonSupNested(effectivePerson.getDistinguishedName());
R
roo00 已提交
543
		List<String> groupNameList = new ArrayList<String>();
Z
zhourui 已提交
544
		List<String> groupList = this.organization().group().listWithPerson(effectivePerson.getDistinguishedName());
R
roo00 已提交
545
		if (groupList != null && groupList.size() > 0) {
Z
zhourui 已提交
546
			groupList.stream().filter(g -> !groupNameList.contains(g)).distinct().forEach(g -> groupNameList.add(g));
R
roo00 已提交
547 548
		}

Z
zhourui 已提交
549 550
		if (ListTools.isNotEmpty(appInfo.getManageablePersonList())) {
			if (appInfo.getManageablePersonList().contains(effectivePerson.getDistinguishedName())) {
R
roo00 已提交
551 552 553
				return true;
			}
		}
554

Z
zhourui 已提交
555 556 557
		if (ListTools.isNotEmpty(appInfo.getManageableGroupList()) && ListTools.isNotEmpty(groupNameList)) {
			groupNameList.retainAll(appInfo.getManageableGroupList());
			if (ListTools.isNotEmpty(groupNameList)) {
R
roo00 已提交
558 559 560
				return true;
			}
		}
561

Z
zhourui 已提交
562 563 564
		if (ListTools.isNotEmpty(appInfo.getManageableUnitList()) && ListTools.isNotEmpty(unitNameList)) {
			unitNameList.retainAll(appInfo.getManageableUnitList());
			if (ListTools.isNotEmpty(unitNameList)) {
R
roo00 已提交
565 566 567
				return true;
			}
		}
O
o2sword 已提交
568
		return false;
R
roo00 已提交
569
	}
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606

	public static String getShortTargetFlag(String distinguishedName) {
		String target = null;
		if( StringUtils.isNotEmpty( distinguishedName ) ){
			String[] array = distinguishedName.split("@");
			StringBuffer sb = new StringBuffer();
			if( array.length == 3 ){
				target = sb.append(array[1]).append("@").append(array[2]).toString();
			}else if( array.length == 2 ){
				//2段
				target = sb.append(array[0]).append("@").append(array[1]).toString();
			}else{
				target = array[0];
			}
		}
		return target;
	}

	public static List<String> getShortTargetFlag(List<String> nameList) {
		List<String> targetList = new ArrayList<>();
		if( ListTools.isNotEmpty( nameList ) ){
			for(String distinguishedName : nameList) {
				String target = distinguishedName;
				String[] array = target.split("@");
				StringBuffer sb = new StringBuffer();
				if (array.length == 3) {
					target = sb.append(array[1]).append("@").append(array[2]).toString();
				} else if (array.length == 2) {
					target = sb.append(array[0]).append("@").append(array[1]).toString();
				} else {
					target = array[0];
				}
				targetList.add(target);
			}
		}
		return targetList;
	}
R
roo00 已提交
607
}