DynamicService.java 44.4 KB
Newer Older
R
roo00 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
package com.x.teamwork.assemble.control.service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.annotation.CheckPersistType;
import com.x.base.core.entity.annotation.CheckRemoveType;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.tools.ListTools;
import com.x.teamwork.assemble.common.date.DateOperation;
import com.x.teamwork.assemble.control.Business;
import com.x.teamwork.core.entity.Attachment;
import com.x.teamwork.core.entity.Chat;
import com.x.teamwork.core.entity.Dynamic;
import com.x.teamwork.core.entity.DynamicDetail;
import com.x.teamwork.core.entity.Project;
L
luojing 已提交
22
import com.x.teamwork.core.entity.CustomExtFieldRele;
R
roo00 已提交
23
import com.x.teamwork.core.entity.ProjectGroup;
L
luojing 已提交
24
import com.x.teamwork.core.entity.ProjectTemplate;
R
roo00 已提交
25
import com.x.teamwork.core.entity.Task;
R
roo00 已提交
26
import com.x.teamwork.core.entity.TaskDetail;
R
roo00 已提交
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
import com.x.teamwork.core.entity.TaskList;
import com.x.teamwork.core.entity.TaskTag;
import com.x.teamwork.core.entity.tools.filter.QueryFilter;
import com.x.teamwork.core.entity.tools.filter.term.InTerm;

/**
 * 对项目信息查询的服务
 * 
 * @author O2LEE
 */
class DynamicService {

	/**
	 * 根据项目的标识查询项目的信息
	 * @param emc
	 * @param flag  主要是ID
	 * @return
	 * @throws Exception 
	 */
	protected Dynamic get(EntityManagerContainer emc, String flag) throws Exception {
		Business business = new Business( emc );
		return business.dynamicFactory().get( flag );
	}
	
	/**
	 * 根据项目的标识查询项目的信息
	 * @param emc
	 * @param flag  主要是ID
	 * @return
	 * @throws Exception 
	 */
	protected DynamicDetail getDetail(EntityManagerContainer emc, String flag) throws Exception {
		Business business = new Business( emc );
		return business.dynamicFactory().getDetail( flag );
	}

	/**
	 * 根据过滤条件查询符合要求的项目信息数量
	 * @param emc
	 * @param queryFilter
	 * @return
	 * @throws Exception
	 */
	protected Long countWithFilter( EntityManagerContainer emc, QueryFilter queryFilter ) throws Exception {
		Business business = new Business( emc );
		return business.dynamicFactory().countWithFilter( queryFilter );
	}
	
	/**
	 * 根据过滤条件查询符合要求的项目信息列表
	 * @param emc
	 * @param maxCount
	 * @param orderField
	 * @param orderType
	 * @param projectIds
	 * @param taskIds
	 * @return
	 * @throws Exception
	 */
	protected List<Dynamic> listWithFilter( EntityManagerContainer emc, Integer maxCount, String orderField, String orderType, List<String> projectIds, List<String> taskIds ) throws Exception {
		Business business = new Business( emc );
		
		//组织查询条件对象
		QueryFilter  queryFilter = new QueryFilter();
		if( ListTools.isNotEmpty( projectIds )) {
			queryFilter.addInTerm( new InTerm( "projectId", new ArrayList<Object>(projectIds) ) );
		}
		if( ListTools.isNotEmpty( taskIds )) {
			queryFilter.addInTerm( new InTerm( "taskIds", new ArrayList<Object>(taskIds) ) );
		}
		
		return business.dynamicFactory().listWithFilter(maxCount, orderField, orderType, queryFilter);
	}
	
	/**
	 * 根据过滤条件查询符合要求的项目信息列表
	 * @param emc
	 * @param maxCount
	 * @param orderField
	 * @param orderType
	 * @return
	 * @throws Exception
	 */
	protected List<Dynamic> listWithFilterNext( EntityManagerContainer emc, Integer maxCount, String sequenceFieldValue, String orderField, String orderType, QueryFilter queryFilter ) throws Exception {
		Business business = new Business( emc );		
		return business.dynamicFactory().listWithFilter( maxCount, sequenceFieldValue, orderField, orderType, queryFilter );
	}

	/**
	 * 向数据库持久化动态信息
	 * @param emc
liyi_hz2008's avatar
liyi_hz2008 已提交
118
	 * @param object
R
roo00 已提交
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
	 * @return
	 * @throws Exception 
	 */
	protected Dynamic save( EntityManagerContainer emc, Dynamic object, String content ) throws Exception {
		Dynamic dynamic = null;
		DynamicDetail dynamicDetail = null;
		Project project = null;
		if( StringUtils.isEmpty( object.getId() )  ){
			object.setId( Dynamic.createId() );
		}
		dynamic = emc.find( object.getId(), Dynamic.class );
		dynamicDetail = emc.find( object.getId(), DynamicDetail.class );
		project = emc.find( object.getProjectId() , Project.class );
		
		emc.beginTransaction( Dynamic.class );
		emc.beginTransaction( DynamicDetail.class );
		if( project != null && StringUtils.isEmpty( object.getProjectTitle() ) ) {
			object.setProjectTitle( project.getTitle() );
		}
		String lobValue = null;
R
roo00 已提交
139 140 141 142 143 144
		if( object.getCreateTime() == null ) {
			object.setCreateTime( new Date());
		}
		if( object.getUpdateTime() == null ) {
			object.setUpdateTime( new Date());
		}
R
roo00 已提交
145 146 147 148 149 150 151 152 153 154 155 156 157 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
		if( dynamic == null ){ // 保存一个新的对象
			dynamic = new Dynamic();
			object.copyTo( dynamic );
			if( StringUtils.isNotEmpty( object.getId() ) ){
				dynamic.setId( object.getId() );
			}
			lobValue = dynamic.getDescription();
			if( dynamic.getDescription().length() > 80 ) {
				dynamic.setDescription( dynamic.getDescription().substring(0, 80) + "...");
			}
			emc.persist( dynamic, CheckPersistType.all);
		}else{ //对象已经存在,更新对象信息
			object.copyTo( dynamic, JpaObject.FieldsUnmodify  );
			emc.check( dynamic, CheckPersistType.all );	
		}		
		if( dynamicDetail == null ){ 
			dynamicDetail = new DynamicDetail();
			dynamicDetail.setId( dynamic.getId() );
			dynamicDetail.setContent(content);
			emc.persist( dynamicDetail, CheckPersistType.all);
		}else {
			dynamicDetail.setContent(content);
			if( StringUtils.isEmpty( dynamicDetail.getContent() )) {
				dynamicDetail.setContent( lobValue );
			}
			emc.check( dynamicDetail, CheckPersistType.all );	
		}		
		emc.commit();
		return dynamic;
	}

