DynamicService.java 42.5 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 22 23
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;
import com.x.teamwork.core.entity.ProjectExtFieldRele;
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 278 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
	/**
	 * 根据参数组织一个新的ProjectExtFieldRele操作动态信息
	 * @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, ProjectExtFieldRele object,  EffectivePerson effectivePerson, Boolean personal ) {
		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 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441
		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() );
		dynamic.setProjectTitle( "" );
		dynamic.setTaskId( object.getTaskId()  );
		dynamic.setTaskTitle( "" );
		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 501 502 503 504 505 506 507 508 509
		String description = effectivePerson.getName() +"删除了项目信息:" + object.getTitle();
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}
	
	/**
	 * 保存和根据项目组信息操作动态
	 * @param object_old
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected Dynamic getProjectGroupSaveDynamic( ProjectGroup object_old, ProjectGroup object, EffectivePerson effectivePerson ) {
		String objectType =  "PROJECT_GROUP";
R
roo00 已提交
510
		String optType =  "UPDATE_PROJECT_GROUP";
R
roo00 已提交
511 512 513 514 515 516
		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 已提交
517
				optType = "UPDATE_NAME";
R
roo00 已提交
518 519 520 521 522
				description = effectivePerson.getName() + "变更了项目组名称为:" + object.getName();
				return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true );
			}
		}else {
			title =  "添加项目组信息";
R
roo00 已提交
523
			optType = "CREATE";
R
roo00 已提交
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
			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 已提交
540
		String optType =  "DELETE";
R
roo00 已提交
541 542 543 544
		String description = effectivePerson.getName() +"删除了项目组信息:" + object.getName();
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true );
	}
	
L
luojing 已提交
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559
	/**
	 * 组织一个项目模板删除操作动态
	 * @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 已提交
560 561 562 563 564 565 566 567 568
	/**
	 * 组织项目扩展信息配置保存操作动态
	 * @param object_old
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected Dynamic getProjectSaveExtFieldReleDynamic( ProjectExtFieldRele object_old, ProjectExtFieldRele object, EffectivePerson effectivePerson ) {
		String objectType =  "PROJECT_EXTFIELD_RELE";
R
roo00 已提交
569
		String optType =  "UPDATE_EXTFIELD_RELE";
R
roo00 已提交
570 571 572 573 574 575
		String title =  "保存项目扩展属性";
		String viewUrl = null;
		String description = null;
		if( object_old != null ) {
			if( !object_old.getDisplayName().equalsIgnoreCase( object.getDisplayName() )) { //变更了显示名称
				title =  "变更项目扩展属性显示名称";
R
roo00 已提交
576
				optType = "UPDATE_DISPLAYNAME";
R
roo00 已提交
577 578 579 580 581
				description = effectivePerson.getName() + "变更了项目扩展属性"+object.getExtFieldName()+"的显示名称为:" + object.getDisplayName();
				return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
			}
		}else {
			title =  "添加项目扩展属性信息";
R
roo00 已提交
582
			optType = "CREATE";
R
roo00 已提交
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598
			description = effectivePerson.getName() + "添加了新的项目扩展属性:" + object.getDisplayName() + "("+object.getExtFieldName()+")。";
			return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
		}
		return null;
	}
	
	/**
	 * 组织项目扩展信息配置删除操作动态
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
	protected Dynamic getProjectDeleteExtFieldReleDynamic( ProjectExtFieldRele object, EffectivePerson effectivePerson ) {
		String objectType =  "PROJECT_EXTFIELD_RELE";
		String title =  "项目扩展属性信息删除";
		String viewUrl = null;
R
roo00 已提交
599
		String optType =  "DELETE";
R
roo00 已提交
600 601 602 603
		String description = effectivePerson.getName() +"删除了项目扩展属性:" + object.getDisplayName() + "("+object.getExtFieldName()+")。";
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}
	
L
luojing 已提交
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644
	/**
	 * 保存项目模板创建或者更新动态信息
	 * @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 已提交
645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661
	/**
	 * 组织项目工作任务列表保存操作动态
	 * @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 已提交
662
				optType = "UPDATE_NAME";
R
roo00 已提交
663 664 665 666 667
				description = effectivePerson.getName() + "变更了工作任务列表名称为:"+object.getName();
				return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, true );
			}
		}else {
			title =  "添加工作任务列表信息";
R
roo00 已提交
668
			optType = "CREATE";
R
roo00 已提交
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684
			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 已提交
685
		String optType =  "DELETE";
R
roo00 已提交
686 687 688 689 690 691 692 693 694 695 696 697 698 699
		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 已提交
700
		String optType =  "DELETE";
R
roo00 已提交
701 702 703 704 705 706 707 708 709 710
		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 已提交
711 712
	 * @param newDetail 
	 * @param oldDetail 
R
roo00 已提交
713 714 715 716
	 * @param effectivePerson
	 * @return
	 * @throws Exception
	 */
