|
@@ -5,48 +5,55 @@
|
|
|
|
|
|
package com.minto.app.task.manager;
|
|
|
|
|
|
+import java.io.InputStream;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
+import java.sql.SQLException;
|
|
|
+import java.text.DecimalFormat;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.*;
|
|
|
+import java.util.Map.Entry;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
+
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import com.google.common.collect.Sets;
|
|
|
-import com.minto.app.collaboration.beans.ColSummaryBean;
|
|
|
-import com.minto.app.collaboration.enums.ColEnum;
|
|
|
-import com.minto.app.content.util.CommonContentBeanCopier;
|
|
|
-import com.minto.app.message.util.SmsHolder;
|
|
|
-import com.minto.app.resource.util.CommonRelationBeanCopier;
|
|
|
-import com.minto.app.space.beans.AttachmentBean;
|
|
|
-import com.minto.app.space.manager.AttachmentManager;
|
|
|
-import com.minto.app.task.dto.*;
|
|
|
-import com.minto.app.systemstate.SystemConstants;
|
|
|
-import com.minto.app.task.enums.*;
|
|
|
-import com.minto.app.task.po.TaskDeliverables;
|
|
|
-import com.minto.app.task.util.mapper.TaskDtoMapper;
|
|
|
-import com.minto.tap.project.api.ProjectApi;
|
|
|
-import com.minto.bff.home.dto.GenericParam;
|
|
|
-import com.minto.tap.task.dto.TaskSummaryInfo;
|
|
|
-import com.minto.tip.affair.po.TipAffair;
|
|
|
import com.minto.app.behavior.beans.BehSummaryBean;
|
|
|
import com.minto.app.behavior.dto.BehaviorParam;
|
|
|
import com.minto.app.behavior.enums.BehaviorEnum;
|
|
|
import com.minto.app.behavior.enums.BehaviorEnum.BehSummaryBehTypeEnum;
|
|
|
import com.minto.app.behavior.manager.IBehManager;
|
|
|
+import com.minto.app.collaboration.beans.ColSummaryBean;
|
|
|
+import com.minto.app.collaboration.enums.ColEnum;
|
|
|
import com.minto.app.content.beans.CommonContentBean;
|
|
|
import com.minto.app.content.bo.CommonContentBO;
|
|
|
import com.minto.app.content.enums.ContentEnum;
|
|
|
import com.minto.app.content.event.ContentModifyEvent;
|
|
|
import com.minto.app.content.manager.IContentManager;
|
|
|
-import com.minto.app.dm.beans.*;
|
|
|
+import com.minto.app.content.util.CommonContentBeanCopier;
|
|
|
+import com.minto.app.dm.beans.DmResourceRelationBean;
|
|
|
+import com.minto.app.dm.beans.MatrixLabelBean;
|
|
|
+import com.minto.app.dm.beans.MatrixLabelRelBean;
|
|
|
+import com.minto.app.dm.beans.MatrixTableColumnDefinition;
|
|
|
import com.minto.app.dm.enums.DMEnum;
|
|
|
import com.minto.app.dm.enums.MatrixEnum;
|
|
|
import com.minto.app.dm.manager.IDataManager;
|
|
|
import com.minto.app.dm.manager.IDmManager;
|
|
|
import com.minto.app.dm.manager.IMatrixManager;
|
|
|
import com.minto.app.dm.manager.MatrixTableService;
|
|
|
-import com.minto.core.ds.DBAgent;
|
|
|
import com.minto.app.index.manager.IndexManager;
|
|
|
import com.minto.app.mail.Email;
|
|
|
import com.minto.app.mail.manager.IMailManager;
|
|
|
+import com.minto.app.menu.beans.MenuInfoBean;
|
|
|
+import com.minto.app.menu.enums.MenuEnum.MenuSource;
|
|
|
+import com.minto.app.menu.manager.IMenuManager;
|
|
|
import com.minto.app.message.beans.MessageBean;
|
|
|
import com.minto.app.message.beans.MessageConfigBean;
|
|
|
import com.minto.app.message.beans.MessageTypeBean;
|
|
@@ -54,6 +61,7 @@ import com.minto.app.message.enums.MessageEnum;
|
|
|
import com.minto.app.message.enums.MessageEnum.MessageTypeEnum;
|
|
|
import com.minto.app.message.enums.MessageResourceTypeEnum;
|
|
|
import com.minto.app.message.manager.MessageService;
|
|
|
+import com.minto.app.message.util.SmsHolder;
|
|
|
import com.minto.app.organization.OrgConstants;
|
|
|
import com.minto.app.organization.OrgEnum.OrgRelationCategoryEnum;
|
|
|
import com.minto.app.organization.OrgEnum.OrgStateEnum;
|
|
@@ -61,6 +69,7 @@ import com.minto.app.organization.beans.*;
|
|
|
import com.minto.app.organization.bo.OrgPersonBO;
|
|
|
import com.minto.app.organization.manager.IOrgManager;
|
|
|
import com.minto.app.organization.util.OrgUtil;
|
|
|
+import com.minto.app.project.enums.ProjectEnum;
|
|
|
import com.minto.app.resource.beans.CommonResourceRelationBean;
|
|
|
import com.minto.app.resource.bo.CommonResourceRelationBO;
|
|
|
import com.minto.app.resource.bo.IResource;
|
|
@@ -69,9 +78,15 @@ import com.minto.app.resource.enums.ResourceEnum;
|
|
|
import com.minto.app.resource.enums.ResourceEnum.ResourceRelationTypeEnum;
|
|
|
import com.minto.app.resource.enums.ResourceEnum.ResourceTypeEnum;
|
|
|
import com.minto.app.resource.manager.IResourceManager;
|
|
|
+import com.minto.app.resource.util.CommonRelationBeanCopier;
|
|
|
+import com.minto.app.space.beans.AttachmentBean;
|
|
|
+import com.minto.app.space.beans.SpaceFileBean;
|
|
|
+import com.minto.app.space.bo.SpaceFileBO;
|
|
|
+import com.minto.app.space.manager.AttachmentManager;
|
|
|
+import com.minto.app.space.manager.ISpaceManager;
|
|
|
+import com.minto.app.systemstate.SystemConstants;
|
|
|
import com.minto.app.systemstate.beans.SystemConfigBean;
|
|
|
import com.minto.app.systemstate.manager.ISystemStateManager;
|
|
|
-import com.minto.app.project.enums.ProjectEnum;
|
|
|
import com.minto.app.task.TaskConstants;
|
|
|
import com.minto.app.task.beans.*;
|
|
|
import com.minto.app.task.bo.TaskBO;
|
|
@@ -79,41 +94,44 @@ import com.minto.app.task.bo.TaskPostscriptBO;
|
|
|
import com.minto.app.task.bo.TaskProcessBO;
|
|
|
import com.minto.app.task.bo.TaskReportBO;
|
|
|
import com.minto.app.task.dao.*;
|
|
|
+import com.minto.app.task.dto.*;
|
|
|
+import com.minto.app.task.enums.*;
|
|
|
import com.minto.app.task.enums.TaskEnum.*;
|
|
|
import com.minto.app.task.event.TaskStateEvent;
|
|
|
import com.minto.app.task.mapper.ITaskAnalysisMapper;
|
|
|
import com.minto.app.task.mapper.ITaskInfoMapper;
|
|
|
import com.minto.app.task.mapper.ITaskSummaryMapper;
|
|
|
+import com.minto.app.task.po.TaskDeliverables;
|
|
|
import com.minto.app.task.sms.SendSMSUtil;
|
|
|
import com.minto.app.task.sms.SmsEnum;
|
|
|
import com.minto.app.task.sms.SmsSendBO;
|
|
|
import com.minto.app.task.util.*;
|
|
|
+import com.minto.app.task.util.mapper.TaskDtoMapper;
|
|
|
import com.minto.app.task.vo.*;
|
|
|
-import com.minto.tip.affair.enums.AffairEnum;
|
|
|
-import com.minto.tip.affair.manager.AffairManager;
|
|
|
import com.minto.app.tc.knowledge.enums.KmEnum;
|
|
|
-import com.minto.app.menu.beans.MenuInfoBean;
|
|
|
-import com.minto.app.menu.enums.MenuEnum.MenuSource;
|
|
|
-import com.minto.app.menu.manager.IMenuManager;
|
|
|
-import com.minto.app.space.bo.SpaceFileBO;
|
|
|
-import com.minto.app.space.beans.SpaceFileBean;
|
|
|
-import com.minto.app.space.manager.ISpaceManager;
|
|
|
import com.minto.app.tipenum.po.TipEnumBean;
|
|
|
-
|
|
|
+import com.minto.bff.home.dto.GenericParam;
|
|
|
import com.minto.core.base.BaseEnum;
|
|
|
import com.minto.core.base.BaseEnum.OrgEnum;
|
|
|
import com.minto.core.base.ListObject;
|
|
|
import com.minto.core.common.AppContext;
|
|
|
import com.minto.core.constants.BaseConstants;
|
|
|
-import com.minto.tip.common.util.BusinessAssert;
|
|
|
-import com.minto.tip.common.util.annotation.PreviewSubmit;
|
|
|
-import com.minto.tip.event.EventDispatcher;
|
|
|
+import com.minto.core.ds.DBAgent;
|
|
|
import com.minto.core.event.SystemFrameWorkEvent;
|
|
|
import com.minto.core.relationtree.RelationTree;
|
|
|
import com.minto.core.util.*;
|
|
|
+import com.minto.tap.project.api.ProjectApi;
|
|
|
+import com.minto.tap.task.dto.TaskSummaryInfo;
|
|
|
+import com.minto.tip.affair.enums.AffairEnum;
|
|
|
+import com.minto.tip.affair.manager.AffairManager;
|
|
|
+import com.minto.tip.affair.po.TipAffair;
|
|
|
import com.minto.tip.common.authenticate.bo.User;
|
|
|
import com.minto.tip.common.exceptions.BusinessException;
|
|
|
+import com.minto.tip.common.util.BusinessAssert;
|
|
|
import com.minto.tip.common.util.ValidatorUtil;
|
|
|
+import com.minto.tip.common.util.annotation.PreviewSubmit;
|
|
|
+import com.minto.tip.common.util.annotation.Transactional;
|
|
|
+import com.minto.tip.event.EventDispatcher;
|
|
|
import lombok.SneakyThrows;
|
|
|
import org.apache.commons.lang.ArrayUtils;
|
|
|
import org.apache.commons.lang.ObjectUtils;
|
|
@@ -129,25 +147,9 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.event.EventListener;
|
|
|
-import com.minto.tip.common.util.annotation.Transactional;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
-import java.io.InputStream;
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.math.RoundingMode;
|
|
|
-import java.sql.SQLException;
|
|
|
-import java.text.DecimalFormat;
|
|
|
-import java.text.ParseException;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.time.LocalDateTime;
|
|
|
-import java.util.*;
|
|
|
-import java.util.Map.Entry;
|
|
|
-import java.util.regex.Matcher;
|
|
|
-import java.util.regex.Pattern;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
-
|
|
|
import static com.minto.core.util.DateUtil.FORMAT_DATE_TIME4;
|
|
|
|
|
|
@Service("ITaskManager")
|
|
@@ -271,6 +273,8 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
private AttachmentManager attachmentManager;
|
|
|
@Autowired
|
|
|
private TaskDeliverablesService taskDeliverablesService;
|
|
|
+ @Autowired
|
|
|
+ private ITaskProcessVisibilityDao taskProcessVisibilityDao;
|
|
|
|
|
|
|
|
|
Map<Long, TaskSummaryTemporaryBean> taskTree = new LinkedHashMap<Long, TaskSummaryTemporaryBean>();
|
|
@@ -863,27 +867,21 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
try {
|
|
|
if (processBO != null) {
|
|
|
TaskProcessSummaryBean process = processBO.getProcessBean();
|
|
|
+ Long cid = process.getOrgCorporationId();
|
|
|
List<TaskProcessSummaryBean> processs = new ArrayList<TaskProcessSummaryBean>();
|
|
|
processs.add(process);
|
|
|
taskProcessSummaryDao.addTaskProcess(processs);
|
|
|
TaskSummaryBean taskSummaryBean = findTaskSummaryBeanById(process.getTaskId());
|
|
|
- Long cid = process.getOrgCorporationId();
|
|
|
+ String title = taskSummaryBean.getTitle();
|
|
|
// 文件二段保存
|
|
|
List<CommonResourceRelationBean> relationBeans = processBO.getResourceRelBeans();
|
|
|
// 行为
|
|
|
OrgPersonBean per = orgManager.findPersonByIdNoClone(process.getPersonId());
|
|
|
String pname = per.getPname();
|
|
|
- String dname = "";
|
|
|
- OrgUnitBean departmentBean = orgManager.findDepartmentByPersonId(cid,per.getId());
|
|
|
- if(departmentBean!=null){
|
|
|
- dname = departmentBean.getDname();
|
|
|
- }
|
|
|
- String title = taskSummaryBean.getTitle();
|
|
|
// 是留言还是回复
|
|
|
BehSummaryBehTypeEnum behEnum = null;
|
|
|
- boolean isAddRelBeh = false;
|
|
|
String message = null;
|
|
|
- OrgPersonBean parPer = new OrgPersonBean();
|
|
|
+ OrgPersonBean parPer = getParentPersonByProcess(process, per);
|
|
|
StringBuilder relationIds = new StringBuilder();//单位id集合字符串
|
|
|
|
|
|
//TODO 查出事项的承办单位和协办单位
|
|
@@ -901,22 +899,6 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
relationIds.append(id);
|
|
|
});
|
|
|
|
|
|
- // 回复行为
|
|
|
- if (null != process.getParentType() && TaskProcessParentTypeEnum.Beh.getKey()==process.getParentType()) { //这个地方要报错,目前这个样修改下吧
|
|
|
- BehSummaryBean behSummary = behManager.findBehById(process.getParentId());
|
|
|
- if (behSummary != null) {
|
|
|
- parPer = orgManager.findPersonByIdNoClone(behSummary.getBelongToResId());
|
|
|
- }
|
|
|
- } else {
|
|
|
- TaskProcessSummaryBean parProcess = taskProcessSummaryDao.findTaskProcessById(process.getParentId());
|
|
|
- if (parProcess != null) {
|
|
|
- parPer = orgManager.findPersonByIdNoClone(parProcess.getPersonId());
|
|
|
- if(Objects.equals(per.getId(), parPer.getId()) && process.getShakePersonId() != 0){
|
|
|
- parPer = orgManager.findPersonById(process.getShakePersonId());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
String[] params;
|
|
|
if (process.getParentId().equals(0L)) {
|
|
|
// 附言还是留言
|
|
@@ -934,6 +916,10 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
}
|
|
|
params = new String[] { title, TaskSummaryTcategoryEnum.findEnumByKey(taskSummaryBean.getTcategory()).getDes(), process.getOpinion(),message,process.getProcessResourceId()==null?null:process.getProcessResourceId().toString() };
|
|
|
}
|
|
|
+ //如果是不发布的批示数据,类型改成可限制显示范围的领导批示
|
|
|
+ if(BaseEnum.BooleanEnum.False.getKey() == process.getIsPublished()){
|
|
|
+ behEnum = BehSummaryBehTypeEnum.InstructionsTaskLimitScope;
|
|
|
+ }
|
|
|
// todo 添加上任务类型判定,给行为类型分类
|
|
|
String taskTypeId = taskSummaryBean.getTaskTypeId();
|
|
|
TaskTypeBean taskTypeBean = taskListManager.findTaskTypeById(Long.parseLong(taskTypeId));
|
|
@@ -989,7 +975,6 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
// 创建人添加一条关联
|
|
|
this.taskProcessRelationDao.addTaskProcessRelation(beans);
|
|
|
}
|
|
|
- isAddRelBeh = true;
|
|
|
params = new String[] { title, TaskSummaryTcategoryEnum.findEnumByKey(taskSummaryBean.getTcategory()).getDes(), process.getOpinion(), parPer.getPname() };
|
|
|
behManager.addBehavior4SubType(
|
|
|
cid, behEnum, process.getPersonId(),
|
|
@@ -1000,189 +985,268 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
params
|
|
|
);
|
|
|
}
|
|
|
+ //可限制显示范围的领导批示,不发送提醒
|
|
|
+ if(BaseEnum.BooleanEnum.False.getKey() == process.getIsPublished()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
//如果是任务催办,会在催办中发送提示,则不再发送留言提示信息
|
|
|
//对发布的留言的进行回复时,如果留言人和回复人是同一个人则不发送提醒
|
|
|
if (AppContext.currentUserId()!=null&&(processBO.getRemindMsg() || AppContext.currentUserId().equals(parPer.getId()))) {
|
|
|
return ;
|
|
|
}
|
|
|
- // 查询扩展角色 Modifier: <Zhengyu.Hu> 2018/8/21 下午2:19 end.
|
|
|
- List<Integer> extendRoles = TaskRoleUtil.getRoleCodes(TaskRoleWrapper.of(taskAppManager.findTaskRoles()).requireMessage().get());
|
|
|
- // 保存事项留言,包含必须的行为参数:belongTo:留言人的id,res:事项资源,类型为枚举ResourceTypeEnum.Task
|
|
|
- // ,id为当前事项的id , ext1:留言的id , ext2:不启用, ext3:不启用
|
|
|
- // 添加关联行为
|
|
|
- // 消息
|
|
|
- List<TaskMemberBean> mems = findTaskMembersByTaskId(taskSummaryBean.getId());
|
|
|
- if(CollectionUtil.isNotEmpty(mems)){
|
|
|
- mems = mems.stream().filter(m-> !Objects.equals(m.getMstate(), TaskMemberStateEnum.Deleted.getKey())).collect(Collectors.toList());
|
|
|
+ sendTaskMessageByProcess(taskSummaryBean, process, behEnum, parPer, per, message, null);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getLocalizedMessage(), e);
|
|
|
+ throw new BusinessException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private OrgPersonBean getParentPersonByProcess(TaskProcessSummaryBean process, OrgPersonBean per){
|
|
|
+ OrgPersonBean parPer = new OrgPersonBean();
|
|
|
+ // 回复行为
|
|
|
+ if (null != process.getParentType() && TaskProcessParentTypeEnum.Beh.getKey()== process.getParentType()) { //这个地方要报错,目前这个样修改下吧
|
|
|
+ BehSummaryBean behSummary = behManager.findBehById(process.getParentId());
|
|
|
+ if (behSummary != null) {
|
|
|
+ parPer = orgManager.findPersonByIdNoClone(behSummary.getBelongToResId());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ TaskProcessSummaryBean parProcess = taskProcessSummaryDao.findTaskProcessById(process.getParentId());
|
|
|
+ if (parProcess != null) {
|
|
|
+ parPer = orgManager.findPersonByIdNoClone(parProcess.getPersonId());
|
|
|
+ if(Objects.equals(per.getId(), parPer.getId()) && process.getShakePersonId() != 0){
|
|
|
+ parPer = orgManager.findPersonById(process.getShakePersonId());
|
|
|
}
|
|
|
- String tcategoryDes = TaskSummaryTcategoryEnum.findEnumByKey(taskSummaryBean.getTcategory()).getDes();
|
|
|
- if (!OrgEnum.Tw.getKey().equals(cid)) {
|
|
|
- if (isAddRelBeh) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return parPer;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批示留言发送消息给指定人员
|
|
|
+ * @param taskSummaryBean
|
|
|
+ * @param process
|
|
|
+ * @param behEnum
|
|
|
+ * @param parPer
|
|
|
+ * @param per
|
|
|
+ * @param message
|
|
|
+ * @param pids 消息接收人的id集合
|
|
|
+ */
|
|
|
+ private void sendTaskMessageByProcess(TaskSummaryBean taskSummaryBean, TaskProcessSummaryBean process,
|
|
|
+ BehSummaryBehTypeEnum behEnum, OrgPersonBean parPer, OrgPersonBean per, String message, List<Long> pids){
|
|
|
+ //构建一系列的参数
|
|
|
+ Long cid = process.getOrgCorporationId();
|
|
|
+ if(per == null){
|
|
|
+ per = orgManager.findPersonByIdNoClone(process.getPersonId());
|
|
|
+ }
|
|
|
+ String pname = per.getPname();
|
|
|
+ OrgUnitBean departmentBean = orgManager.findDepartmentByPersonId(cid,per.getId());
|
|
|
+ String dname = departmentBean==null?"":departmentBean.getDname();
|
|
|
+ boolean isAddRelBeh = !process.getParentId().equals(0L);
|
|
|
+ String title = taskSummaryBean.getTitle();
|
|
|
+ if(parPer == null){
|
|
|
+ parPer = getParentPersonByProcess(process, per);
|
|
|
+ }
|
|
|
+ if(message == null){
|
|
|
+ message = "";
|
|
|
+ if(TaskEnum.TaskProcessTypeEnum.ManagerAdded.getKey() == process.getPtype()){
|
|
|
+ behEnum = BehSummaryBehTypeEnum.SetTaskPostscript;
|
|
|
+ message = "附言";
|
|
|
+ } else{
|
|
|
+ if(process.getPtype() == TaskEnum.TaskProcessTypeEnum.Instructions.getKey()){
|
|
|
+ message = "批示";
|
|
|
+ } else{
|
|
|
+ message = "留言";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 保存事项留言,包含必须的行为参数:belongTo:留言人的id,res:事项资源,类型为枚举ResourceTypeEnum.Task
|
|
|
+ // ,id为当前事项的id , ext1:留言的id , ext2:不启用, ext3:不启用
|
|
|
+ // 添加关联行为
|
|
|
+ // 消息
|
|
|
+ List<TaskMemberBean> mems = findTaskMembersByTaskId(taskSummaryBean.getId());
|
|
|
+ if(CollectionUtil.isNotEmpty(mems)){
|
|
|
+ mems = mems.stream().filter(m-> !Objects.equals(m.getMstate(), TaskMemberStateEnum.Deleted.getKey())).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ String tcategoryDes = TaskSummaryTcategoryEnum.findEnumByKey(taskSummaryBean.getTcategory()).getDes();
|
|
|
+ if (!OrgEnum.Tw.getKey().equals(cid)) {
|
|
|
+ if (isAddRelBeh) {
|
|
|
// behManager.addBehavior(cid, BehSummaryBehTypeEnum.SendMsgTaskRel, process.getPersonId(), ResourceTypeEnum.OrgPerson.getKey(), parPer.getId(), new Date(), process.getId(), "", "", title, pname, process.getOpinion(), parPer.getPname());
|
|
|
- List<TaskMemberBean> mems3 = new ArrayList<TaskMemberBean>();
|
|
|
- List<Long> receiverIds = new ArrayList<Long>();
|
|
|
-
|
|
|
- // 如果是事项
|
|
|
- if (TaskSummaryTcategoryEnum.Task.getKey() == taskSummaryBean.getTcategory().intValue()) {
|
|
|
- TaskMemberBean m = null;
|
|
|
- if (process.getPtype().equals(TaskProcessTypeEnum.ShakeAdded.getKey())) {
|
|
|
- m = TaskMemberUtil.getMemberBeanByPid(mems,process.getShakePersonId());
|
|
|
- } else {
|
|
|
- m = TaskMemberUtil.getMemberBeanByPid(mems,parPer.getId());
|
|
|
- }
|
|
|
- if (m != null) {
|
|
|
- Object o = TaskMemberUtil.getTaskManagerMember(m);
|
|
|
- if (o != null) {
|
|
|
- if (o instanceof List) {
|
|
|
- List<OrgPersonBean> personBeans = (List<OrgPersonBean>) o;
|
|
|
- for (OrgPersonBean personBean : personBeans) {
|
|
|
- if (personBean != null) {
|
|
|
- receiverIds.add(personBean.getId());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 如果是分享等
|
|
|
- // if
|
|
|
- // (process.getPtype().equals(TaskProcessTypeEnum.ShakeAdded.getKey()))
|
|
|
- // {
|
|
|
- // mems3.add(new TaskMemberBean(cid,
|
|
|
- // process.getTaskId(),
|
|
|
- // ResourceTypeEnum.OrgPerson.getKey(),
|
|
|
- // process.getShakePersonId(),
|
|
|
- // TaskMemberRelTypeEnum.Participant.getKey()));
|
|
|
- // } else {
|
|
|
- // mems3.add(new TaskMemberBean(cid,
|
|
|
- // process.getTaskId(),
|
|
|
- // ResourceTypeEnum.OrgPerson.getKey(),
|
|
|
- // parPer.getId(),
|
|
|
- // TaskMemberRelTypeEnum.Participant.getKey()));
|
|
|
- // }
|
|
|
- }
|
|
|
- if (CollectionUtil.isNotEmpty(receiverIds)) {
|
|
|
- String lastMsg = pname + "在" + tcategoryDes + "<" + title + ">对你的留言进行了回复" + ":" + process.getOpinion();
|
|
|
-
|
|
|
- //查询消息提醒设置是否设置了提示消息 留言/批示消息提醒
|
|
|
- Map<String, Object> param = new HashMap<>();
|
|
|
- param.put("name", pname);
|
|
|
- param.put("operObject", process.getOpinion());
|
|
|
- param.put("operContent", taskSummaryBean.getTitle());
|
|
|
- param.put("notifyType", SmsEnum.MessageNotifyType.LevMsgTask.getKey());
|
|
|
- param.put("messageType", SmsEnum.TaskMessageType.Task.getKey());
|
|
|
- param.put("taskTypeId", taskSummaryBean.getTaskTypeId());
|
|
|
- lastMsg = taskManager.buildMessageInfo(param, lastMsg);
|
|
|
-
|
|
|
- this.sendMessageByPersonIds(cid, process.getTaskId(), process.getPersonId(), receiverIds, lastMsg, taskSummaryBean.getTcategory(), MessageResourceTypeEnum.Comment.getKey());
|
|
|
- }
|
|
|
+ List<TaskMemberBean> mems3 = new ArrayList<TaskMemberBean>();
|
|
|
+ List<Long> receiverIds = new ArrayList<Long>();
|
|
|
+
|
|
|
+ // 如果是事项
|
|
|
+ if (TaskSummaryTcategoryEnum.Task.getKey() == taskSummaryBean.getTcategory().intValue()) {
|
|
|
+ TaskMemberBean m = null;
|
|
|
+ if (process.getPtype().equals(TaskProcessTypeEnum.ShakeAdded.getKey())) {
|
|
|
+ m = TaskMemberUtil.getMemberBeanByPid(mems, process.getShakePersonId());
|
|
|
} else {
|
|
|
- // 消息接收的人员
|
|
|
- Set<Long> setPids = new HashSet<Long>();
|
|
|
- for (TaskMemberBean t : mems) {
|
|
|
- if(TaskEnum.TaskMemberRelTypeEnum.isBaseRel(t.getRelationType())
|
|
|
- || extendRoles.contains(t.getRelationType())){
|
|
|
- Object o = TaskMemberUtil.getTaskManagerMember(t);
|
|
|
- if (o != null) {
|
|
|
- if (o instanceof List) {
|
|
|
- List<OrgPersonBean> orgPersonBeans = (List<OrgPersonBean>) o;
|
|
|
- for (OrgPersonBean orgPersonBean : orgPersonBeans) {
|
|
|
- if(orgPersonBean == null) {
|
|
|
- continue;
|
|
|
- };
|
|
|
- setPids.add(orgPersonBean.getId());
|
|
|
- }
|
|
|
+ m = TaskMemberUtil.getMemberBeanByPid(mems, parPer.getId());
|
|
|
+ }
|
|
|
+ if (m != null) {
|
|
|
+ Object o = TaskMemberUtil.getTaskManagerMember(m);
|
|
|
+ if (o != null) {
|
|
|
+ if (o instanceof List) {
|
|
|
+ List<OrgPersonBean> personBeans = (List<OrgPersonBean>) o;
|
|
|
+ for (OrgPersonBean personBean : personBeans) {
|
|
|
+ if (personBean != null) {
|
|
|
+ receiverIds.add(personBean.getId());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- List<Long> pids = new ArrayList<Long>();
|
|
|
- for (Long id : setPids) {
|
|
|
- pids.add(id);
|
|
|
- }
|
|
|
- List<OrgPersonBean> orgPersonBeans = orgManager.findPersonsByIdNoClone(pids);
|
|
|
- // List<TaskMemberBean> mems2 = new
|
|
|
- // ArrayList<TaskMemberBean>();
|
|
|
- // for (TaskMemberBean t : mems) {
|
|
|
- // Object o = TaskUtil.getTaskManagerMember(t);
|
|
|
- // if (o instanceof OrgPersonBean) {
|
|
|
- // if
|
|
|
- // (!(((OrgPersonBean)o).getId().equals(process.getPersonId())))
|
|
|
- // {
|
|
|
- // mems2.add(t);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // 添加督办人
|
|
|
- // IDzdbTaskManager dbTaskManager =
|
|
|
- // AppContext.getBean(IDzdbTaskManager.class);
|
|
|
- // TaskAttrBean attrBean =
|
|
|
- // dbTaskManager.findTaskAttrOfTask(process.getTaskId());
|
|
|
- // if (attrBean != null) {
|
|
|
- // if (attrBean.getSuperviseId() != null) {
|
|
|
- // mems2.add(new TaskMemberBean(cid,
|
|
|
- // process.getTaskId(), null, attrBean.getSuperviseId(),
|
|
|
- // null));
|
|
|
- // }
|
|
|
- // // 添加消息接收人
|
|
|
- // if
|
|
|
- // (StringUtil.isNotEmpty(attrBean.getRemindPersonIds()))
|
|
|
- // {
|
|
|
- // String[] pers =
|
|
|
- // attrBean.getRemindPersonIds().split(",");
|
|
|
- // for (String perTemp : pers) {
|
|
|
- // try {
|
|
|
- // mems2.add(new TaskMemberBean(cid,
|
|
|
- // process.getTaskId(), null, Long.parseLong(perTemp),
|
|
|
- // null));
|
|
|
- // } catch (Exception e) {
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // this.sendMessage(process.getOrgCorporationId(),
|
|
|
- // process.getTaskId(), process.getPersonId(), mems2,
|
|
|
- // pname + "在" + tcategoryDes + "<" + title + ">" +
|
|
|
- // message + ":" + process.getOpinion(),
|
|
|
- // taskBO.getSummaryBean().getTcategory());
|
|
|
- if(behEnum.getKey()==BehaviorEnum.BehSummaryBehTypeEnum.LevMsgTask.getKey()&& process.getProcessResourceId()!=null&& StringUtil.isNotEmpty(process.getProcessResourceType())){//汇报留言发送消息特殊处理
|
|
|
- TaskReportBean taskReportBean = taskByTypeManager.findTaskReportById(process.getProcessResourceId());
|
|
|
- if(taskReportBean!=null) {
|
|
|
- OrgPersonBean orgPersonBean = orgManager.findPersonById(taskReportBean.getDepartmentId());
|
|
|
- if(orgPersonBean==null){
|
|
|
- orgPersonBean = orgManager.findPersonById(process.getPersonId());
|
|
|
- }
|
|
|
- message="中对("+orgPersonBean.getPname()+")的汇报"+message;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 如果是分享等
|
|
|
+ // if
|
|
|
+ // (process.getPtype().equals(TaskProcessTypeEnum.ShakeAdded.getKey()))
|
|
|
+ // {
|
|
|
+ // mems3.add(new TaskMemberBean(cid,
|
|
|
+ // process.getTaskId(),
|
|
|
+ // ResourceTypeEnum.OrgPerson.getKey(),
|
|
|
+ // process.getShakePersonId(),
|
|
|
+ // TaskMemberRelTypeEnum.Participant.getKey()));
|
|
|
+ // } else {
|
|
|
+ // mems3.add(new TaskMemberBean(cid,
|
|
|
+ // process.getTaskId(),
|
|
|
+ // ResourceTypeEnum.OrgPerson.getKey(),
|
|
|
+ // parPer.getId(),
|
|
|
+ // TaskMemberRelTypeEnum.Participant.getKey()));
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ if (CollectionUtil.isNotEmpty(receiverIds)) {
|
|
|
+ String lastMsg = pname + "在" + tcategoryDes + "<" + title
|
|
|
+ + ">对你的留言进行了回复" + ":" + process.getOpinion();
|
|
|
|
|
|
- //领导对汇报留言时,只对该汇报人进行消息发送
|
|
|
- orgPersonBeans = Lists.newArrayList(orgPersonBean);
|
|
|
- }
|
|
|
- }
|
|
|
- String lastMsg = dname + "[" + pname + "]" + "在" + tcategoryDes +
|
|
|
- "《" + title + "》" + message + ":" + process.getOpinion();
|
|
|
- if ("批示".equals(message) || "留言".equals(message)){
|
|
|
- //查询消息提醒设置是否设置了提示消息 留言/批示消息提醒
|
|
|
- Map<String, Object> param = new HashMap<>();
|
|
|
- param.put("name", dname + "[" + pname + "]");
|
|
|
- param.put("operObject", process.getOpinion());
|
|
|
- param.put("operContent", taskSummaryBean.getTitle());
|
|
|
- if ("批示".equals(message)){
|
|
|
- param.put("notifyType", SmsEnum.MessageNotifyType.Instructions.getKey());
|
|
|
- } else {
|
|
|
- param.put("notifyType", SmsEnum.MessageNotifyType.LevMsgTask.getKey());
|
|
|
- }
|
|
|
- param.put("messageType", SmsEnum.TaskMessageType.Task.getKey());
|
|
|
- param.put("taskTypeId", taskSummaryBean.getTaskTypeId());
|
|
|
- lastMsg = taskManager.buildMessageInfo(param, lastMsg);
|
|
|
- }
|
|
|
- this.sendTaskRemindMessage(process.getOrgCorporationId(), process.getTaskId(), process.getPersonId(), orgPersonBeans, lastMsg, taskSummaryBean.getTcategory());
|
|
|
+ //查询消息提醒设置是否设置了提示消息 留言/批示消息提醒
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("name", pname);
|
|
|
+ param.put("operObject", process.getOpinion());
|
|
|
+ param.put("operContent", taskSummaryBean.getTitle());
|
|
|
+ param.put("notifyType", SmsEnum.MessageNotifyType.LevMsgTask.getKey());
|
|
|
+ param.put("messageType", SmsEnum.TaskMessageType.Task.getKey());
|
|
|
+ param.put("taskTypeId", taskSummaryBean.getTaskTypeId());
|
|
|
+ lastMsg = taskManager.buildMessageInfo(param, lastMsg);
|
|
|
+
|
|
|
+ this.sendMessageByPersonIds(cid, process.getTaskId(), process.getPersonId(), receiverIds, lastMsg, taskSummaryBean.getTcategory(), MessageResourceTypeEnum.Comment.getKey());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(CollectionUtils.isEmpty(pids)){
|
|
|
+ // 消息接收的人员
|
|
|
+ Set<Long> setPids = new HashSet<>();
|
|
|
+ //如果是不发布的批示数据,只有督办人和领导秘书收到消息
|
|
|
+ if(BaseEnum.BooleanEnum.False.getKey() == process.getIsPublished()){
|
|
|
+ List<TaskMemberBean> list = mems.stream().filter(e -> Integer.valueOf(
|
|
|
+ TaskMemberRelTypeEnum.Supervise.getKey()).equals(e.getRelationType())).toList();
|
|
|
+ setPids.addAll(getMemberPersonIds(list));
|
|
|
+ //todo 领导秘书收到领导批示消息
|
|
|
+ }else{
|
|
|
+ setPids.addAll(getMemberPersonIds(mems));
|
|
|
+ }
|
|
|
+ pids = new ArrayList<Long>();
|
|
|
+ pids.addAll(setPids);
|
|
|
+ }
|
|
|
+ List<OrgPersonBean> orgPersonBeans = orgManager.findPersonsByIdNoClone(pids);
|
|
|
+ // List<TaskMemberBean> mems2 = new
|
|
|
+ // ArrayList<TaskMemberBean>();
|
|
|
+ // for (TaskMemberBean t : mems) {
|
|
|
+ // Object o = TaskUtil.getTaskManagerMember(t);
|
|
|
+ // if (o instanceof OrgPersonBean) {
|
|
|
+ // if
|
|
|
+ // (!(((OrgPersonBean)o).getId().equals(process.getPersonId())))
|
|
|
+ // {
|
|
|
+ // mems2.add(t);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // 添加督办人
|
|
|
+ // IDzdbTaskManager dbTaskManager =
|
|
|
+ // AppContext.getBean(IDzdbTaskManager.class);
|
|
|
+ // TaskAttrBean attrBean =
|
|
|
+ // dbTaskManager.findTaskAttrOfTask(process.getTaskId());
|
|
|
+ // if (attrBean != null) {
|
|
|
+ // if (attrBean.getSuperviseId() != null) {
|
|
|
+ // mems2.add(new TaskMemberBean(cid,
|
|
|
+ // process.getTaskId(), null, attrBean.getSuperviseId(),
|
|
|
+ // null));
|
|
|
+ // }
|
|
|
+ // // 添加消息接收人
|
|
|
+ // if
|
|
|
+ // (StringUtil.isNotEmpty(attrBean.getRemindPersonIds()))
|
|
|
+ // {
|
|
|
+ // String[] pers =
|
|
|
+ // attrBean.getRemindPersonIds().split(",");
|
|
|
+ // for (String perTemp : pers) {
|
|
|
+ // try {
|
|
|
+ // mems2.add(new TaskMemberBean(cid,
|
|
|
+ // process.getTaskId(), null, Long.parseLong(perTemp),
|
|
|
+ // null));
|
|
|
+ // } catch (Exception e) {
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // this.sendMessage(process.getOrgCorporationId(),
|
|
|
+ // process.getTaskId(), process.getPersonId(), mems2,
|
|
|
+ // pname + "在" + tcategoryDes + "<" + title + ">" +
|
|
|
+ // message + ":" + process.getOpinion(),
|
|
|
+ // taskBO.getSummaryBean().getTcategory());
|
|
|
+ if(behEnum.getKey()== BehSummaryBehTypeEnum.LevMsgTask.getKey()&& process.getProcessResourceId()!=null&& StringUtil.isNotEmpty(
|
|
|
+ process.getProcessResourceType())){//汇报留言发送消息特殊处理
|
|
|
+ TaskReportBean taskReportBean = taskByTypeManager.findTaskReportById(process.getProcessResourceId());
|
|
|
+ if(taskReportBean!=null) {
|
|
|
+ OrgPersonBean orgPersonBean = orgManager.findPersonById(taskReportBean.getDepartmentId());
|
|
|
+ if(orgPersonBean==null){
|
|
|
+ orgPersonBean = orgManager.findPersonById(process.getPersonId());
|
|
|
}
|
|
|
+ message ="中对("+orgPersonBean.getPname()+")的汇报"+ message;
|
|
|
+
|
|
|
+ //领导对汇报留言时,只对该汇报人进行消息发送
|
|
|
+ orgPersonBeans = Lists.newArrayList(orgPersonBean);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String lastMsg = dname + "[" + pname + "]" + "在" + tcategoryDes +
|
|
|
+ "《" + title + "》" + message + ":" + process.getOpinion();
|
|
|
+ if ("批示".equals(message) || "留言".equals(message)){
|
|
|
+ //查询消息提醒设置是否设置了提示消息 留言/批示消息提醒
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("name", dname + "[" + pname + "]");
|
|
|
+ param.put("operObject", process.getOpinion());
|
|
|
+ param.put("operContent", taskSummaryBean.getTitle());
|
|
|
+ if ("批示".equals(message)){
|
|
|
+ param.put("notifyType", SmsEnum.MessageNotifyType.Instructions.getKey());
|
|
|
+ } else {
|
|
|
+ param.put("notifyType", SmsEnum.MessageNotifyType.LevMsgTask.getKey());
|
|
|
+ }
|
|
|
+ param.put("messageType", SmsEnum.TaskMessageType.Task.getKey());
|
|
|
+ param.put("taskTypeId", taskSummaryBean.getTaskTypeId());
|
|
|
+ lastMsg = taskManager.buildMessageInfo(param, lastMsg);
|
|
|
+ }
|
|
|
+ this.sendTaskRemindMessage(process.getOrgCorporationId(), process.getTaskId(), process.getPersonId(), orgPersonBeans, lastMsg, taskSummaryBean.getTcategory());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private Set<Long> getMemberPersonIds(List<TaskMemberBean> mems){
|
|
|
+ Set<Long> setPids = new HashSet<Long>();
|
|
|
+ // 查询扩展角色 Modifier: <Zhengyu.Hu> 2018/8/21 下午2:19 end.
|
|
|
+ List<Integer> extendRoles = TaskRoleUtil.getRoleCodes(TaskRoleWrapper.of(taskAppManager.findTaskRoles()).requireMessage().get());
|
|
|
+ for (TaskMemberBean t : mems) {
|
|
|
+ if(TaskMemberRelTypeEnum.isBaseRel(t.getRelationType()) || extendRoles.contains(t.getRelationType())){
|
|
|
+ Object o = TaskMemberUtil.getTaskManagerMember(t);
|
|
|
+ if (o instanceof List) {
|
|
|
+ List<OrgPersonBean> orgPersonBeans = (List<OrgPersonBean>) o;
|
|
|
+ for (OrgPersonBean orgPersonBean : orgPersonBeans) {
|
|
|
+ if(orgPersonBean == null) {
|
|
|
+ continue;
|
|
|
+ };
|
|
|
+ setPids.add(orgPersonBean.getId());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- log.error(e.getLocalizedMessage(), e);
|
|
|
- throw new BusinessException(e);
|
|
|
}
|
|
|
+ return setPids;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1652,7 +1716,7 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
Map<Long, Integer> idsMap = new HashMap<Long, Integer>();
|
|
|
for (int i = 0; i < result.getList().size(); i++) {
|
|
|
BehSummaryBean beh = (BehSummaryBean) result.getList().get(i);
|
|
|
- if (beh.getBehType().intValue() == BehSummaryBehTypeEnum.LevMsgTask.getKey()) {
|
|
|
+ if (beh.getBehType().intValue() == BehSummaryBehTypeEnum.LevMsgTask.getKey()||beh.getBehType().intValue() == BehSummaryBehTypeEnum.InstructionsTaskLimitScope.getKey()) {
|
|
|
idsMap.put(Long.valueOf(beh.getExt1()), i);
|
|
|
}
|
|
|
}
|
|
@@ -8934,6 +8998,7 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
TaskProcessSummaryBean processSummaryBean = null;
|
|
|
Criterion c = Restrictions.and(Restrictions.eq("taskId", taskId), Restrictions.eq("personId", pid));
|
|
|
c = Restrictions.and(c, Restrictions.eq("parentId", 0L));
|
|
|
+ c = Restrictions.and(c, Restrictions.eq("isPublished", 1));
|
|
|
List<TaskProcessSummaryBean> processSummaryBeans = taskProcessSummaryDao.findTaskProcessBeans(c);
|
|
|
if (CollectionUtil.isNotEmpty(processSummaryBeans)) {
|
|
|
processSummaryBean = processSummaryBeans.get(0);
|
|
@@ -8955,6 +9020,7 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
}
|
|
|
|
|
|
c = Restrictions.and(c, Restrictions.eq("processResourceId", reportId));
|
|
|
+ c = Restrictions.and(c, Restrictions.eq("isPublished", 1));
|
|
|
|
|
|
List<TaskProcessSummaryBean> processSummaryBeans = taskProcessSummaryDao.findTaskProcessBeans(c);
|
|
|
if (CollectionUtil.isNotEmpty(processSummaryBeans)) {
|
|
@@ -8979,6 +9045,7 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
c = Restrictions.and(c, Restrictions.eq("processResourceId", reportId));
|
|
|
}
|
|
|
c = Restrictions.and(c, Restrictions.eq("processStageId", phaseId));
|
|
|
+ c = Restrictions.and(c, Restrictions.eq("isPublished", 1));
|
|
|
|
|
|
List<TaskProcessSummaryBean> processSummaryBeans = taskProcessSummaryDao.findTaskProcessBeans(c);
|
|
|
if (CollectionUtil.isNotEmpty(processSummaryBeans)) {
|
|
@@ -8996,6 +9063,7 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
try {
|
|
|
TaskProcessSummaryBean processSummaryBean = null;
|
|
|
Criterion c = Restrictions.and( Restrictions.eq("processResourceId", reportId));
|
|
|
+ c = Restrictions.and(c, Restrictions.eq("isPublished", 1));
|
|
|
|
|
|
List<TaskProcessSummaryBean> processSummaryBeans = taskProcessSummaryDao.findTaskProcessBeans(c);
|
|
|
if (CollectionUtil.isNotEmpty(processSummaryBeans)) {
|
|
@@ -9012,7 +9080,7 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
try {
|
|
|
TaskProcessSummaryBean processSummaryBean = null;
|
|
|
Criterion c = Restrictions.and( Restrictions.eq("processResourceId", reportId));
|
|
|
-
|
|
|
+ c = Restrictions.and(c, Restrictions.eq("isPublished", 1));
|
|
|
if(phaseId != null){
|
|
|
c = Restrictions.and(c,Restrictions.eq("processStageId",phaseId));
|
|
|
}
|
|
@@ -9030,7 +9098,7 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
try {
|
|
|
TaskProcessSummaryBean processSummaryBean = null;
|
|
|
Criterion c = Restrictions.and( Restrictions.eq("processResourceId", reportId));
|
|
|
-
|
|
|
+ c = Restrictions.and(c, Restrictions.eq("isPublished", 1));
|
|
|
if(phaseId != null){
|
|
|
c = Restrictions.and(c,Restrictions.eq("processStageId",phaseId));
|
|
|
}
|
|
@@ -13022,11 +13090,11 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Map<String, Object>> findInstructionsAndLeavingaMessageCount(Long taskId, List<Long> excludedPersonIds)throws BusinessException {
|
|
|
+ public List<Map<String, Object>> findInstructionsAndLeavingaMessageCount(Long taskId, List<Long> excludedIds)throws BusinessException {
|
|
|
List<Map<String, Object>> instructionsCount = null;
|
|
|
try {
|
|
|
ITaskSummaryMapper summaryMapper = AppContext.getBean(ITaskSummaryMapper.class);
|
|
|
- instructionsCount = summaryMapper.findInstructionsAndLeavingaMessageCount(taskId, excludedPersonIds);
|
|
|
+ instructionsCount = summaryMapper.findInstructionsAndLeavingaMessageCount(taskId, excludedIds);
|
|
|
} catch (Exception e) {
|
|
|
throw new BusinessException(e);
|
|
|
}
|
|
@@ -20601,7 +20669,7 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
//移除附件
|
|
|
attachmentManager.deleteByReference(process.getTaskId(),itemId);
|
|
|
//移除行为
|
|
|
- behManager.deleteByBehTypeAndExt1(ResourceTypeEnum.Task.getKey(),String.valueOf(process.getTaskId()),
|
|
|
+ behManager.deleteByResTypeAndExt1(ResourceTypeEnum.Task.getKey(),String.valueOf(process.getTaskId()),
|
|
|
String.valueOf(itemId));
|
|
|
//移除批示留言
|
|
|
taskProcessSummaryDao.delete(TaskProcessSummaryBean.class,itemId);
|
|
@@ -20642,4 +20710,147 @@ public class TaskManagerImpl implements ITaskManager {
|
|
|
behManager.addBehavior4Param(param,StringUtils.join(orgEntityNames,","));
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> findTaskProcessVisibilityInfo(Long processId){
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ TaskProcessSummaryBean process = findTaskProcessSummaryById(processId);
|
|
|
+ if(process == null){
|
|
|
+ throw new BusinessException("任务动态不存在!");
|
|
|
+ }
|
|
|
+ TaskProcessVisibilityScopeEnum scopeEnum = TaskProcessVisibilityScopeEnum.findEnumByKey(
|
|
|
+ process.getVisibilityScope());
|
|
|
+ if(scopeEnum == null){
|
|
|
+ scopeEnum = TaskProcessVisibilityScopeEnum.All;
|
|
|
+ }
|
|
|
+ map.put("visibilityScope", scopeEnum.getKey());
|
|
|
+ List<String> resourceKeys = new ArrayList<>();
|
|
|
+ switch(scopeEnum){
|
|
|
+ case None:
|
|
|
+ break;
|
|
|
+ case All:
|
|
|
+ break;
|
|
|
+ case Part:
|
|
|
+ List<TaskProcessVisibilityBean> visibilityBeans = taskProcessVisibilityDao.findListByProcessId(processId);
|
|
|
+ resourceKeys= visibilityBeans.stream().map(e -> e.getResourceType() + "_" + e.getResourceId()).toList();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ map.put("resourceKeys", resourceKeys);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateTaskProcessVisibility(Long processId, String visibilityScope, String[] resourceKeys, Long pid){
|
|
|
+ if(resourceKeys == null){
|
|
|
+ resourceKeys = new String[]{};
|
|
|
+ }
|
|
|
+ TaskProcessSummaryBean process = findTaskProcessSummaryById(processId);
|
|
|
+ if(process == null){
|
|
|
+ throw new BusinessException("任务动态不存在!");
|
|
|
+ }
|
|
|
+ TaskProcessVisibilityScopeEnum scopeEnum = TaskProcessVisibilityScopeEnum.findEnumByKey(visibilityScope);
|
|
|
+ if(scopeEnum == null){
|
|
|
+ throw new BusinessException("公开范围类型错误!");
|
|
|
+ }
|
|
|
+ switch(scopeEnum){
|
|
|
+ case None -> process.setIsPublished(BaseEnum.BooleanEnum.False.getKey());
|
|
|
+ case All -> {
|
|
|
+ process.setIsPublished(BaseEnum.BooleanEnum.True.getKey());
|
|
|
+ }
|
|
|
+ case Part -> {
|
|
|
+ if(resourceKeys == null || resourceKeys.length == 0){
|
|
|
+ throw new BusinessException("部分公开需要选择人员/部门!");
|
|
|
+ }
|
|
|
+ process.setIsPublished(BaseEnum.BooleanEnum.True.getKey());
|
|
|
+ }
|
|
|
+ default -> process.setIsPublished(BaseEnum.BooleanEnum.False.getKey());
|
|
|
+ }
|
|
|
+
|
|
|
+ process.setVisibilityScope(scopeEnum.getKey());
|
|
|
+ taskProcessSummaryDao.updateTaskProcess(List.of(process));
|
|
|
+ //更新可见范围数据
|
|
|
+ taskProcessVisibilityDao.deleteByProcessId(processId);
|
|
|
+ if(resourceKeys.length > 0){
|
|
|
+ List<TaskProcessVisibilityBean> list = Stream.of(resourceKeys).map(e -> {
|
|
|
+ String[] tmp = e.split("_");
|
|
|
+ String type = tmp[0];
|
|
|
+ Long id = Long.parseLong(tmp[1]);
|
|
|
+ TaskProcessVisibilityBean bean = new TaskProcessVisibilityBean();
|
|
|
+ bean.setId(UUIDUtil.UUIDAbsLong());
|
|
|
+ bean.setTaskId(process.getTaskId());
|
|
|
+ bean.setProcessId(processId);
|
|
|
+ bean.setPersonId(process.getPersonId());
|
|
|
+ bean.setResourceType(type);
|
|
|
+ bean.setResourceId(id);
|
|
|
+ bean.setOperatorId(pid);
|
|
|
+ bean.setCreateDate(new Date());
|
|
|
+ return bean;
|
|
|
+ }).toList();
|
|
|
+ if(CollectionUtil.isNotEmpty(list)){
|
|
|
+ taskProcessVisibilityDao.saveAll(list);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //增加事项向成员
|
|
|
+ TaskSummaryBean task = findTaskSummaryBeanById(process.getTaskId());
|
|
|
+ //排除掉已经存在的事项成员
|
|
|
+ List<TaskMemberBean> members = taskMemberDao.findTaskMembersByTaskId(task.getId(), false);
|
|
|
+ List<String> dbResourceKeys = members.stream().map(TaskMemberBean::getResourceKey).toList();
|
|
|
+ List<String> resources = Stream.of(resourceKeys).filter(e -> !dbResourceKeys.contains(e)).toList();
|
|
|
+ if(!CollectionUtils.isEmpty(resources)){
|
|
|
+ //增加成员
|
|
|
+ List<TaskMemberBean> addMembers = geTaskMemberBeans(resources.toArray(new String[0]), task.getId(),
|
|
|
+ task.getOrgCorporationId(), TaskMemberRelTypeEnum.NodeManager);
|
|
|
+ taskMemberDao.addTaskMember(addMembers);
|
|
|
+ }
|
|
|
+
|
|
|
+ //只给对应的人员发消息
|
|
|
+ List<Long> pids = new ArrayList<>();
|
|
|
+ members = taskMemberDao.findTaskMembersByTaskId(task.getId(), false);
|
|
|
+ //督办人是否不收到消息
|
|
|
+ //members = members.stream().filter(e -> (!Integer.valueOf(TaskMemberRelTypeEnum.Supervise.getKey())
|
|
|
+ // .equals(e.getRelationType()))).toList();
|
|
|
+ if(TaskProcessVisibilityScopeEnum.All.equals(scopeEnum)){
|
|
|
+ pids.addAll(getMemberPersonIds(members));
|
|
|
+ } else if(TaskProcessVisibilityScopeEnum.Part.equals(scopeEnum)){
|
|
|
+ List<String> resourceKeyList = List.of(resourceKeys);
|
|
|
+ pids.addAll(getMemberPersonIds(
|
|
|
+ members.stream().filter(e -> resourceKeyList.contains(e.getResourceKey())).toList()));
|
|
|
+ }
|
|
|
+ //自己不收到消息
|
|
|
+ pids.remove(pid);
|
|
|
+ sendTaskMessageByProcess(task, process, BehSummaryBehTypeEnum.InstructionsTaskLimitScope, null, null,
|
|
|
+ null, pids);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Long> findTaskProcessVisibilityRunTime(Long taskId, Long pid){
|
|
|
+ //先查询全部公开的批示留言
|
|
|
+ Criterion c = Restrictions.and(Restrictions.eq("taskId", taskId),
|
|
|
+ Restrictions.eq("ptype", TaskProcessTypeEnum.Instructions.getKey()),
|
|
|
+ Restrictions.eq("isPublished", BaseEnum.BooleanEnum.True.getKey()),
|
|
|
+ Restrictions.eq("visibilityScope", TaskProcessVisibilityScopeEnum.All.getKey()));
|
|
|
+ List<TaskProcessSummaryBean> taskProcessSummaryBeans = taskProcessSummaryDao.findBy(
|
|
|
+ TaskProcessSummaryBean.class, c);
|
|
|
+ List<Long> list = new ArrayList<>(taskProcessSummaryBeans.stream().map(TaskProcessSummaryBean::getId).toList());
|
|
|
+ //再查询部分公开的
|
|
|
+ List<TaskProcessVisibilityBean> listByTaskId = taskProcessVisibilityDao.findListByTaskId(taskId);
|
|
|
+ Map<Long, List<TaskProcessVisibilityBean>> map = listByTaskId.stream().collect(
|
|
|
+ Collectors.groupingBy(TaskProcessVisibilityBean::getProcessId));
|
|
|
+ for(Entry<Long, List<TaskProcessVisibilityBean>> entry : map.entrySet()){
|
|
|
+ for(TaskProcessVisibilityBean bean : entry.getValue()){
|
|
|
+ if(String.valueOf(ResourceTypeEnum.OrgDepartment.getKey()).equals(bean.getResourceType())){
|
|
|
+ if(TaskMemberUtil.isDepSpecifiedRole(bean.getResourceId(), pid)){
|
|
|
+ list.add(entry.getKey());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else if(String.valueOf(ResourceTypeEnum.OrgPerson.getKey()).equals(bean.getResourceType())){
|
|
|
+ if(pid.equals(bean.getResourceId())){
|
|
|
+ list.add(entry.getKey());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list.stream().distinct().toList();
|
|
|
+ }
|
|
|
}
|