	/**
	 * 根据项目标识删除项目信息
	 * @param emc
	 * @param flag 主要是ID
	 * @throws Exception 
	 */
	protected void delete(EntityManagerContainer emc, String flag) throws Exception {
		Dynamic dynamic = emc.find( flag, Dynamic.class );
		if( dynamic != null ) {
			//这里要先递归删除所有的任务信息
			emc.beginTransaction( Dynamic.class );
			emc.remove( dynamic , CheckRemoveType.all );
			emc.commit();
		}
	}

	/**
	 * 根据参数组织一个简单的通用操作动态信息
	 * @param objectType
	 * @param title
	 * @param description
	 * @param viewUrl
	 * @param optType
	 * @param effectivePerson
	 * @param personal
	 * @return
	 */
	private Dynamic composeNewSimpleDynamic( String objectType, String title, String description, String viewUrl, String optType, EffectivePerson effectivePerson, Boolean personal) {
R
roo00 已提交
204 205 206
		if( StringUtils.isNotEmpty(description) && description.length() > 70 ) {
			description = description.substring( 0 , 70 ) + "..." ;
		}
R
roo00 已提交
207 208 209 210 211 212
		Dynamic dynamic = new Dynamic();
		dynamic.setObjectType( objectType );
		dynamic.setOperator( effectivePerson.getDistinguishedName() );		
		dynamic.setOptType(optType);
		dynamic.setOptTime( new Date() );
		dynamic.setDateTimeStr( DateOperation.getNowDateTime());		
R
roo00 已提交
213
		dynamic.setTitle( title );		
R
roo00 已提交
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
		dynamic.setDescription( description );
		dynamic.setViewUrl(viewUrl);
		dynamic.setPersonal( personal );
		return dynamic;
	}
	
	/**
	 * 根据参数组织一个新的Project操作动态信息
	 * @param objectType
	 * @param title
	 * @param description
	 * @param viewUrl
	 * @param optType
	 * @param object
	 * @param effectivePerson
	 * @param personal
	 * @return
	 */
	private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, Project object,  EffectivePerson effectivePerson, Boolean personal) {
		Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal );
		dynamic.setProjectId( object.getId() );
		dynamic.setProjectTitle( object.getTitle() );
		dynamic.setTaskId( ""  );
		dynamic.setTaskTitle( null );
		dynamic.setBundle( object.getId() );
		dynamic.setTarget( object.getExecutor() );
		return dynamic;
	}
	
L
luojing 已提交
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
	/**
	 * 根据参数组织一个新的ProjectTemplate操作动态信息
	 * @param objectType
	 * @param title
	 * @param description
	 * @param viewUrl
	 * @param optType
	 * @param object
	 * @param effectivePerson
	 * @param personal
	 * @return
	 */
	private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, ProjectTemplate object,  EffectivePerson effectivePerson, Boolean personal) {
		Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal );
		dynamic.setProjectId( object.getId() );
		dynamic.setProjectTitle( object.getTitle() );
		dynamic.setTaskId( ""  );
		dynamic.setTaskTitle( null );
		dynamic.setBundle( object.getId() );
		dynamic.setTarget( object.getOwner() );
		return dynamic;
	}
	
R
roo00 已提交
266 267 268 269 270 271 272 273 274 275 276 277
	/**
	 * 根据参数组织一个新的ProjectExtFieldRele操作动态信息
	 * @param objectType
	 * @param title
	 * @param description
	 * @param viewUrl
	 * @param optType
	 * @param object
	 * @param effectivePerson
	 * @param personal
	 * @return
	 */