R
roo00 已提交
717
	protected List<Dynamic> getTaskDynamic( Task object_old, Task object,  TaskDetail oldDetail, TaskDetail newDetail, EffectivePerson effectivePerson ) throws Exception {
R
roo00 已提交
718 719 720 721 722 723
		String objectType =  "TASK";
		String optType =  "TASK_INFO";
		String title =  "保存工作任务信息";
		List<Dynamic> dynamics = new ArrayList<>();
		String viewUrl = null;
		String description = null;
R
roo00 已提交
724
		
R
roo00 已提交
725 726
		if( object_old != null ) {
			if( !object_old.getName().equalsIgnoreCase( object.getName() )) {
R
roo00 已提交
727
				optType =  "UPDATE_NAME";
R
roo00 已提交
728 729 730 731 732
				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 已提交
733
				optType =  "UPDATE_EXECUTOR";
R
roo00 已提交
734 735 736 737 738
				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 已提交
739
				optType =  "UPDATE_STATUS";
R
roo00 已提交
740 741 742 743 744 745
				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 已提交
746
				optType =  "UPDATE_TIME";
R
roo00 已提交
747 748 749 750 751 752 753
				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 已提交
754
				optType =  "UPDATE_PROGRESS";
R
roo00 已提交
755 756 757 758
				title =  "工作任务进度变更";
				description = effectivePerson.getName() + "变更了任务信息的工作进度为:" + object.getProgress() + "。";
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
			}
R
roo00 已提交
759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782
			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 已提交
783
		}else {
R
roo00 已提交
784
			optType =  "CREATE";
R
roo00 已提交
785 786 787 788 789 790 791
			title =  "工作任务信息新增";
			description = effectivePerson.getName() + "新增了新的任务信息:" + object.getName() + "。";
			dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
		}
		return dynamics;
	}
	
R
roo00 已提交
792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810
	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 已提交
811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836

	/**
	 * 复制任务信息操作动态
	 * @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 已提交
837 838
	/**
	 * 更新工作任务管理者信息操作动态
liyi_hz2008's avatar
liyi_hz2008 已提交
839
	 * @param object
R
roo00 已提交
840 841 842 843 844 845 846
	 * @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 已提交
847
		String optType =  "UPDATE_MANAGER";
R
roo00 已提交
848 849 850 851 852 853
		String title =  "更新工作任务管理者信息";
		List<Dynamic> dynamics = new ArrayList<>();
		String viewUrl = null;
		String description = null;
		if( ListTools.isNotEmpty( addManagers )) {
			for( String manager : addManagers ) {
R
roo00 已提交
854
				optType =  "ADD_MANAGER";
R
roo00 已提交
855 856 857 858 859 860 861
				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 已提交
862
				optType =  "REMOVE_MANAGER";
R
roo00 已提交
863 864 865 866 867 868 869 870 871 872
				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 已提交
873
	 * @param object
R
roo00 已提交
874 875 876 877 878 879 880
	 * @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 已提交
881
		String optType =  "UPDATE_PARTICIPANTS";
R
roo00 已提交
882 883 884 885 886 887
		String title =  "更新工作任务参与者信息";
		List<Dynamic> dynamics = new ArrayList<>();
		String viewUrl = null;
		String description = null;
		if( ListTools.isNotEmpty( addParticipants )) {
			for( String participant : addParticipants ) {
R
roo00 已提交
888
				optType =  "ADD_PARTICIPANTS";
R
roo00 已提交
889 890 891 892 893 894 895
				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 已提交
896
				optType =  "REMOVE_PARTICIPANTS";
R
roo00 已提交
897 898 899 900 901 902 903 904
				title =  "删除工作任务参与者";
				description = effectivePerson.getName() + "从工作" +object.getName() + "的参与者中删除了:" + participant.split("@")[0] + "。";
				dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false ) );
			}
		}
		return dynamics;
	}
	
R
roo00 已提交
905 906 907 908 909
	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 已提交
910
		String description = effectivePerson.getName() +"为工作添加了一个子任务:[" + task.getName() + "]";
R
roo00 已提交
911 912 913 914
		Dynamic dynamic =  composeNewDynamic( objectType, title, description, viewUrl, optType, parentTask, effectivePerson, false );
		dynamic.setTarget( parentTask.getExecutor() );		
		return dynamic;
	}
liyi_hz2008's avatar
liyi_hz2008 已提交
915 916 917 918 919 920 921 922 923 924 925

	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 已提交
926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971
	
	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 已提交
972
	/**
R
roo00 已提交
973 974
	 * 创建工作任务标签信息操作动态
	 * @param object
R
roo00 已提交
975 976 977
	 * @param effectivePerson
	 * @return
	 */
