提交 004f6ed2 编写于 作者: liyi_hz2008's avatar liyi_hz2008

[内容管理]修复了发布文档时会通知所有人员的问题

上级 b12f3f24
......@@ -177,8 +177,9 @@ public class ActionPersistPublishContent extends BaseAction {
if (check) {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
if ( StringUtils.isEmpty( wi.getIdentity())) {
if ( StringUtils.isNotEmpty( wi.getIdentity())) {
wi.setCreatorIdentity( wi.getIdentity() );
wi.setCreatorPerson( userManagerService.getPersonNameWithIdentity(wi.getIdentity()));
}
if ( StringUtils.isEmpty( wi.getCreatorPerson())) {
......@@ -404,7 +405,7 @@ public class ActionPersistPublishContent extends BaseAction {
}
}
if( notify ){
logger.info("try to add notify object to queue for document:" + document.getTitle() );
logger.debug("try to add notify object to queue for document:" + document.getTitle() );
ThisApplication.queueSendDocumentNotify.send( document );
}
} catch (Exception e) {
......
......@@ -28,18 +28,19 @@ import java.util.List;
public class QueueSendDocumentNotify extends AbstractQueue<Document> {
private static Logger logger = LoggerFactory.getLogger( QueueSendDocumentNotify.class );
private UserManagerService userManagerService = new UserManagerService();
public void execute( Document document ) throws Exception {
logger.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>QueueSendDocumentNotify:" + document.getTitle() );
logger.debug(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>QueueSendDocumentNotify:" + document.getTitle() );
if( document == null ) {
logger.info("can not send publish notify , document is NULL!" );
logger.debug("can not send publish notify , document is NULL!" );
return;
}
if( !StringUtils.equalsIgnoreCase( "信息" , document.getDocumentType()) ) {
logger.info("can not send publish notify , document is not '信息'!" );
logger.debug("can not send publish notify , document is not '信息'!" );
return;
}
logger.info("send publish notify for new document:" + document.getTitle() );
logger.debug("send publish notify for new document:" + document.getTitle() );
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
AppInfo appInfo = emc.find( document.getAppId(), AppInfo.class );
CategoryInfo category = emc.find( document.getCategoryId(), CategoryInfo.class );
......@@ -50,9 +51,24 @@ public class QueueSendDocumentNotify extends AbstractQueue<Document> {
if( ListTools.isNotEmpty( persons )) {
//有可能是*, 一般是所有的人员标识列表
if( persons.contains( "*" )) {
logger.info(">>>>>document.getCreatorTopUnitName()=" + document.getCreatorTopUnitName() );
persons = listPersonWithUnit( document.getCreatorTopUnitName() );
String topUnitName = document.getCreatorTopUnitName();
logger.debug(">>>>>document.getCreatorTopUnitName()=" + topUnitName );
if( StringUtils.equalsAnyIgnoreCase("cipher",topUnitName ) || StringUtils.equalsAnyIgnoreCase("xadmin", topUnitName) ){
//取发起人所有顶层组织
if( !StringUtils.equalsAnyIgnoreCase("cipher",document.getCreatorIdentity() ) &&
!StringUtils.equalsAnyIgnoreCase("xadmin",document.getCreatorIdentity() )){
topUnitName = userManagerService.getTopUnitNameByIdentity(document.getCreatorIdentity());
}else if(!StringUtils.equalsAnyIgnoreCase("cipher",document.getCreatorPerson() ) &&
!StringUtils.equalsAnyIgnoreCase("xadmin",document.getCreatorPerson() )){
topUnitName = userManagerService.getTopUnitNameWithPerson(document.getCreatorPerson());
}
}
if( StringUtils.isNotEmpty( topUnitName )){
//取顶层组织的所有人
persons = listPersonWithUnit( topUnitName );
}else{
persons = new ArrayList<>();
}
}
}
if( ListTools.isNotEmpty( persons )) {
......@@ -69,10 +85,10 @@ public class QueueSendDocumentNotify extends AbstractQueue<Document> {
}
logger.debug("cms send total count:" + persons.size() );
}
logger.info("cms send publish notify for new document completed! " );
logger.debug("cms send publish notify for new document completed! " );
//}
}else{
logger.info("can not send publish notify for document, category or appinfo not exists! ID: " + document.getId() );
logger.debug("can not send publish notify for document, category or appinfo not exists! ID: " + document.getId() );
}
}
}
......
......@@ -454,7 +454,7 @@ public class UserManagerService {
* @throws Exception
*/
public List<String> listPersonWithUnit(String unitName) throws Exception {
if (StringUtils.isEmpty(unitName)) {
if (StringUtils.isEmpty( unitName )) {
throw new Exception("unitName is empty!");
}
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册