L
luojing 已提交
278
	private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, CustomExtFieldRele object,  EffectivePerson effectivePerson, Boolean personal ) {
R
roo00 已提交
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
		Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal );
		dynamic.setProjectId( object.getId() );
		dynamic.setProjectTitle( object.getDisplayName() + "(" + object.getExtFieldName() + ")" );
		dynamic.setTaskId( ""  );
		dynamic.setTaskTitle( null );
		dynamic.setBundle( object.getId() );
		dynamic.setTarget( effectivePerson.getDistinguishedName() );
		return dynamic;
	}
	
	/**
	 * 根据参数组织一个新的TaskList操作动态信息
	 * @param objectType
	 * @param title
	 * @param description
	 * @param viewUrl
	 * @param optType
	 * @param object
	 * @param effectivePerson
	 * @param personal
	 * @return
	 */
	private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, TaskList object,  EffectivePerson effectivePerson, Boolean personal ) {
		Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal );
		dynamic.setProjectId( object.getId() );
		dynamic.setProjectTitle( null );
		dynamic.setTaskId( ""  );
		dynamic.setTaskTitle( null );
		dynamic.setBundle( object.getId() );
		dynamic.setTarget( effectivePerson.getDistinguishedName() );
		return dynamic;
	}
	
	/**
	 * 根据参数组织一个新的Task操作动态信息
	 * @param objectType
	 * @param title
	 * @param description
	 * @param viewUrl
	 * @param optType
	 * @param object
	 * @param effectivePerson
	 * @param personal
	 * @return
	 */
	private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, Task object,  EffectivePerson effectivePerson, Boolean personal ) {
R
roo00 已提交
325 326 327
		if( description.length() > 70 ) {
			description = description.substring( 0, 60 )+ "...";
		}
R
roo00 已提交
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
		Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal );
		dynamic.setProjectId( object.getId() );
		dynamic.setProjectTitle( object.getProjectName() );
		dynamic.setTaskId( object.getId()  );
		dynamic.setTaskTitle( object.getName() );
		dynamic.setBundle( object.getId() );
		dynamic.setTarget( object.getExecutor() );
		return dynamic;
	}
	
	/**
	 * 根据参数组织一个新的ProjectGroup操作动态信息
	 * @param objectType
	 * @param title
	 * @param description
	 * @param viewUrl
	 * @param optType
	 * @param object
	 * @param effectivePerson
	 * @param personal
	 * @return
	 */
	private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, ProjectGroup object,  EffectivePerson effectivePerson, Boolean personal ) {
		Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal );
		dynamic.setProjectId( "" );
		dynamic.setProjectTitle(null );
		dynamic.setTaskId( ""  );
		dynamic.setTaskTitle( null );
		dynamic.setBundle( object.getId() );
		dynamic.setTarget( effectivePerson.getDistinguishedName() );
		return dynamic;
	}

	/**
	 * 根据参数组织一个新的Attachment操作动态信息
	 * @param objectType
	 * @param title
	 * @param description
	 * @param viewUrl
	 * @param optType
	 * @param object
	 * @param effectivePerson
	 * @param personal
	 * @return
	 */
	private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, Attachment object,  EffectivePerson effectivePerson, Boolean personal) {
		Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal );
		dynamic.setProjectId( object.getProjectId() );
		dynamic.setProjectTitle( null );
		dynamic.setTaskId( object.getTaskId()  );
		dynamic.setTaskTitle( null );
		dynamic.setBundle( object.getId() );
		dynamic.setTarget( effectivePerson.getDistinguishedName() );
		return dynamic;
	}
	
	/**
	 * 根据参数组织一个新的TaskTag操作动态信息
	 * @param objectType
	 * @param title
	 * @param description
	 * @param viewUrl
	 * @param optType
	 * @param object
	 * @param effectivePerson
	 * @param personal
	 * @return
	 */
	private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, TaskTag object,  EffectivePerson effectivePerson, Boolean personal) {
		Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal );
		dynamic.setProjectId( object.getProject() );
		dynamic.setProjectTitle( null );
		dynamic.setTaskId( ""  );
		dynamic.setTaskTitle( null );
		dynamic.setBundle( object.getId() );
		dynamic.setTarget( effectivePerson.getDistinguishedName() );
		return dynamic;
	}
	
	/**
	 * 根据参数组织一个新的Chat操作动态信息
	 * @param objectType
	 * @param title
	 * @param description
	 * @param viewUrl
	 * @param optType
	 * @param object
	 * @param effectivePerson
	 * @param personal
	 * @return
	 */
	private Dynamic composeNewDynamic( String objectType, String title, String description, String viewUrl, String optType, Chat object,  EffectivePerson effectivePerson, Boolean personal) {
		Dynamic dynamic = composeNewSimpleDynamic(objectType, title, description, viewUrl, optType, effectivePerson, personal );
		dynamic.setProjectId( object.getId() );
L
luojing 已提交
422
		dynamic.setProjectTitle( object.getProjectTitle() );
R
roo00 已提交
423
		dynamic.setTaskId( object.getTaskId()  );
L
luojing 已提交
424
		dynamic.setTaskTitle( object.getTaskTitle() );
R
roo00 已提交
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441
		dynamic.setBundle( object.getId() );
		dynamic.setTarget( object.getTarget() );
		return dynamic;
	}
	
	/**
	 * 保存项目创建或者更新动态信息
	 * @param object_old
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected List<Dynamic> getProjectSaveDynamic( Project object_old, Project object, EffectivePerson effectivePerson ) {
		List<Dynamic> dynamics = new ArrayList<>();
		String objectType =  "PROJECT";
		String viewUrl = null;
		String title =  null;
R
roo00 已提交
442
		String optType = "UPDATE_PROJECT";
R
roo00 已提交
443 444 445 446
		String description = null;
		if( object_old != null ) {
			if( !object_old.getTitle().equalsIgnoreCase( object.getTitle() )) { //变更了名称
				title =  "项目信息标题变更";
R
roo00 已提交
447
				optType = "UPDATE_TITLE";
R
roo00 已提交
448 449 450 451 452
				description = effectivePerson.getName() + "变更了项目信息的标题为:" + object.getTitle();
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
			}
			if( !object_old.getExecutor().equalsIgnoreCase( object.getExecutor() )) {//变更了负责人
				title =  "项目负责人变更";
R
roo00 已提交
453 454 455 456 457 458 459
				optType = "UPDATE_EXECUTOR";
				if( StringUtils.isNotEmpty(  object.getExecutor() ) &&  object.getExecutor().split( "@" ).length > 1 ) {
					description = effectivePerson.getName() + "变更了项目负责人为:" + object.getExecutor().split( "@" )[0] + "。";					
				}else {
					description = effectivePerson.getName() + "变更了项目负责人为:" + object.getExecutor() + "。";
				}
				
R
roo00 已提交
460 461 462 463
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
			}
		}else {//创建项目
			title =  "项目信息创建";
R
roo00 已提交
464
			optType = "CREATE";
R
roo00 已提交
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480
			description = effectivePerson.getName() + "创建了新的项目信息:" + object.getTitle() + "。";
			dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
		}
		return dynamics;
	}
	
	/**
	 * 组织一个更新项目图片操作动态
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected Dynamic getProjectIconSaveDynamic( Project object, EffectivePerson effectivePerson ) {
		String objectType =  "PROJECT";
		String title =  "项目信息图标更新";
		String viewUrl = null;
R
roo00 已提交
481
		String optType =  "UPDATE_ICON";
R
roo00 已提交
482 483 484 485 486 487 488 489 490 491 492 493 494 495
		String description = effectivePerson.getName() +"更新了项目信息图标。";
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}
	
	/**
	 * 组织一个项目删除操作动态
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected Dynamic getProjectDeleteDynamic( Project object, EffectivePerson effectivePerson ) {
		String objectType =  "PROJECT";
		String title =  "项目信息删除";
		String viewUrl = null;
R
roo00 已提交
496
		String optType =  "DELETE";
R
roo00 已提交
497 498 499 500
		String description = effectivePerson.getName() +"删除了项目信息:" + object.getTitle();
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}
	
L
luojing 已提交
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551
	/**
	 * 组织一个项目恢复操作动态
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected Dynamic getProjectRecoveryDynamic( Project object, EffectivePerson effectivePerson ) {
		String objectType =  "PROJECT";
		String title =  "项目恢复";
		String viewUrl = null;
		String optType =  "RECOVERY";
		String description = effectivePerson.getName() +"恢复了项目:" + object.getTitle();
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}
	
	/**
	 * 组织一个项目更改状态操作动态
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected Dynamic getCompleteDynamic( Project object, EffectivePerson effectivePerson ,Boolean status) {
		String objectType =  "PROJECT";
		String title =  "项目状态更改";
		String viewUrl = null;
		String optType =  "COMPLETE";
		String description = effectivePerson.getName() +"项目:" + object.getTitle()+",状态更改为:未完成";
		if(status){
			description = effectivePerson.getName() +"项目:" + object.getTitle()+",状态更改为:已完成";
		}
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}
	
	/**
	 * 组织一个项目更改是否可创建任务操作动态
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected Dynamic getCreateableDynamic( Project object, EffectivePerson effectivePerson ,Boolean status) {
		String objectType =  "PROJECT";
		String title =  "项目权限设置";
		String viewUrl = null;
		String optType =  "CREATEABLE";
		String description = effectivePerson.getName() +"项目:" + object.getTitle()+",权限设置为:不可创建任务";
		if(status){
			description = effectivePerson.getName() +"项目:" + object.getTitle()+",权限设置为:可创建任务";
		}
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}
	
R
roo00 已提交
552 553 554 555 556 557 558 559 560
	/**
	 * 保存和根据项目组信息操作动态
	 * @param object_old
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected Dynamic getProjectGroupSaveDynamic( ProjectGroup object_old, ProjectGroup object, EffectivePerson effectivePerson ) {
		String objectType =  "PROJECT_GROUP";
R
roo00 已提交
561
		String optType =  "UPDATE_PROJECT_GROUP";
R
roo00 已提交
562 563 564 565 566 567
		String viewUrl = null;
		String title =  "项目组信息" + optType.toUpperCase();
		String description = effectivePerson.getDistinguishedName() + "添加了了一个项目组信息:" + object.getName();
		if( object_old != null ) {
			if( !object_old.getName().equalsIgnoreCase( object.getName() )) { //变更了显示名称
				title =  "变更项目组名称";
R
roo00 已提交
568
				optType = "UPDATE_NAME";
R
roo00 已提交
569 570 571 572 573
				description = effectivePerson.getName() + "变更了项目组名称为:" + object.getName();
				return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true );
			}
		}else {
			title =  "添加项目组信息";
R
roo00 已提交
574
			optType = "CREATE";
R
roo00 已提交
575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590
			description = effectivePerson.getName() + "添加了新的项目组:" + object.getName();
			return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true );
		}
		return null;
	}
	
	/**
	 * 组织一个项目组删除操作动态
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected Dynamic getProjectGroupDeleteDynamic( ProjectGroup object, EffectivePerson effectivePerson ) {
		String objectType =  "PROJECT_GROUP";
		String title =  "项目组信息删除";
		String viewUrl = null;
R
roo00 已提交
591
		String optType =  "DELETE";
R
roo00 已提交
592 593 594 595
		String description = effectivePerson.getName() +"删除了项目组信息:" + object.getName();
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true );
	}
	
L
luojing 已提交
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610
	/**
	 * 组织一个项目模板删除操作动态
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected Dynamic getProjectTemplateDeleteDynamic( ProjectTemplate object, EffectivePerson effectivePerson ) {
		String objectType =  "PROJECT_TEMPLATE";
		String title =  "项目模板信息删除";
		String viewUrl = null;
		String optType =  "DELETE";
		String description = effectivePerson.getName() +"删除了项目模板信息:" + object.getTitle();
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true );
	}
	
R
roo00 已提交
611
	/**
L
luojing 已提交
612
	 * 组织扩展信息配置保存操作动态
R
roo00 已提交
613 614 615 616 617
	 * @param object_old
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
L
luojing 已提交
618 619
	protected Dynamic getProjectSaveExtFieldReleDynamic( CustomExtFieldRele object_old, CustomExtFieldRele object, EffectivePerson effectivePerson ) {
		String objectType =  "CUSTOM_EXTFIELD_RELE";
R
roo00 已提交
620
		String optType =  "UPDATE_EXTFIELD_RELE";
L
luojing 已提交
621
		String title =  "保存扩展属性";
R
roo00 已提交
622 623 624 625
		String viewUrl = null;
		String description = null;
		if( object_old != null ) {
			if( !object_old.getDisplayName().equalsIgnoreCase( object.getDisplayName() )) { //变更了显示名称
L
luojing 已提交
626
				title =  "变更扩展属性显示名称";
R
roo00 已提交
627
				optType = "UPDATE_DISPLAYNAME";
L
luojing 已提交
628
				description = effectivePerson.getName() + "变更了扩展属性"+object.getExtFieldName()+"的显示名称为:" + object.getDisplayName();
R
roo00 已提交
629 630 631
				return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
			}
		}else {
L
luojing 已提交
632
			title =  "添加扩展属性信息";
R
roo00 已提交
633
			optType = "CREATE";
L
luojing 已提交
634
			description = effectivePerson.getName() + "添加了新的扩展属性:" + object.getDisplayName() + "("+object.getExtFieldName()+")。";
R
roo00 已提交
635 636 637 638 639 640
			return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
		}
		return null;
	}
	
	/**
L
luojing 已提交
641
	 * 组织扩展信息配置删除操作动态
R
roo00 已提交
642 643 644 645
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
L
luojing 已提交
646 647 648
	protected Dynamic getProjectDeleteExtFieldReleDynamic( CustomExtFieldRele object, EffectivePerson effectivePerson ) {
		String objectType =  "CUSTOM_EXTFIELD_RELE";
		String title =  "扩展属性信息删除";
R
roo00 已提交
649
		String viewUrl = null;
R
roo00 已提交
650
		String optType =  "DELETE";
L
luojing 已提交
651
		String description = effectivePerson.getName() +"删除了扩展属性:" + object.getDisplayName() + "("+object.getExtFieldName()+")。";
R
roo00 已提交
652 653 654
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}
	
L
luojing 已提交
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695
	/**
	 * 保存项目模板创建或者更新动态信息
	 * @param object_old
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected List<Dynamic> getProjectTemplateSaveDynamic( ProjectTemplate object_old, ProjectTemplate object, EffectivePerson effectivePerson ) {
		List<Dynamic> dynamics = new ArrayList<>();
		String objectType =  "PROJECTTEMPLATE";
		String viewUrl = null;
		String title =  null;
		String optType = "UPDATE_PROJECTTEMPLATE";
		String description = null;
		if( object_old != null ) {
			if( !object_old.getTitle().equalsIgnoreCase( object.getTitle() )) { //变更了名称
				title =  "项目模板信息标题变更";
				optType = "UPDATE_TITLE";
				description = effectivePerson.getName() + "变更了项目模板信息的标题为:" + object.getTitle();
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) ); 
			}
			if( !object_old.getOwner().equalsIgnoreCase( object.getOwner() )) {//变更了所有人
				title =  "项目模板所有人变更";
				optType = "UPDATE_EXECUTOR";
				if( StringUtils.isNotEmpty(  object.getOwner() ) &&  object.getOwner().split( "@" ).length > 1 ) {
					description = effectivePerson.getName() + "变更了项目模板所有人为:" + object.getOwner().split( "@" )[0] + "。";					
				}else {
					description = effectivePerson.getName() + "变更了项目模板所有人为:" + object.getOwner() + "。";
				}
				
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
			}
		}else {//创建项目
			title =  "项目模板信息创建";
			optType = "CREATE";
			description = effectivePerson.getName() + "创建了新的项目模板信息:" + object.getTitle() + "。";
			dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
		}
		return dynamics;
	}
	
R
roo00 已提交
696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712
	/**
	 * 组织项目工作任务列表保存操作动态
	 * @param object_old
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected Dynamic getTaskListSaveDynamic( TaskList object_old, TaskList object, EffectivePerson effectivePerson ) {
		String objectType =  "TASK_LIST";
		String optType =  "TASK_LIST";
		String viewUrl = null;
		String title =  "保存工作任务列表信息:" + object.getName();
		String description = effectivePerson.getDistinguishedName() + "保存了一个工作任务列表信息:" + object.getName();
		
		if( object_old != null ) {
			if( !object_old.getName().equalsIgnoreCase( object.getName() )) { //变更了列表名称
				title =  "变更工作任务列表名称";
R
roo00 已提交
713
				optType = "UPDATE_NAME";
R
roo00 已提交
714 715 716 717 718
				description = effectivePerson.getName() + "变更了工作任务列表名称为:"+object.getName();
				return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true );
			}
		}else {
			title =  "添加工作任务列表信息";
R
roo00 已提交
719
			optType = "CREATE";
R
roo00 已提交
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735
			description = effectivePerson.getName() + "添加了新的工作任务列表:" + object.getName() ;
			return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true );
		}
		return null;
	}
	
	/**
	 * 组织项目工作任务列表删除操作动态
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected Dynamic getTaskListDeleteDynamic( TaskList object, EffectivePerson effectivePerson ) {
		String objectType =  "TASK_LIST";
		String title =  "工作任务列表信息删除";
		String viewUrl = null;
R
roo00 已提交
736
		String optType =  "DELETE";
R
roo00 已提交
737 738 739 740 741 742 743 744 745 746 747 748 749 750
		String description = effectivePerson.getName() +"删除了工作任务列表:" + object.getName();
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true );
	}
	
	/**
	 * 删除工作任务信息操作动态
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected Dynamic getTaskDeleteDynamic( Task object, EffectivePerson effectivePerson ) {
		String objectType =  "TASK";
		String title =  "工作任务信息删除";
		String viewUrl = null;
R
roo00 已提交
751
		String optType =  "DELETE";
R
roo00 已提交
752 753 754 755 756 757 758 759 760 761
		String description = effectivePerson.getName() +"删除了工作任务信息:" + object.getName();
		Dynamic dynamic =  composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
		dynamic.setTarget( object.getExecutor() );		
		return dynamic;
	}
	
	/**
	 * 保存和更新任务信息操作动态
	 * @param object_old
	 * @param object
R
roo00 已提交
762 763
	 * @param newDetail 
	 * @param oldDetail 
R
roo00 已提交
764 765 766 767
	 * @param effectivePerson
	 * @return
	 * @throws Exception
	 */