R
roo00 已提交
978 979 980 981 982 983 984
	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 已提交
985 986 987 988 989 990 991 992
	}
	
	/**
	 * 删除工作任务标签信息操作动态
	 * @param object
	 * @param effectivePerson
	 * @return
	 */
R
roo00 已提交
993 994 995 996
	protected Dynamic getTagDeleteDynamic( TaskTag object, EffectivePerson effectivePerson ) {
		String objectType =  "TAG";
		String optType =  "DELETE";
		String title =  "工作标签信息删除";
R
roo00 已提交
997 998 999 1000 1001 1002 1003
		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 已提交
1004
	 * @param object
R
roo00 已提交
1005 1006 1007 1008 1009
	 * @param effectivePerson
	 * @return
	 */
	public Dynamic getAttachmentUploadDynamic( Attachment object, EffectivePerson effectivePerson) {
		String objectType =  "ATTACHMENT";
R
roo00 已提交
1010
		String optType =  "UPLOAD";
R
roo00 已提交
1011 1012 1013 1014 1015 1016 1017 1018
		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 已提交
1019
	 * @param object
R
roo00 已提交
1020 1021 1022 1023 1024
	 * @param effectivePerson
	 * @return
	 */
	public Dynamic getAttachmentDownloadDynamic( Attachment object, EffectivePerson effectivePerson) {
		String objectType =  "ATTACHMENT";
R
roo00 已提交
1025
		String optType =  "DOWNLOAD";
R
roo00 已提交
1026 1027 1028 1029 1030 1031 1032 1033
		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 已提交
1034
	 * @param object
R
roo00 已提交
1035 1036 1037 1038 1039
	 * @param effectivePerson
	 * @return
	 */
	public Dynamic getAttachmentDeleteDynamic( Attachment object, EffectivePerson effectivePerson) {
		String objectType =  "ATTACHMENT";
R
roo00 已提交
1040
		String optType =  "DELETE";
R
roo00 已提交
1041 1042 1043 1044 1045 1046 1047 1048
		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 已提交
1049
		String optType =  "PUBLISH";
R
roo00 已提交
1050 1051
		String title =  "工作任务评论信息发布";
		String viewUrl = null;
R
roo00 已提交
1052
		String description = effectivePerson.getName() +"发表了工作任务评论信息。" ;
R
roo00 已提交
1053 1054 1055 1056 1057
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}

	public Dynamic getChatDeleteDynamic( Chat object, EffectivePerson effectivePerson) {
		String objectType =  "CHAT";
R
roo00 已提交
1058
		String optType =  "DELETE";
R
roo00 已提交
1059 1060
		String title =  "工作任务评论信息删除";
		String viewUrl = null;
R
roo00 已提交
1061
		String description = effectivePerson.getName() +"删除了工作任务评论信息。" ;
R
roo00 已提交
1062 1063
		return composeNewDynamic( objectType, title, description, viewUrl, optType, object, effectivePerson, false );
	}
R
roo00 已提交
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081

	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 已提交
1082
}