R
roo00 已提交
768
	protected List<Dynamic> getTaskDynamic( Task object_old, Task object,  TaskDetail oldDetail, TaskDetail newDetail, EffectivePerson effectivePerson ) throws Exception {
R
roo00 已提交
769 770 771 772 773 774
		String objectType =  "TASK";
		String optType =  "TASK_INFO";
		String title =  "保存工作任务信息";
		List<Dynamic> dynamics = new ArrayList<>();
		String viewUrl = null;
		String description = null;
R
roo00 已提交
775
		
R
roo00 已提交
776 777
		if( object_old != null ) {
			if( !object_old.getName().equalsIgnoreCase( object.getName() )) {
R
roo00 已提交
778
				optType =  "UPDATE_NAME";
R
roo00 已提交
779 780 781 782 783
				title =  "工作任务标题变更";
				description = effectivePerson.getName() + "变更了任务信息:" + object.getName() + "的标题。";
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
			}
			if( !object_old.getExecutor().equalsIgnoreCase( object.getExecutor() )) {
R
roo00 已提交
784
				optType =  "UPDATE_EXECUTOR";
R
roo00 已提交
785 786 787 788 789
				title =  "工作任务负责人变更";
				description = effectivePerson.getName() + "变更了任务信息的负责人为:" + object.getExecutor() + "。";
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
			}
			if( !object_old.getWorkStatus().equalsIgnoreCase( object.getWorkStatus() )) {
R
roo00 已提交
790
				optType =  "UPDATE_STATUS";
R
roo00 已提交
791 792 793 794 795 796
				title =  "工作任务状态变更";
				description = effectivePerson.getName() + "变更了任务信息的状态为:" + object.getWorkStatus() + "。";
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
			}
			if( object_old.getStartTime().getTime() != object.getStartTime().getTime() 
					|| object_old.getEndTime().getTime() != object.getEndTime().getTime()  ) {
R
roo00 已提交
797
				optType =  "UPDATE_TIME";
R
roo00 已提交
798 799 800 801 802 803 804
				title =  "工作任务启始时间变更";
				description = effectivePerson.getName() + "变更了任务信息的启始时间为:" + 
				DateOperation.getDateStringFromDate( object_old.getStartTime(), "yyyy-MM-dd HH:mm:ss") + "到" + 
				DateOperation.getDateStringFromDate( object_old.getEndTime(), "yyyy-MM-dd HH:mm:ss") ;
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl,optType, object, effectivePerson, false ) );
			}
			if( object_old.getProgress() != object.getProgress()) {
R
roo00 已提交
805
				optType =  "UPDATE_PROGRESS";
R
roo00 已提交
806 807 808 809
				title =  "工作任务进度变更";
				description = effectivePerson.getName() + "变更了任务信息的工作进度为:" + object.getProgress() + "。";
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
			}
R
roo00 已提交
810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833
			if( !StringUtils.equals( object_old.getPriority(), object.getPriority())) {
				optType =  "UPDATE_PRIORITY";
				title =  "工作任务紧急程度变更";
				description = effectivePerson.getName() + "变更了任务信息的紧急程度为:" + object.getPriority() + "。";
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
			}
			if(  !StringUtils.equals( oldDetail.getDescription(), newDetail.getDescription()) ) {
				if( StringUtils.isEmpty( oldDetail.getDescription() ) && StringUtils.isNotEmpty( newDetail.getDescription() )) {
					optType =  "ADD_DESCRIPTION";
					title =  "工作任务备注信息添加";
					description = effectivePerson.getName() + "添加了任务的备注信息。";
				}else {
					if( StringUtils.isNotEmpty( newDetail.getDescription() ) ) {
						title =  "工作任务备注信息变更";
						optType =  "UPDATE_DESCRIPTION";
						description = effectivePerson.getName() + "变更了任务的备注信息。";
					}else {
						title =  "工作任务备注信息清空";
						optType =  "REMOVE_DESCRIPTION";
						description = effectivePerson.getName() + "清空了任务的备注信息。";
					}
				}
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
			}
R
roo00 已提交
834
		}else {
R
roo00 已提交
835
			optType =  "CREATE";
R
roo00 已提交
836 837 838 839 840 841 842
			title =  "工作任务信息新增";
			description = effectivePerson.getName() + "新增了新的任务信息:" + object.getName() + "。";
			dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
		}
		return dynamics;
	}
	
R
roo00 已提交
843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861
	public List<Dynamic> getTaskPropertyUpdateDynamic( Task task, String dynamicTitle, String dynamicOptType, String dynamicDescription, EffectivePerson effectivePerson) {
		List<Dynamic> dynamics = new ArrayList<>();
		String objectType =  "TASK";
		String viewUrl = null;
		if( StringUtils.isEmpty( dynamicOptType )) {
			dynamicOptType =  "TASK_INFO";
		}
		if( StringUtils.isEmpty( dynamicTitle )) {
			dynamicTitle =  "工作任务信息更新";
		}
		if( StringUtils.isEmpty( dynamicDescription )) {
			dynamicDescription = effectivePerson.getName() + "变更了任务信息:" + task.getName() + "的信息。";
		}
		if( StringUtils.isNotEmpty( dynamicTitle ) && task != null ) {
			dynamics.add( composeNewDynamic( objectType, dynamicTitle, dynamicDescription, viewUrl, dynamicOptType, task, effectivePerson, false ) );
		}
		
		return dynamics;
	}
liyi_hz2008's avatar
liyi_hz2008 已提交
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887

	/**
	 * 复制任务信息操作动态
	 * @param sourceTask
	 * @param newTask
	 * @param effectivePerson
	 * @return
	 * @throws Exception
	 */
	protected List<Dynamic> getTaskCopyDynamic( Task sourceTask, Task newTask, EffectivePerson effectivePerson ) throws Exception {
		String objectType =  "TASK";
		String optType =  "TASK_INFO";
		String title =  "复制工作任务信息";
		List<Dynamic> dynamics = new ArrayList<>();
		String viewUrl = null;
		String description = null;

		if( sourceTask != null ) {
			optType =  "COPY";
			title =  "工作任务信息复制";
			description = effectivePerson.getName() + "复制了任务:" + sourceTask.getName() + "。";
			dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, newTask, effectivePerson, false ) );
		}
		return dynamics;
	}

R
roo00 已提交
888 889
	/**
	 * 更新工作任务管理者信息操作动态
liyi_hz2008's avatar
liyi_hz2008 已提交
890
	 * @param object
R
roo00 已提交
891 892 893 894 895 896 897
	 * @param addManagers
	 * @param removeManagers
	 * @param effectivePerson
	 * @return
	 */
	public List<Dynamic> getTaskManagerDynamic( Task object, List<String> addManagers, List<String> removeManagers, EffectivePerson effectivePerson ) {
		String objectType =  "TASK";
R
roo00 已提交
898
		String optType =  "UPDATE_MANAGER";
R
roo00 已提交
899 900 901 902 903 904
		String title =  "更新工作任务管理者信息";
		List<Dynamic> dynamics = new ArrayList<>();
		String viewUrl = null;
		String description = null;
		if( ListTools.isNotEmpty( addManagers )) {
			for( String manager : addManagers ) {
R
roo00 已提交
905
				optType =  "ADD_MANAGER";
R
roo00 已提交
906 907 908 909 910 911 912
				title =  "添加工作任务管理者";
				description = effectivePerson.getName() + "为工作" +object.getName() + "添加了管理者:" + manager.split("@")[0] + "。";
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
			}
		}
		if( ListTools.isNotEmpty( removeManagers )) {
			for( String manager : removeManagers ) {
R
roo00 已提交
913
				optType =  "REMOVE_MANAGER";
R
roo00 已提交
914 915 916 917 918 919 920 921 922 923
				title =  "删除工作任务管理者";
				description = effectivePerson.getName() + "从工作" +object.getName() + "的管理者中删除了:" + manager.split("@")[0] + "。";
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
			}
		}		
		return dynamics;
	}
	
	/**
	 * 更新工作任务参与者操作动态
liyi_hz2008's avatar
liyi_hz2008 已提交
924
	 * @param object
R
roo00 已提交
925 926 927 928 929 930 931
	 * @param addParticipants
	 * @param removeParticipants
	 * @param effectivePerson
	 * @return
	 */
	public List<Dynamic> getTaskParticipantsDynamic( Task object, List<String> addParticipants, List<String> removeParticipants, EffectivePerson effectivePerson ) {
		String objectType =  "TASK";
R
roo00 已提交
932
		String optType =  "UPDATE_PARTICIPANTS";
R
roo00 已提交
933 934 935 936 937 938
		String title =  "更新工作任务参与者信息";
		List<Dynamic> dynamics = new ArrayList<>();
		String viewUrl = null;
		String description = null;
		if( ListTools.isNotEmpty( addParticipants )) {
			for( String participant : addParticipants ) {
R
roo00 已提交
939
				optType =  "ADD_PARTICIPANTS";
R
roo00 已提交
940 941 942 943 944 945 946
				title =  "添加工作任务参与者";
				description = effectivePerson.getName() + "为工作" +object.getName() + "添加了参与者:" + participant.split("@")[0] + "。";
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
			}
		}
		if( ListTools.isNotEmpty( removeParticipants)) {
			for( String participant : removeParticipants ) {
R
roo00 已提交
947
				optType =  "REMOVE_PARTICIPANTS";
R
roo00 已提交
948 949 950 951 952 953 954 955
				title =  "删除工作任务参与者";
				description = effectivePerson.getName() + "从工作" +object.getName() + "的参与者中删除了:" + participant.split("@")[0] + "。";
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
			}
		}
		return dynamics;
	}
	
R
roo00 已提交
956 957 958 959 960
	public Dynamic getTaskSplitDynamic(Task parentTask, Task task, EffectivePerson effectivePerson) {
		String objectType =  "TASK";
		String title =  "工作任务分解";
		String viewUrl = task.getId();
		String optType =  "SPLIT";
liyi_hz2008's avatar
liyi_hz2008 已提交
961
		String description = effectivePerson.getName() +"为工作添加了一个子任务:[" + task.getName() + "]";
R
roo00 已提交
962 963 964 965
		Dynamic dynamic =  composeNewDynamic( objectType, title, description, viewUrl, optType, parentTask, effectivePerson, false );
		dynamic.setTarget( parentTask.getExecutor() );		
		return dynamic;
	}
liyi_hz2008's avatar
liyi_hz2008 已提交
966 967 968 969 970 971 972 973 974 975 976

	public Dynamic getTaskTransformDynamic(Task parentTask, Task task, EffectivePerson effectivePerson) {
		String objectType =  "TASK";
		String title =  "转换为子工作";
		String viewUrl = task.getId();
		String optType =  "TRANSFORM";
		String description = effectivePerson.getName() +"将工作转换为工作[" +parentTask.getName() + "]的一个子任务。";
		Dynamic dynamic =  composeNewDynamic( objectType, title, description, viewUrl, optType, task, effectivePerson, false );
		dynamic.setTarget( task.getExecutor() );
		return dynamic;
	}
R
roo00 已提交
977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022
	
	public Dynamic subTaskDeleteDynamic(Task parentTask, Task task, EffectivePerson effectivePerson) {
		String objectType =  "TASK";
		String title =  "删除下级工作";
		String viewUrl = task.getId();
		String optType =  "DELETE_SUBTASK";
		String description = effectivePerson.getName() +"删除了一个子任务:" + task.getName();
		Dynamic dynamic =  composeNewDynamic( objectType, title, description, viewUrl, optType, parentTask, effectivePerson, false );
		dynamic.setTarget( parentTask.getExecutor() );
		return dynamic;
	}
	
//	/**
//	 * 更新任务标签信息操作动态
//	 * @param task
//	 * @param addTags
//	 * @param removeTags
//	 * @param effectivePerson
//	 * @return
//	 */
//	public List<Dynamic> getTaskTagsDynamic( Task object, List<String> addTags, List<String> removeTags, EffectivePerson effectivePerson ) {
//		String objectType =  "TASK";
//		String optType =  "UPDATE_TAGS";
//		String title =  "更新工作任务参与者信息";
//		List<Dynamic> dynamics = new ArrayList<>();
//		String viewUrl = null;
//		String description = null;
//		if( ListTools.isNotEmpty( addTags )) {
//			for( String tag : addTags ) {
//				optType =  "ADD_TAGS";
//				title =  "添加工作任务标签";
//				description = effectivePerson.getName() + "为工作" +object.getName() + "添加了标签:" + tag + "。";
//				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true ) );
//			}
//		}
//		if( ListTools.isNotEmpty( removeTags )) {
//			for( String tag : removeTags ) {
//				optType =  "REMOVE_TAGS";
//				title =  "删除工作任务标签";
//				description = effectivePerson.getName() + "从工作" +object.getName() + "的标签中删除了:" + tag + "。";
//				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true ) );
//			}
//		}		
//		return dynamics;
//	}
	
R
roo00 已提交
1023
	/**
R
roo00 已提交
1024 1025
	 * 创建工作任务标签信息操作动态
	 * @param object
R
roo00 已提交
1026 1027 1028
	 * @param effectivePerson
	 * @return
	 */
R
roo00 已提交
1029 1030 1031 1032 1033 1034 1035
	protected Dynamic getTagCreateDynamic( TaskTag object, EffectivePerson effectivePerson ) {
		String objectType =  "TAG";
		String optType =  "CREATE";
		String title =  "创建工作标签信息";
		String viewUrl = null;		
		String description = effectivePerson.getName() +"创建了工作任务标签信息:" + object.getTag();
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
R
roo00 已提交
1036 1037 1038 1039 1040 1041 1042 1043
	}
	
	/**
	 * 删除工作任务标签信息操作动态
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
R
roo00 已提交
1044 1045 1046 1047
	protected Dynamic getTagDeleteDynamic( TaskTag object, EffectivePerson effectivePerson ) {
		String objectType =  "TAG";
		String optType =  "DELETE";
		String title =  "工作标签信息删除";
R
roo00 已提交
1048 1049 1050 1051 1052 1053 1054
		String viewUrl = null;		
		String description = effectivePerson.getName() +"删除了工作任务标签信息:" + object.getTag();
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}
	
	/**
	 * 工作任务附件上传操作动态信息
liyi_hz2008's avatar
liyi_hz2008 已提交
1055
	 * @param object
R
roo00 已提交
1056 1057 1058 1059 1060
	 * @param effectivePerson
	 * @return
	 */
	public Dynamic getAttachmentUploadDynamic( Attachment object, EffectivePerson effectivePerson) {
		String objectType =  "ATTACHMENT";
R
roo00 已提交
1061
		String optType =  "UPLOAD";
R
roo00 已提交
1062 1063 1064 1065 1066 1067 1068 1069
		String viewUrl = null;
		String title =  "上传附件";
		String description = effectivePerson.getName() + "上传了附件:" + object.getName() ;
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}
	
	/**
	 * 工作任务附件下载操作动态信息
liyi_hz2008's avatar
liyi_hz2008 已提交
1070
	 * @param object
R
roo00 已提交
1071 1072 1073 1074 1075
	 * @param effectivePerson
	 * @return
	 */
	public Dynamic getAttachmentDownloadDynamic( Attachment object, EffectivePerson effectivePerson) {
		String objectType =  "ATTACHMENT";
R
roo00 已提交
1076
		String optType =  "DOWNLOAD";
R
roo00 已提交
1077 1078 1079 1080 1081 1082 1083 1084
		String viewUrl = null;
		String title =  "下载附件";
		String description = effectivePerson.getName() + "下载了附件:" + object.getName() ;
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}

	/**
	 * 工作任务附件删除操作动态信息
liyi_hz2008's avatar
liyi_hz2008 已提交
1085
	 * @param object
R
roo00 已提交
1086 1087 1088 1089 1090
	 * @param effectivePerson
	 * @return
	 */
	public Dynamic getAttachmentDeleteDynamic( Attachment object, EffectivePerson effectivePerson) {
		String objectType =  "ATTACHMENT";
R
roo00 已提交
1091
		String optType =  "DELETE";
R
roo00 已提交
1092 1093 1094 1095 1096 1097 1098 1099
		String viewUrl = null;
		String title =  "删除附件";
		String description = effectivePerson.getName() + "删除了附件:" + object.getName() ;
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}

	public Dynamic getChatPublishDynamic(Chat object, EffectivePerson effectivePerson) {
		String objectType =  "CHAT";
R
roo00 已提交
1100
		String optType =  "PUBLISH";
R
roo00 已提交
1101 1102
		String title =  "工作任务评论信息发布";
		String viewUrl = null;
R
roo00 已提交
1103
		String description = effectivePerson.getName() +"发表了工作任务评论信息。" ;
R
roo00 已提交
1104 1105 1106 1107 1108
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}

	public Dynamic getChatDeleteDynamic( Chat object, EffectivePerson effectivePerson) {
		String objectType =  "CHAT";
R
roo00 已提交
1109
		String optType =  "DELETE";
R
roo00 已提交
1110 1111
		String title =  "工作任务评论信息删除";
		String viewUrl = null;
R
roo00 已提交
1112
		String description = effectivePerson.getName() +"删除了工作任务评论信息。" ;
R
roo00 已提交
1113 1114
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}
R
roo00 已提交
1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132

	public Dynamic getAddTaskTagReleDynamic(Task task, TaskTag taskTag, EffectivePerson effectivePerson) {
		String objectType =  "TASK_TAG";
		String optType =  "ADD";
		String title =  "工作任务添加标签";
		String viewUrl = null;
		String description = effectivePerson.getName() +"为工作任务添加了标签:" + taskTag.getTag() ;
		return composeNewDynamic( objectType, title, description, viewUrl, optType, task, effectivePerson, false );
	}
	
	public Dynamic geRemoveTaskTagReleDynamic(Task task, TaskTag taskTag, EffectivePerson effectivePerson) {
		String objectType =  "TASK_TAG";
		String optType =  "REMOVE";
		String title =  "工作任务移除标签";
		String viewUrl = null;
		String description = effectivePerson.getName() +"为工作任务移除了标签:" + taskTag.getTag() ;
		return composeNewDynamic( objectType, title, description, viewUrl, optType, task, effectivePerson, false );
	}
R
roo00 已提交
1133
}