Forráskód Böngészése

区长书记、区领导发布的审批留言不直接公布。完成

wanyuan 9 hónapja
szülő
commit
b53a8be1f4
45 módosított fájl, 1430 hozzáadás és 485 törlés
  1. 32 0
      02-script/sql/v1.5_updateTaskProcessSummary.sql
  2. 2 0
      tc-service/tap-crm/src/main/resources/META-INF/module/crm/i18n/crm_en.properties
  3. 2 0
      tc-service/tap-crm/src/main/resources/META-INF/module/crm/i18n/crm_zh_CN.properties
  4. 12 5
      tc-service/tap-project/src/main/java/com/minto/app/project/mapper/IProjectMapper.xml
  5. 1 0
      tc-service/tap-project/src/main/java/com/minto/app/project/project.review.sql.xml
  6. 2 1
      tc-service/tap-project/src/main/java/com/minto/app/project/service/impl/ProjectReviewServiceImpl.java
  7. 5 4
      tc-service/tap-task/src/main/java/com/minto/app/task/beans/task_process_summary.hbm.xml
  8. 20 0
      tc-service/tap-task/src/main/java/com/minto/app/task/beans/task_process_visibility.hbm.xml
  9. 22 0
      tc-service/tap-task/src/main/java/com/minto/app/task/dao/ITaskProcessVisibilityDao.java
  10. 7 3
      tc-service/tap-task/src/main/java/com/minto/app/task/dao/MessageAndCommentDaoImpl.java
  11. 1 0
      tc-service/tap-task/src/main/java/com/minto/app/task/dao/TaskCommonDaoImpl.java
  12. 2 1
      tc-service/tap-task/src/main/java/com/minto/app/task/dao/TaskMemberDaoImpl.java
  13. 19 1
      tc-service/tap-task/src/main/java/com/minto/app/task/dao/TaskProcessSummaryDaoImpl.java
  14. 37 0
      tc-service/tap-task/src/main/java/com/minto/app/task/dao/TaskProcessVisibilityDaoImpl.java
  15. 5 5
      tc-service/tap-task/src/main/java/com/minto/app/task/dao/TaskSummaryDaoImpl.java
  16. 456 245
      tc-service/tap-task/src/main/java/com/minto/app/task/manager/TaskManagerImpl.java
  17. 6 0
      tc-service/tap-task/src/main/java/com/minto/app/task/mapper/ITaskAnalysisMapper.xml
  18. 1 3
      tc-service/tap-task/src/main/java/com/minto/app/task/mapper/ITaskSummaryMapper.java
  19. 8 6
      tc-service/tap-task/src/main/java/com/minto/app/task/mapper/ITaskSummaryMapper.xml
  20. 2 0
      tc-service/tap-task/src/main/java/com/minto/app/tc/community/manager/CommunityManagerImpl.java
  21. 4 2
      tc-service/tap-workbrain/src/main/java/com/minto/app/workbrain/chat.sql.xml
  22. 4 0
      tip-api/src/main/java/com/minto/app/behavior/enums/BehaviorEnum.java
  23. 3 1
      tip-api/src/main/java/com/minto/app/behavior/manager/IBehManager.java
  24. 30 0
      tip-api/src/main/java/com/minto/app/task/beans/TaskProcessSummaryBean.java
  25. 49 0
      tip-api/src/main/java/com/minto/app/task/beans/TaskProcessVisibilityBean.java
  26. 1 0
      tip-api/src/main/java/com/minto/app/task/bo/TaskProcessBO.java
  27. 38 0
      tip-api/src/main/java/com/minto/app/task/enums/TaskProcessVisibilityScopeEnum.java
  28. 27 2
      tip-api/src/main/java/com/minto/app/task/manager/ITaskManager.java
  29. 13 29
      tip-api/src/main/java/com/minto/app/task/util/TaskMemberUtil.java
  30. 10 0
      tip-api/src/main/java/com/minto/app/task/util/TaskTransverter.java
  31. 2 0
      tip-bff/src/main/java/com/minto/app/behavior/manager/WorkDynamicManagerImpl.java
  32. 9 4
      tip-bff/src/main/java/com/minto/bff/beh.sql.xml
  33. 60 60
      tip-front/src/main/java/com/minto/app/task/controller/MtTaskController.java
  34. 31 8
      tip-front/src/main/java/com/minto/app/task/controller/TaskByTypeController.java
  35. 60 16
      tip-front/src/main/java/com/minto/app/task/controller/TaskController.java
  36. 101 2
      tip-front/src/main/java/com/minto/app/task/util/TaskKaizhouUtil.java
  37. 1 0
      tip-front/src/main/webapp/apps_res/common/js/workDynamicCommon.js
  38. 178 0
      tip-front/src/main/webapp/tc_suite/task/taskProcessVisibility.jsp
  39. 28 28
      tip-front/src/main/webapp/tc_suite/taskmt/byType/mergeTask.jsp
  40. 63 18
      tip-front/src/main/webapp/tc_suite/taskmt/js/task.js
  41. 22 10
      tip-front/src/main/webapp/tc_suite/taskmt/taskMessageList.jsp
  42. 30 21
      tip-service/tip-common/src/main/java/com/minto/app/behavior/dao/BehSummaryDaoImpl.java
  43. 20 10
      tip-service/tip-common/src/main/java/com/minto/app/behavior/manager/BehManagerImpl.java
  44. 2 0
      tip-service/tip-common/src/main/resources/META-INF/module/behavior/i18n/behavior_en.properties
  45. 2 0
      tip-service/tip-common/src/main/resources/META-INF/module/behavior/i18n/behavior_zh_CN.properties

+ 32 - 0
02-script/sql/v1.5_updateTaskProcessSummary.sql

@@ -0,0 +1,32 @@
+--增加字段:批示留言是否已发布
+ALTER TABLE "public"."task_process_summary" ADD COLUMN "is_published" int2 DEFAULT 1;
+ALTER TABLE "public"."task_process_summary" ADD COLUMN "visibility_scope" VARCHAR(64) DEFAULT 'All';
+COMMENT ON COLUMN "public"."task_process_summary"."is_published" IS '批示留言是否已发布,默认1';
+COMMENT ON COLUMN "public"."task_process_summary"."visibility_scope" IS '可见范围,默认全部可见';
+
+
+
+--增加表记录批示留言的可见性
+DROP TABLE IF EXISTS "public"."task_process_visibility";
+CREATE TABLE "public"."task_process_visibility"(
+    "id"            int8 NOT NULL,
+    "task_id"       int8 NOT NULL,
+    "process_id"    int8 NOT NULL,
+    "person_id"     int8 NOT NULL,
+    "resource_type" VARCHAR(64) COLLATE "pg_catalog"."default",
+    "resource_id"   int8,
+    "operator_id"   int8,
+    "create_date"   TIMESTAMP(6)
+);
+COMMENT ON COLUMN "public"."task_process_visibility"."id" IS '批示留言可见范围表';
+COMMENT ON COLUMN "public"."task_process_visibility"."task_id" IS '任务id';
+COMMENT ON COLUMN "public"."task_process_visibility"."process_id" IS '批示留言id';
+COMMENT ON COLUMN "public"."task_process_visibility"."person_id" IS '发布人员id';
+COMMENT ON COLUMN "public"."task_process_visibility"."resource_type" IS '范围值类型';
+COMMENT ON COLUMN "public"."task_process_visibility"."resource_id" IS '范围值';
+COMMENT ON COLUMN "public"."task_process_visibility"."create_date" IS '创建时间';
+
+-- ----------------------------
+-- Primary Key structure for table task_process_visibility
+-- ----------------------------
+ALTER TABLE "public"."task_process_visibility" ADD CONSTRAINT "task_process_visibility_pkey" PRIMARY KEY ("id");

+ 2 - 0
tc-service/tap-crm/src/main/resources/META-INF/module/crm/i18n/crm_en.properties

@@ -105,6 +105,8 @@ behavior.attention.task.desc=
 behavior.instructions.task=
 behavior.receive.instructions.task.en=
 behavior.instructions.task.desc=
+behavior.instructions.temp.task=
+behavior.instructions.temp.task.desc=
 behavior.send.online.msg=
 behavior.send.online.msg.desc={2}
 behavior.space.bbs=

+ 2 - 0
tc-service/tap-crm/src/main/resources/META-INF/module/crm/i18n/crm_zh_CN.properties

@@ -104,6 +104,8 @@ behavior.attention.task=\u4E8B\u9879\u5173\u6CE8
 behavior.attention.task.desc={0}{1}\u4E8B\u9879
 behavior.instructions.task=\u6279\u793A
 behavior.instructions.task.desc=\u5728{1}\u4E2D\u6279\u793A\uFF1A{2}
+behavior.instructions.temp.task=\u6279\u793A
+behavior.instructions.temp.task.desc=\u5728{1}\u4E2D\u6279\u793A\uFF1A{2}
 behavior.receive.instructions.task={0} \u5BF9{1}\u8FDB\u884C\u4E86\u6279\u793A\uFF1A{2}
 behavior.send.online.msg=\u53D1\u9001\u5728\u7EBF\u6D88\u606F
 behavior.send.online.msg.desc={2}

+ 12 - 5
tc-service/tap-project/src/main/java/com/minto/app/project/mapper/IProjectMapper.xml

@@ -570,10 +570,11 @@
         FROM task_process_summary
         WHERE 1=1
 -- 	        process_date = (
--- 	            SELECT MAX ( process_date ) FROM task_process_summary WHERE ptype = 0 AND person_id = #{leaderId} AND task_id = #{projId}
+-- 	            SELECT MAX ( process_date ) FROM task_process_summary WHERE ptype = 0 AND person_id = #{leaderId} AND task_id = #{projId} AND is_published = 1
 -- 	        )
 	    AND ptype = 0 --常规处理
 	    AND person_id = #{leaderId}
+        AND is_published = 1
 	    AND task_id = #{projId}   -- 这里指的是项目的id
 	    order by process_date desc limit 1
     </select>
@@ -2566,6 +2567,7 @@
             exists (
                     select 1 from  task_process_summary t
                     where p.id = t.task_id
+                    and t.is_published = 1
                     <if test="personId != null">
                         <foreach collection="personId" item="pid" separator="," open="AND t.person_id in (" close=")">
                             #{pid}
@@ -2627,11 +2629,13 @@
             FROM
                 task_process_summary
             WHERE
-                ( task_id, process_date ) IN ( SELECT task_id, MAX ( process_date ) process_date FROM task_process_summary WHERE person_id = #{personId,jdbcType=BIGINT} GROUP BY task_id )
+                ( task_id, process_date ) IN ( SELECT task_id, MAX ( process_date ) process_date FROM
+                    task_process_summary WHERE person_id = #{personId,jdbcType=BIGINT} AND is_published = 1 GROUP BY task_id )
             ) b ON A.task_id = b.task_id
         WHERE
             A.process_date BETWEEN #{startTime,jdbcType=TIMESTAMP} and #{endTime,jdbcType=TIMESTAMP}
             AND A.person_id = #{personId,jdbcType=BIGINT}
+            AND A.is_published = 1
         GROUP BY
             b.task_id,
             b.opinion
@@ -2705,7 +2709,8 @@
     <select id="findProjectInvolvementByPersonId" resultType="com.minto.tap.project.dto.ChatProjectInvolvementDTO">
         select p.id "projectId",p.title "projectTitle",t.report_count,m.manager "projectManager",p.lib_type "libTypeId" from dm_dtab_project_summary p
                   left join (select m.proj_id,string_agg(concat(m.resource_type,'_',m.resource_id),',') manager from project_member m where m.relation_type = 1 GROUP BY m.proj_id) m on p.id = m.proj_id
-                  left join (select t.task_id,count(t.id) report_count from task_process_summary t where t.person_id = #{personId} GROUP BY t.task_id) t on p.id = t.task_id
+                  left join (select t.task_id,count(t.id) report_count from task_process_summary t where t.person_id
+        = #{personId} and t.is_published = 1 GROUP BY t.task_id) t on p.id = t.task_id
         where p.proj_status != -1 AND EXISTS (select 1 from project_member pm
                       where pm.resource_id = #{personId} and p.id = pm.proj_id)
     </select>
@@ -2795,7 +2800,8 @@
             FROM
             task_process_summary ts
             WHERE
-            ts.ID IN (
+            ts.is_published = 1
+            AND ts.ID IN (
             SELECT CAST
             ( ext1 AS BIGINT )
             FROM
@@ -2896,7 +2902,8 @@
         task_process_summary ts
         WHERE
         ts.task_id = #{referenceId}
-        and ts.ID IN (
+        AND ts.is_published = 1
+        AND ts.ID IN (
         SELECT CAST
         ( ext1 AS BIGINT )
         FROM

+ 1 - 0
tc-service/tap-project/src/main/java/com/minto/app/project/project.review.sql.xml

@@ -16,6 +16,7 @@
                 select to_char(a.process_date ,'yyyy-MM') "createTime",count(1) num
                 from task_process_summary a
                 where a.task_id = :projectId
+                and a.is_published = 1
                 group by  to_char(a.process_date ,'yyyy-MM')
                 order by  "createTime" asc;
             ]]>

+ 2 - 1
tc-service/tap-project/src/main/java/com/minto/app/project/service/impl/ProjectReviewServiceImpl.java

@@ -350,7 +350,8 @@ public class ProjectReviewServiceImpl implements ProjectReviewService {
         //汇报留言次数单系列数据
         Map<String,Object> sqlParams = Maps.newHashMap();
         sqlParams.put("projectId", projectId);
-        var commentCount = sqlToyLazyDao.getCount("select count(id) from task_process_summary where task_id=:projectId", sqlParams);
+        var commentCount = sqlToyLazyDao.getCount("select count(id) from task_process_summary where "
+                + "task_id=:projectId and is_published = 1", sqlParams);
         param.put("commentCount", commentCount);
 
         var reportCount = sqlToyLazyDao.getCount("select count(id) from dm_dtab_project_report_extend where reference_id=:projectId", sqlParams);

+ 5 - 4
tc-service/tap-task/src/main/java/com/minto/app/task/beans/task_process_summary.hbm.xml

@@ -24,7 +24,8 @@
 
 		<property column="process_resource_id" length="19" name="processResourceId" not-null="false" type="java.lang.Long" />
 		<property column="process_stage_id" length="19" name="processStageId" not-null="false" type="java.lang.Long" />
-
+		<property column="is_published" length="10" name="isPublished" not-null="true" type="java.lang.Integer" />
+		<property column="visibility_scope"  name="visibilityScope" not-null="false" type="java.lang.String" />
 	</class>
     <query name="Task.deleteTaskProcessByTaskId">
 		<![CDATA[
@@ -35,7 +36,7 @@
 	<query name="Task.findTaskProcessOfLastedByTaskId">
 		<![CDATA[
 			from TaskProcessSummaryBean where processDate in (
-				select max(processDate) from TaskProcessSummaryBean where taskId in (:taskIds) and id not in(:ids) group by taskId)
+				select max(processDate) from TaskProcessSummaryBean where taskId in (:taskIds) and isPublished = 1 and id not in(:ids) group by taskId)
 		]]>
 	</query>
 	<query name="Task.findTaskProcessByTaskId">
@@ -45,12 +46,12 @@
 	</query>
 	<query name="Task.findTaskProcessByParentId">
 		<![CDATA[
-			from TaskProcessSummaryBean where parentId in (:parentIds)
+			from TaskProcessSummaryBean where parentId in (:parentIds) and isPublished = 1
 		]]>
 	</query>
 	<query name="Task.findTaskProcessCountByTaskId">
 		<![CDATA[
-			select count(id) from TaskProcessSummaryBean where taskId =:taskId and parentId=0
+			select count(id) from TaskProcessSummaryBean where taskId =:taskId and parentId=0 and isPublished = 1
 		]]>
 	</query>
 </hibernate-mapping>

+ 20 - 0
tc-service/tap-task/src/main/java/com/minto/app/task/beans/task_process_visibility.hbm.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="gb2312"?>
+<!--
+  ~ Copyright (c) 2014, 2022, Chengdu Minto Technology Co.,LTD. All rights reserved.
+  ~ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  -->
+
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+<hibernate-mapping package="com.minto.app.task.beans">
+    <class name="com.minto.app.task.beans.TaskProcessVisibilityBean" table="task_process_visibility">
+        <id column="id" name="id" type="java.lang.Long"><generator class="assigned" /></id>
+        <property column="task_id" length="19" name="taskId" not-null="false" type="java.lang.Long" />
+        <property column="process_id" length="19" name="processId" not-null="false" type="java.lang.Long" />
+        <property column="person_id" length="19" name="personId" not-null="false" type="java.lang.Long" />
+        <property column="resource_type"  name="resourceType" not-null="false" type="java.lang.String" />
+        <property column="resource_id" length="19" name="resourceId" not-null="false" type="java.lang.Long" />
+        <property column="operator_id" length="19" name="operatorId" not-null="false" type="java.lang.Long" />
+        <property column="create_date" length="29" name="createDate" not-null="false"  type="java.util.Date" />
+
+    </class>
+</hibernate-mapping>

+ 22 - 0
tc-service/tap-task/src/main/java/com/minto/app/task/dao/ITaskProcessVisibilityDao.java

@@ -0,0 +1,22 @@
+package com.minto.app.task.dao;
+
+import java.util.List;
+
+import com.minto.app.task.beans.TaskProcessVisibilityBean;
+import com.minto.core.dao.BaseDao;
+
+/**
+ * 应用模块名称<p>
+ * 代码描述<p>
+ *
+ * @author wany
+ * @since 2024/6/11
+ */
+public interface ITaskProcessVisibilityDao extends BaseDao{
+
+    List<TaskProcessVisibilityBean> findListByTaskId(Long taskId);
+
+    List<TaskProcessVisibilityBean> findListByProcessId(Long processId);
+
+    void deleteByProcessId(Long processId);
+}

+ 7 - 3
tc-service/tap-task/src/main/java/com/minto/app/task/dao/MessageAndCommentDaoImpl.java

@@ -50,7 +50,9 @@ public class MessageAndCommentDaoImpl extends BaseDaoImpl implements IMessageAnd
         hql.append(" and m.mstate = ").append(TaskEnum.TaskMemberStateEnum.Doing.getKey());
         hql.append(" )");
         hql.append(" )");
-        hql.append(" and exists ( select 1 from TaskProcessSummaryBean tps where  tps.taskId = t.id  ");                   //查询是否存在领导评论和留言
+        hql.append(" and exists ( select 1 from TaskProcessSummaryBean tps where  tps.taskId = t.id and tps"
+                + ".isPublished = 1 ");
+        //查询是否存在领导评论和留言
         if(isComments == 1 || isMessage == 1){
         	hql.append("and ( ");
         }
@@ -88,7 +90,8 @@ public class MessageAndCommentDaoImpl extends BaseDaoImpl implements IMessageAnd
     public List<Map<String, Object>> getTaskProcessSummaryBeanByTaskID(Long taskID) {
         StringBuffer hql = new StringBuffer();
         hql.append("select p.pname as name,t.ptype as ptype,t.opinion as opinion,t.processDate as processDate ");
-        hql.append(" from TaskProcessSummaryBean t,OrgPersonBean p where  t.personId = p.id and  t.taskId = "+taskID);
+        hql.append(" from TaskProcessSummaryBean t,OrgPersonBean p where  t.personId = p.id and t.isPublished = 1 and t"
+                + ".taskId = "+taskID);
         hql.append(" order by t.processDate desc");
         return getHibernateTpl().findBy(hql.toString());
     }
@@ -98,7 +101,8 @@ public class MessageAndCommentDaoImpl extends BaseDaoImpl implements IMessageAnd
         if(CollectionUtil.isNotEmpty(taskId)){
             StringBuffer hql = new StringBuffer();
             hql.append("select p.pname as name,p.id as pid,t.ptype as ptype,t.opinion as opinion,t.processDate as processDate,t.taskId as taskId ");
-            hql.append(" from TaskProcessSummaryBean t,OrgPersonBean p where  t.personId = p.id and  t.taskId in (:taskId)");
+            hql.append(" from TaskProcessSummaryBean t,OrgPersonBean p where  t.personId = p.id and t.isPublished = 1 "
+                    + "and t.taskId in (:taskId)");
             if(ptype!=null){
                 hql.append(" and t.ptype in (:ptype)");
             }

+ 1 - 0
tc-service/tap-task/src/main/java/com/minto/app/task/dao/TaskCommonDaoImpl.java

@@ -290,6 +290,7 @@ public class TaskCommonDaoImpl extends BaseDaoImpl implements ITaskCommonDao {
         builder.append(" and case beh_type when 10002004 then exists(select p.id from task_process_summary p where")
                 .append(" p.task_id || '' = b.res_id ")
                 .append(" and p.parent_id = 0 ")
+                .append(" and p.is_published = 1 ")
                 .append(") else 1 = 1 end");
         return builder;
     }

+ 2 - 1
tc-service/tap-task/src/main/java/com/minto/app/task/dao/TaskMemberDaoImpl.java

@@ -123,8 +123,9 @@ public class TaskMemberDaoImpl extends BaseDaoImpl implements ITaskMemberDao {
         hql.append(" SELECT * ");
         hql.append(" FROM task_process_summary T ");
         hql.append(" WHERE T.task_id =  " + taskid);
+        hql.append(" AND T.is_published = 1");
         hql.append(" AND T.process_date = ( ");
-        hql.append(" SELECT max (process_date) FROM task_process_summary )" );
+        hql.append(" SELECT max (process_date) FROM task_process_summary WHERE is_published = 1 )" );
         List<TaskProcessSummaryBean> l = getHibernateTpl().queryBeanBySql(hql.toString(), TaskProcessSummaryBean.class, null);
         if (CollectionUtil.isNotEmpty(l)) {
             return l.get(0);

+ 19 - 1
tc-service/tap-task/src/main/java/com/minto/app/task/dao/TaskProcessSummaryDaoImpl.java

@@ -56,6 +56,7 @@ public class TaskProcessSummaryDaoImpl extends BaseDaoImpl implements ITaskProce
     @Override
     public ListObject<TaskProcessSummaryBean> findTaskProcesssByTaskId(Long taskId, Integer start, Integer range) {
         Criterion criterion = Restrictions.eq("taskId", taskId);
+        criterion = Restrictions.and(criterion, Restrictions.eq("isPublished", 1));
         return getHibernateTpl().queryPage(TaskProcessSummaryBean.class,criterion, start, range , Order.desc("processDate"));
     }
 
@@ -80,7 +81,9 @@ public class TaskProcessSummaryDaoImpl extends BaseDaoImpl implements ITaskProce
     public List<TaskProcessSummaryBean> findTaskProcesssByTaskIds(Long[] taskIds) {
         List<TaskProcessSummaryBean> result = null;
         if(ArrayUtil.isNotEmpty(taskIds)){
-            result = getHibernateTpl().query(TaskProcessSummaryBean.class, Restrictions.in("taskId", taskIds), Order.desc("processDate"));
+            Criterion criterion = Restrictions.in("taskId", taskIds);
+            criterion = Restrictions.and(criterion, Restrictions.eq("isPublished", 1));
+            result = getHibernateTpl().query(TaskProcessSummaryBean.class, criterion, Order.desc("processDate"));
         }
         return result;
     }
@@ -119,12 +122,21 @@ public class TaskProcessSummaryDaoImpl extends BaseDaoImpl implements ITaskProce
 //                List<Long> values = (List<Long>)conditionObj.getValue();
 //                criterion = Restrictions.and(criterion, Restrictions.in(propertyName, values));
             }
+            if(conditionMap.containsKey("isPublished")){
+                Integer isPublished = ParameterUtil.getInteger(conditionMap, "isPublished");
+                if(isPublished != null){
+                    criterion = Restrictions.and(criterion, Restrictions.eq("isPublished", isPublished));
+                }
+            }
         }
         Order processDate = Order.desc("processDate");
         // 如果是查询下级留言,就采用从大到小的顺序
         if(parentId!=0L){
             processDate = Order.asc("processDate");
         }
+        if(!conditionMap.containsKey("isPublished")){
+            criterion = Restrictions.and(criterion, Restrictions.eq("isPublished", 1));
+        }
         return getHibernateTpl().queryPage(TaskProcessSummaryBean.class, criterion, start, range,processDate );
     }
 
@@ -132,6 +144,7 @@ public class TaskProcessSummaryDaoImpl extends BaseDaoImpl implements ITaskProce
 	public ListObject<TaskProcessSummaryBean> findTaskProcessBOByTaskIdAndReadDate(
 			Long taskId, java.util.Date readDate,Integer pageSize,Integer pageIndex) {
 		Criterion criterion = Restrictions.eq("taskId", taskId);
+        criterion = Restrictions.and(criterion, Restrictions.eq("isPublished", 1));
 		if(readDate != null){
 		    criterion = Restrictions.and(criterion, Restrictions.ge("processDate", readDate));
 		}
@@ -146,12 +159,14 @@ public class TaskProcessSummaryDaoImpl extends BaseDaoImpl implements ITaskProce
     @Override
     public List<TaskProcessSummaryBean> findTaskProcessByProResourceId(Long taskId , Long processResourceId)throws BusinessException{
         Criterion criterion = Restrictions.and(Restrictions.eq("taskId", taskId), Restrictions.eq("processResourceId", processResourceId));
+        criterion = Restrictions.and(criterion, Restrictions.eq("isPublished", 1));
         return getHibernateTpl().query(TaskProcessSummaryBean.class, criterion, Order.desc("processDate"));
     }
 
     @Override
     public Integer findTaskProcessCountByTaskIdAndReadDate(Long taskId, java.util.Date readDat) {
         Criterion criterion = Restrictions.eq("taskId", taskId);
+        criterion = Restrictions.and(criterion, Restrictions.eq("isPublished", 1));
         if(readDat != null) {
             criterion = Restrictions.and(criterion, Restrictions.ge("readDat", readDat));
         }
@@ -165,12 +180,14 @@ public class TaskProcessSummaryDaoImpl extends BaseDaoImpl implements ITaskProce
     @Override
     public List<TaskProcessSummaryBean> findTaskProcessByTaskIdsAndPtype(Long[] aids, Integer ptype) {
         Criterion criterion = Restrictions.and(Restrictions.in("taskId", aids), Restrictions.eq("ptype", ptype));
+        criterion = Restrictions.and(criterion, Restrictions.eq("isPublished", 1));
         return getHibernateTpl().query(TaskProcessSummaryBean.class, criterion, Order.desc("processDate"));
     }
 
     @Override
     public Integer findTaskProcessNewestCount(Long taskId, java.util.Date lastDate) {
     	  Criterion criterion = Restrictions.eq("taskId", taskId);
+        criterion = Restrictions.and(criterion, Restrictions.eq("isPublished", 1));
     	if (lastDate != null) {
 			criterion = Restrictions.and(criterion, Restrictions.ge("processDate", lastDate));
 		}
@@ -180,6 +197,7 @@ public class TaskProcessSummaryDaoImpl extends BaseDaoImpl implements ITaskProce
 	@Override
 	public List<TaskProcessSummaryBean> findTaskProcessByIds(Long[] ids, Integer[] types) {
 		Criterion c = Restrictions.and(Restrictions.in("id", ids), Restrictions.in("ptype", types));
+        c = Restrictions.and(c, Restrictions.eq("isPublished", 1));
 		return getHibernateTpl().query(TaskProcessSummaryBean.class, c, Order.desc("processDate"));
 	}
 

+ 37 - 0
tc-service/tap-task/src/main/java/com/minto/app/task/dao/TaskProcessVisibilityDaoImpl.java

@@ -0,0 +1,37 @@
+package com.minto.app.task.dao;
+
+import java.util.List;
+
+import com.minto.app.task.beans.TaskProcessVisibilityBean;
+import com.minto.core.dao.BaseDaoImpl;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Restrictions;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 应用模块名称<p>
+ * 代码描述<p>
+ *
+ * @author wany
+ * @since 2024/6/11
+ */
+@Repository("taskProcessVisibilityDao")
+public class TaskProcessVisibilityDaoImpl extends BaseDaoImpl implements ITaskProcessVisibilityDao{
+
+    @Override
+    public List<TaskProcessVisibilityBean> findListByTaskId(Long taskId){
+        return getHibernateTpl().query(TaskProcessVisibilityBean.class, Restrictions.eq("taskId", taskId),
+                Order.asc("createDate"));
+    }
+
+    @Override
+    public List<TaskProcessVisibilityBean> findListByProcessId(Long processId){
+        return getHibernateTpl().query(TaskProcessVisibilityBean.class, Restrictions.eq("processId", processId),
+                Order.asc("createDate"));
+    }
+
+    @Override
+    public void deleteByProcessId(Long processId){
+        delete(TaskProcessVisibilityBean.class,Restrictions.eq("processId", processId));
+    }
+}

+ 5 - 5
tc-service/tap-task/src/main/java/com/minto/app/task/dao/TaskSummaryDaoImpl.java

@@ -1647,7 +1647,7 @@ public class TaskSummaryDaoImpl extends BaseDaoImpl implements ITaskSummaryDao {
     public int getTaskCountByPersonIds(Long [] pids,String type,boolean isKeyProject) throws BusinessException {
         StringBuffer sb = new StringBuffer(" select count(*) from");
         sb.append(" (select DISTINCT t.* from task_summary t")
-                .append(" left join task_process_summary tps on t.id = tps.task_id ");
+                .append(" left join task_process_summary tps on t.id = tps.task_id and tps.is_published = 1 ");
         if(isKeyProject){
             sb.append(" left join task_type tt on cast(t.tasktype_id as int8)=tt.id ");
         }
@@ -1688,7 +1688,7 @@ public class TaskSummaryDaoImpl extends BaseDaoImpl implements ITaskSummaryDao {
     public ListObject<TaskSummaryBean> pagedTaskCountByPersonIds(Long [] pids,String type,boolean isKeyProject,int start, int range) throws BusinessException {
         StringBuffer sb = new StringBuffer(" select * from");
         sb.append(" (select DISTINCT t.* from task_summary t")
-                .append(" left join task_process_summary tps on t.id = tps.task_id ");
+                .append(" left join task_process_summary tps on t.id = tps.task_id and tps.is_published = 1 ");
         if(isKeyProject){
             sb.append(" left join task_type tt on cast(t.tasktype_id as int8)=tt.id ");
         }
@@ -1858,7 +1858,7 @@ public class TaskSummaryDaoImpl extends BaseDaoImpl implements ITaskSummaryDao {
     public ListObject<TaskSummaryBean> pagedTaskSummarysByTaskTypeIdAndPids(long taskTypeId, boolean isKeyProject, String type, Long[] pids, int start, int range, Map<String, Object> params) throws BusinessException {
         StringBuffer sb = new StringBuffer();
         sb.append(" select DISTINCT t.* from task_summary t ")
-                .append(" left join task_process_summary tps on t.id = tps.task_id ");
+                .append(" left join task_process_summary tps on t.id = tps.task_id and t.is_published = 1 ");
         if(isKeyProject){
             sb.append(" left join task_type tt ON CAST (t.tasktype_id AS int8) = tt.id ");
         }
@@ -1908,7 +1908,7 @@ public class TaskSummaryDaoImpl extends BaseDaoImpl implements ITaskSummaryDao {
         StringBuffer sb = new StringBuffer(" select tt.name,tt.id from ");
         sb.append(" (select t1.tasktype_id type_id from ")
                 .append(" (select DISTINCT t.* from task_summary t ")
-                .append(" left join task_process_summary tps on t.id = tps.task_id ")
+                .append(" left join task_process_summary tps on t.id = tps.task_id and tps.is_published = 1 ")
                 .append(" where exists (select * from task_member m ")
                 .append(" where m.task_id=t.id ")
                 .append(" and m.resource_type=10000003 ")
@@ -1938,7 +1938,7 @@ public class TaskSummaryDaoImpl extends BaseDaoImpl implements ITaskSummaryDao {
     public int getTaskCountByTypeIdAndPersonIds(long typeId, Long [] pids, String type,boolean isKeyProject) throws BusinessException {
         StringBuffer sb = new StringBuffer(" select count(*) from ");
         sb.append(" (select DISTINCT t.* from task_summary t ")
-                .append(" left join task_process_summary tps on t.id = tps.task_id ");
+                .append(" left join task_process_summary tps on t.id = tps.task_id and is_published = 1 ");
         if(isKeyProject){
             sb.append(" left join task_type tt ON CAST (t.tasktype_id AS int8) = tt.id ");
         }

+ 456 - 245
tc-service/tap-task/src/main/java/com/minto/app/task/manager/TaskManagerImpl.java

@@ -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();
+	}
 }

+ 6 - 0
tc-service/tap-task/src/main/java/com/minto/app/task/mapper/ITaskAnalysisMapper.xml

@@ -176,6 +176,7 @@
         from task_remind_member rm
         left join task_process_summary ps on rm.task_process_summary_id = ps.id
         where ps.id is not null
+        and ps.is_published = 1
         <if test=" param!=null and param.year!=null and param.year!='' ">
             and to_char(ps.process_date,'yyyy') = #{param.year}
         </if>
@@ -536,6 +537,7 @@
         task_summary tsummary,task_member tmember,task_process_summary s
         WHERE
         tmember.task_id = tsummary.id
+        and s.is_published = 1
         and resource_id = remidnM.department_id
         AND remidnM.task_id = tsummary.id
         AND tsummary.tstate IN (1, 2, 3, 8, 9, 11, 16, 22)
@@ -1580,6 +1582,7 @@ AND source_category = 10000002
         </if>
         <if test="type == 4">
             and s.task_id = t.id
+            AND s.is_published = 1
             AND s.id = me.task_process_summary_id
         </if>
     </select>
@@ -1728,6 +1731,7 @@ AND source_category = 10000002
         </if>
         <if test="type == 4">
             and s.task_id = t.id
+            AND s.is_published = 1
             AND s.id = me.task_process_summary_id
             AND T .tstate != 0
             and me.department_id=#{pid}
@@ -4661,6 +4665,7 @@ AND receiver_id in(#{sid}, #{rid})
         AND CAST(p.id as VARCHAR(20)) = t.tasktype_id
         AND p.can_count = 1
         AND s.task_id = t.id
+        AND s.is_published = 1
         AND s.id = me.task_process_summary_id
         )as tasksummary
         WHERE tasksummary.id = #{taskId}
@@ -4775,6 +4780,7 @@ AND receiver_id in(#{sid}, #{rid})
         WHERE M .task_id = T .id
         AND p.can_count = 1
         AND s.task_id = t.id
+        AND s.is_published = 1
         AND s.id = me.task_process_summary_id
         AND CAST(p.id as VARCHAR(20)) = t.tasktype_id
         AND T .tstate IN(1,2, 3, 8, 9, 11,16,22)

+ 1 - 3
tc-service/tap-task/src/main/java/com/minto/app/task/mapper/ITaskSummaryMapper.java

@@ -7,11 +7,9 @@ package com.minto.app.task.mapper;
 
 import com.minto.app.task.beans.ChildTaskBean;
 import com.minto.app.task.beans.ChildTaskDepartmentsBean;
-import com.minto.app.task.beans.TaskMemberAndPersonBean;
 import com.minto.app.task.beans.TaskSummaryBean;
 import com.minto.app.task.vo.*;
 import com.minto.core.mapper.IBaseMapper;
-import com.minto.app.organization.beans.OrgUnitBean;
 
 import org.apache.ibatis.annotations.Param;
 
@@ -87,7 +85,7 @@ public interface ITaskSummaryMapper extends IBaseMapper {
      */
     List<Map<String,Object>> getInstructionsCount(@Param("taskId") Long taskId);
 
-    List<Map<String,Object>> findInstructionsAndLeavingaMessageCount(@Param("taskId") Long taskId, @Param("excludedPersonIds")List<Long> excludedPersonIds);
+    List<Map<String,Object>> findInstructionsAndLeavingaMessageCount(@Param("taskId") Long taskId, @Param("excludedIds")List<Long> excludedIds);
 
     /**
      * 获取事项查看相关数据

+ 8 - 6
tc-service/tap-task/src/main/java/com/minto/app/task/mapper/ITaskSummaryMapper.xml

@@ -304,7 +304,7 @@
 
 	<!-- 获取领导批示统计 -->
 	<select id="getInstructionsCount" resultType="Map">
-		select count(*) as "count",task_id from task_process_summary where ptype = 16
+		select count(*) as "count",task_id from task_process_summary where ptype = 16 and is_published = 1
 		<if test="taskId != null">
 			and task_id = #{taskId}
 		</if>
@@ -320,10 +320,10 @@
 		<if test="taskId != null">
 			and task_id = #{taskId}
 		</if>
-		<if test="excludedPersonIds != null and excludedPersonIds.size() > 0">
-			and person_id not in
-			<foreach collection="excludedPersonIds" item="pid" open="(" close=")" separator=",">
-				#{pid}
+		<if test="excludedIds != null and excludedIds.size() > 0">
+			and id not in
+			<foreach collection="excludedIds" item="id" open="(" close=")" separator=",">
+				#{id}
 			</foreach>
 		</if>
 		<!--<if test="personId != null">
@@ -336,7 +336,7 @@
 
 
 	<select id="findLeavingaMessageCount" resultType="Map">
-		select count(*) as "count",task_id from task_process_summary where ptype = 0
+		select count(*) as "count",task_id from task_process_summary where ptype = 0 AND is_published = 1
 		<if test="taskId != null">
 			and task_id = #{taskId}
 		</if>
@@ -1325,6 +1325,7 @@
         AND tps.person_id = o.id
         AND tps.ptype = 16
         AND tps.task_id = t.id
+		AND tps.is_published = 1
 		AND t.id = M.task_id
         ORDER BY tps.process_date desc
     </select>
@@ -1694,6 +1695,7 @@
 				left join task_remind_member trm on trm.task_process_summary_id = tps.id
 				WHERE
 				s.tstate NOT IN (0, 7)
+				AND tps.is_published = 1
 				AND td.type_Of_Buckle='50001001'
 				and t.can_count=1
 				AND to_char(s.create_date, 'yyyy') = #{param.year}

+ 2 - 0
tc-service/tap-task/src/main/java/com/minto/app/tc/community/manager/CommunityManagerImpl.java

@@ -2814,6 +2814,8 @@ public class CommunityManagerImpl implements ICommunityManager, SystemInitialize
             /*if (!ArrayUtil.isEmpty(userIds) ) {
                 conditions.put("belongTo", userIds);
             }*/
+            conditions.put("showInstructionsTaskLimitScope",AppContext.removeThreadContext("showInstructionsTaskLimitScope"));
+            conditions.put("instructionsTaskLimitScopeShowIds",AppContext.removeThreadContext("instructionsTaskLimitScopeShowIds"));
             result = behManager.findByCondition(conditions, start, range);
             if(meetingFlag!=null&&String.valueOf(meetingFlag).equals("true")&&result!=null){//如果为会议模块,则屏蔽主任务的汇报待办和子任务的签收待办
                 List<BehSummaryBean> list=result.getList();

+ 4 - 2
tc-service/tap-workbrain/src/main/java/com/minto/app/workbrain/chat.sql.xml

@@ -15,10 +15,11 @@
             from task_summary a
                      left join task_process_summary b on a.id = b.task_id
                      left join task_member c on a.id = c.task_id
-            where (b.task_id, process_date) in (select task_id, max(process_date) from task_process_summary group by task_id)
+            where (b.task_id, process_date) in (select task_id, max(process_date) from task_process_summary where is_published = 1 group by task_id)
                #[ and a.title like :title]
               and c.resource_id = :resourceid
               and a.tstate in (1,2)
+              and b.is_published = 1
             union
             select distinct a.id,a.title
             from task_summary a
@@ -66,9 +67,10 @@
             from task_summary a
                      left join task_process_summary b on a.id = b.task_id
                      left join org_person p on b.person_id = p.id
-            where (b.task_id, process_date) in (select task_id, max(process_date) from task_process_summary group by task_id)
+            where (b.task_id, process_date) in (select task_id, max(process_date) from task_process_summary where is_published = 1 group by task_id)
               and a.id = :id
               and a.tstate in (1,2)
+              AND b.is_published = 1
             union all
             select distinct a.id, a.title, b.create_date, b.create_by,b.process_detail,p.pname,1 as type
             from task_summary a

+ 4 - 0
tip-api/src/main/java/com/minto/app/behavior/enums/BehaviorEnum.java

@@ -265,6 +265,10 @@ public final class BehaviorEnum {
         // ModifyContentMember(10002021, "behavior.modify.content.member", "behavior.modify.content.member.desc",BehSummaryBehCategoryEnum.Biz,"修改事项正文,必须的行为参数:belongTo:当前人的id,res:事项资源,类型为枚举ResourceTypeEnum.Task ,id为当前事项的id , ext1:正文ID , ext2:不启用, ext3:不启用"),
         /** 事项批示 */
         InstructionsTask(10002004, "behavior.instructions.task", "behavior.instructions.task.desc",BehSummaryBehCategoryEnum.Biz,"保存事项批示,包含必须的行为参数:belongTo:批示人的id,res:事项资源,类型为枚举ResourceTypeEnum.Task ,id为当前事项的id , ext1:批示的id , ext2:与操作相关的人或单位id, ext3:TaskSummaryTcategoryEnum"),
+        /**
+         * 可限制显示范围的领导批示
+         */
+        InstructionsTaskLimitScope(10002025, "behavior.instructions.temp.task", "behavior.instructions.temp.task.desc", BehSummaryBehCategoryEnum.Biz,"领导对事项的批示保存,包含必须的行为参数:belongTo:批示人的id,res:事项资源,类型为枚举ResourceTypeEnum.Task ,id为当前事项的id , ext1:批示的id , ext2:与操作相关的人或单位id, ext3:TaskSummaryTcategoryEnum"),
         /** 承办接收事项批示通知 */
         //ReceiveInstructionsTask(10002044, "behavior.receive.instructions.task.en", "behavior.receive.instructions.task",BehSummaryBehCategoryEnum.Biz,"保存事项批示,包含必须的行为参数:belongTo:批示人的id,res:事项资源,类型为枚举ResourceTypeEnum.Task ,id为当前事项的id , ext1:批示的id , ext2:不启用, ext3:TaskSummaryTcategoryEnum"),
         /** 发送任務 */

+ 3 - 1
tip-api/src/main/java/com/minto/app/behavior/manager/IBehManager.java

@@ -596,5 +596,7 @@ public interface IBehManager {
      */
     List<Map<String, Object>> findBehaviorByBehType(int behType, List<Long> ids);
 
-    void deleteByBehTypeAndExt1(Integer resType, String resId, String ext1);
+    void deleteByResTypeAndExt1(Integer resType, String resId, String ext1);
+
+    List<BehSummaryBean> findByBehTypeAndResId(Integer behType,Integer resType, String resId);
 }

+ 30 - 0
tip-api/src/main/java/com/minto/app/task/beans/TaskProcessSummaryBean.java

@@ -8,6 +8,8 @@ package com.minto.app.task.beans;
 import java.util.Date;
 
 import com.minto.app.task.enums.TaskEnum;
+import com.minto.app.task.enums.TaskProcessVisibilityScopeEnum;
+import com.minto.core.base.BaseEnum;
 import com.minto.core.po.BasePO;
 import com.minto.core.util.UUIDUtil;
 
@@ -58,6 +60,18 @@ public class TaskProcessSummaryBean extends BasePO {
 
     private Long processStageId;
 
+    /**
+     * 批示留言是否已发布,默认是
+     * @see BaseEnum.BooleanEnum
+     */
+    private Integer isPublished = BaseEnum.BooleanEnum.True.getKey();
+
+    /**
+     * 可见范围
+     * @see TaskProcessVisibilityScopeEnum
+     */
+    private String visibilityScope = TaskProcessVisibilityScopeEnum.All.getKey();
+
     public String getProcessResourceType() {
         return processResourceType;
     }
@@ -215,4 +229,20 @@ public class TaskProcessSummaryBean extends BasePO {
     public void setProcessStageId(Long processStageId) {
         this.processStageId = processStageId;
     }
+
+    public Integer getIsPublished(){
+        return isPublished;
+    }
+
+    public void setIsPublished(Integer isPublished){
+        this.isPublished = isPublished;
+    }
+
+    public String getVisibilityScope(){
+        return visibilityScope;
+    }
+
+    public void setVisibilityScope(String visibilityScope){
+        this.visibilityScope = visibilityScope;
+    }
 }

+ 49 - 0
tip-api/src/main/java/com/minto/app/task/beans/TaskProcessVisibilityBean.java

@@ -0,0 +1,49 @@
+package com.minto.app.task.beans;
+
+import java.util.Date;
+
+import com.minto.core.po.BasePO;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 应用模块名称<p>
+ * 批示留言数据的可见性<p>
+ *
+ * @author wany
+ * @since 2024/6/11
+ */
+@Setter
+@Getter
+public class TaskProcessVisibilityBean extends BasePO{
+
+    /**
+     * 任务id
+     */
+    private Long taskId;
+    /**
+     * 批示留言数据Id
+     */
+    private Long processId;
+    /**
+     * 发布人Id
+     */
+    private Long personId;
+    /**
+     * 资源类型
+     * @see com.minto.app.resource.enums.ResourceEnum.ResourceTypeEnum
+     */
+    private String resourceType;
+    /**
+     * 资源值
+     */
+    private Long resourceId;
+    /**
+     * 可见范围录入人id
+     */
+    private Long operatorId;
+    /**
+     * 创建时间
+     */
+    private Date createDate;
+}

+ 1 - 0
tip-api/src/main/java/com/minto/app/task/bo/TaskProcessBO.java

@@ -12,6 +12,7 @@ import com.minto.app.space.beans.AttachmentBean;
 import com.minto.app.task.beans.TaskProcessActionBean;
 import com.minto.app.task.beans.TaskProcessRelationBean;
 import com.minto.app.task.beans.TaskProcessSummaryBean;
+import com.minto.app.task.beans.TaskProcessVisibilityBean;
 import com.minto.app.task.enums.TaskEnum;
 import com.minto.core.util.CollectionUtil;
 

+ 38 - 0
tip-api/src/main/java/com/minto/app/task/enums/TaskProcessVisibilityScopeEnum.java

@@ -0,0 +1,38 @@
+package com.minto.app.task.enums;
+
+import java.util.Arrays;
+
+/**
+ * 应用模块名称<p>
+ * 代码描述<p>
+ *
+ * @author wany
+ * @since 2024/6/11
+ */
+public enum TaskProcessVisibilityScopeEnum{
+    None("None","不可见"),
+    All("All","全部可见"),
+    Part("Part","部分可见");
+    private String key;
+    private String name;
+    private TaskProcessVisibilityScopeEnum(String key, String name){
+        this.key = key;
+        this.name = name;
+    }
+    public String getKey() {
+        return key;
+    }
+    public String getName() {
+        return name;
+    }
+
+    public static String findNameByKey(String key){
+        return Arrays.stream(TaskProcessVisibilityScopeEnum.values()).filter(e -> e.getKey().equals(key))
+                     .map(TaskProcessVisibilityScopeEnum::getName).findFirst().orElse("");
+    }
+
+    public static TaskProcessVisibilityScopeEnum findEnumByKey(String key){
+        return Arrays.stream(TaskProcessVisibilityScopeEnum.values()).filter(e -> e.getKey().equals(key)).findFirst()
+                     .orElse(null);
+    }
+}

+ 27 - 2
tip-api/src/main/java/com/minto/app/task/manager/ITaskManager.java

@@ -3039,11 +3039,11 @@ public interface ITaskManager {
      * 获取领导批示和留言的数量
      *
      * @param taskId
-     * @param excludedPersonIds
+     * @param excludedIds
      * @return
      * @throws BusinessException
      */
-    List<Map<String,Object>> findInstructionsAndLeavingaMessageCount(Long taskId, List<Long> excludedPersonIds)throws BusinessException;
+    List<Map<String,Object>> findInstructionsAndLeavingaMessageCount(Long taskId, List<Long> excludedIds)throws BusinessException;
 
     /**
      * 获取事项查看相关数据
@@ -4667,6 +4667,31 @@ public interface ITaskManager {
      * @param resourceIds
      */
     void updateTask4Circulate(Long taskId, String[] resourceIds);
+
+    /**
+     * 根据id查找任务动态
+     * @param processId
+     */
+    Map<String,Object> findTaskProcessVisibilityInfo(Long processId);
+
+    /**
+     * 根据id更新任务动态
+     *
+     * @param processId
+     * @param visibilityScope
+     * @param resourceKeys
+     * @param pid
+     */
+    void updateTaskProcessVisibility(Long processId, String visibilityScope, String[] resourceKeys, Long pid);
+
+    /**
+     * 根据人员id,获取当前人员看的批示数据Id
+     *
+     * @param taskId
+     * @param pid
+     * @return
+     */
+    List<Long> findTaskProcessVisibilityRunTime(Long taskId, Long pid);
 }
 
 

+ 13 - 29
tip-api/src/main/java/com/minto/app/task/util/TaskMemberUtil.java

@@ -239,36 +239,20 @@ public class TaskMemberUtil {
     }
 
     /**
-     * 判断是否是流程参与人,如果是流程参与人员,不能看书记区长、区领导的批示留言数据
-     * @see  com.minto.app.task.util.TaskMemberUtil#getMemberBeansByPid
-     * @param memberBeans 当前任务成员集合
-     * @param currentMemberBeans 通过 getMemberBeansByPid方法获取到的当前人员数据
-     * @param personId 人员id
+     * 判断一个人员是否是部门的部门长、分管领导、科长、经办人
+     *
+     * @param cid
+     * @param personId
      * @return
      */
-    public static boolean isNodeManager(List<TaskMemberBean> memberBeans, List<TaskMemberBean> currentMemberBeans,
-            Long personId){
-        boolean isNodeManager = false;
-        if(CollectionUtil.isEmpty(currentMemberBeans)){
-            IOrgManager orgManager = ApplicationContextHolder.getBean(IOrgManager.class);
-            //没找到对应的成员数据,检查一下流程参与者是部门的任务成员数据。如果是部门的部门长、分管领导、科长、经办人那么认定是流程参与人员
-            isNodeManager = memberBeans.stream().filter(e ->
-               TaskEnum.TaskMemberRelTypeEnum.NodeManager.getKey() == e.getRelationType()
-               && ResourceEnum.ResourceTypeEnum.OrgDepartment.getKey() == e.getResourceType()).anyMatch(e -> {
-                   //判断当前登录人是否是这些部门的部门长、分管领导、科长、经办人
-                   List<String> codes = Lists.newArrayList();
-                   codes.add(OrgEnum.OrgRoleEnum.DepLeader.name());
-                   codes.add(OrgEnum.OrgRoleEnum.DepManager.name());
-                   codes.add("KeZhang");
-                   codes.add(OrgEnum.OrgRoleEnum.TaskManager.name());
-                   List<Long> personIds = TaskMemberAgentUtil.getDepPersonByRoleCodes(e.getResourceId(), codes);
-                   return personIds.contains(personId);
-               });
-        } else{
-            //有对应的成员,那么检查是否是
-            isNodeManager = currentMemberBeans.stream().allMatch(
-                    e -> TaskEnum.TaskMemberRelTypeEnum.NodeManager.getKey() == e.getRelationType());
-        }
-        return isNodeManager;
+    public static boolean isDepSpecifiedRole(Long cid, Long personId){
+        //判断当前登录人是否是这些部门的部门长、分管领导、科长、经办人
+        List<String> codes = Lists.newArrayList();
+        codes.add(OrgEnum.OrgRoleEnum.DepLeader.name());
+        codes.add(OrgEnum.OrgRoleEnum.DepManager.name());
+        codes.add("KeZhang");
+        codes.add(OrgEnum.OrgRoleEnum.TaskManager.name());
+        List<Long> personIds = TaskMemberAgentUtil.getDepPersonByRoleCodes(cid, codes);
+        return personIds.contains(personId);
     }
 }

+ 10 - 0
tip-api/src/main/java/com/minto/app/task/util/TaskTransverter.java

@@ -27,6 +27,7 @@ import com.minto.app.space.enums.SpaceFileType;
 import com.minto.app.task.beans.*;
 import com.minto.app.content.beans.CommonContentBean;
 import com.minto.app.content.manager.IContentManager;
+import com.minto.app.task.enums.TaskProcessVisibilityScopeEnum;
 import com.minto.app.tc.knowledge.beans.ArcSummaryBean;
 import com.minto.app.tc.knowledge.enums.KmEnum;
 import com.minto.app.tc.knowledge.manager.IKnowledgeManager;
@@ -970,6 +971,15 @@ public class TaskTransverter{
                     instance.add(Calendar.MINUTE, -30);
                     //时间小于三十分钟,批示留言可撤回
                     resultObj.put("lessThanHalfAnHour",tprocss.getProcessDate()!=null && DateUtil.compare_date(instance.getTime(),tprocss.getProcessDate()) < 0);
+                    //可见范围
+                    if(tprocss.getPtype() != null && TaskProcessTypeEnum.Instructions.getKey() == tprocss.getPtype()){
+                        List<Long> kaizhoLingDaoIds = TaskMemberAgentUtil.getAccountPersonByRoleCodes(
+                                person.getOrgAccountId(), List.of("ShujQuzhang", "QuLingDao"));
+                        resultObj.put("isKaizhouLingDao", kaizhoLingDaoIds.contains(person.getId()));
+                        resultObj.put("visibilityScope", tprocss.getVisibilityScope());
+                        resultObj.put("visibilityScopeStr",
+                                TaskProcessVisibilityScopeEnum.findNameByKey(tprocss.getVisibilityScope()));
+                    }
                 }
                 result = true;
             } else if (o instanceof CommonResourceRelationBean) {

+ 2 - 0
tip-bff/src/main/java/com/minto/app/behavior/manager/WorkDynamicManagerImpl.java

@@ -39,6 +39,7 @@ import com.minto.app.space.beans.SpaceFileBean;
 import com.minto.app.space.enums.SpaceFileType;
 import com.minto.app.space.manager.AttachmentManager;
 import com.minto.app.space.manager.ISpaceManager;
+import com.minto.app.task.beans.TaskMemberBean;
 import com.minto.app.task.beans.TaskProcessSummaryBean;
 import com.minto.app.task.beans.TaskReportBean;
 import com.minto.app.task.beans.TaskSummaryBean;
@@ -46,6 +47,7 @@ import com.minto.app.task.bo.TaskProcessBO;
 import com.minto.app.task.dto.LevMsgInfo;
 import com.minto.app.task.enums.TaskEnum;
 import com.minto.app.task.manager.ITaskManager;
+import com.minto.app.task.util.TaskMemberUtil;
 import com.minto.app.tc.community.beans.CommunityBbsBean;
 import com.minto.app.tc.community.bo.CommunityBbsBO;
 import com.minto.app.tc.community.manager.ICommunityManager;

+ 9 - 4
tip-bff/src/main/java/com/minto/bff/beh.sql.xml

@@ -9,7 +9,8 @@
         num
         FROM
         (
-        WITH RECURSIVE ss AS ( SELECT * FROM task_process_summary A WHERE A.ID = :ids UNION ALL SELECT b.* FROM task_process_summary b, ss WHERE b.parent_id = ss.ID ) SELECT
+        WITH RECURSIVE ss AS ( SELECT * FROM task_process_summary A WHERE A.ID = :ids AND A.is_published = 1
+        UNION ALL SELECT b.* FROM task_process_summary b, ss WHERE b.parent_id = ss.ID AND b.is_published = 1) SELECT
         task_id,
         COUNT ( ID ) NUM
         FROM
@@ -28,7 +29,9 @@
         num
         FROM
         (
-        WITH ss(id,task_id) AS ( SELECT a.id,a.task_id FROM task_process_summary A WHERE A.ID = :ids UNION ALL SELECT b.id,b.task_id FROM task_process_summary b, ss WHERE b.parent_id = ss.ID ) SELECT
+        WITH ss(id,task_id) AS ( SELECT a.id,a.task_id FROM task_process_summary A WHERE A.ID = :ids AND
+        A.is_published = 1
+        UNION ALL SELECT b.id,b.task_id FROM task_process_summary b, ss WHERE b.parent_id = ss.ID AND b.is_published = 1) SELECT
         task_id,
         COUNT ( ID ) NUM
         FROM
@@ -42,7 +45,8 @@
     </sql>
 
     <sql id="findTaskLevMsg">
-        WITH RECURSIVE ss AS ( SELECT * FROM task_process_summary A WHERE A.ID = :id UNION ALL SELECT b.* FROM task_process_summary b, ss WHERE b.parent_id = ss.ID )
+        WITH RECURSIVE ss AS ( SELECT * FROM task_process_summary A WHERE A.ID = :id AND A.is_published = 1
+        UNION ALL SELECT b.* FROM task_process_summary b, ss WHERE b.parent_id = ss.ID AND b.is_published = 1)
         SELECT
         *
         FROM
@@ -50,7 +54,8 @@
     </sql>
 
     <sql id="findTaskLevMsg_dm">
-        WITH ss AS ( SELECT * FROM task_process_summary A WHERE A.ID = :id UNION ALL SELECT b.* FROM task_process_summary b, ss WHERE b.parent_id = ss.ID )
+        WITH ss AS ( SELECT * FROM task_process_summary A WHERE A.ID = :id AND A.is_published = 1
+        UNION ALL SELECT b.* FROM task_process_summary b, ss WHERE b.parent_id = ss.ID AND b.is_published = 1)
         SELECT
         *
         FROM

+ 60 - 60
tip-front/src/main/java/com/minto/app/task/controller/MtTaskController.java

@@ -6,6 +6,18 @@
 package com.minto.app.task.controller;
 
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.OutputStream;
+import java.sql.SQLException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+import javax.annotation.Resource;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
@@ -27,28 +39,33 @@ import com.minto.app.dm.controller.MatrixDataController;
 import com.minto.app.dm.manager.IDmManager;
 import com.minto.app.dm.manager.IMatrixManager;
 import com.minto.app.follow.service.FollowService;
-import com.minto.app.space.manager.AttachmentManager;
-import com.minto.app.systemstate.SystemConstants;
-import com.minto.core.base.R;
-import com.minto.tip.common.util.annotation.PostOperation;
-import com.minto.tip.lock.RestLockUtil;
+import com.minto.app.integration.beans.ConfigurationIntegrationBean;
+import com.minto.app.integration.enums.IntegrateEnum;
+import com.minto.app.integration.manager.IntegrationManager;
 import com.minto.app.message.enums.MessageResourceTypeEnum;
 import com.minto.app.organization.OrgEnum.OrgRoleEnum;
-import com.minto.app.organization.beans.OrgUnitBean;
 import com.minto.app.organization.beans.OrgLevelBean;
 import com.minto.app.organization.beans.OrgPersonBean;
 import com.minto.app.organization.beans.OrgRoleBean;
+import com.minto.app.organization.beans.OrgUnitBean;
 import com.minto.app.organization.manager.DepartmentManager;
 import com.minto.app.organization.manager.IOrgManager;
 import com.minto.app.organization.util.OrgUtil;
-import com.minto.app.resource.bo.CommonResourceRelationBO;
 import com.minto.app.resource.beans.CommonResourceRelationBean;
+import com.minto.app.resource.bo.CommonResourceRelationBO;
 import com.minto.app.resource.bo.IResource;
 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.CommonRelationUtil;
+import com.minto.app.space.beans.SpaceFileBean;
+import com.minto.app.space.bo.SpaceFileBO;
+import com.minto.app.space.controller.SpaceFileController;
+import com.minto.app.space.manager.AttachmentManager;
+import com.minto.app.space.manager.ISpaceManager;
+import com.minto.app.space.util.SpaceFileUtil;
+import com.minto.app.systemstate.SystemConstants;
 import com.minto.app.systemstate.beans.SystemConfigBean;
 import com.minto.app.systemstate.manager.ISystemStateManager;
 import com.minto.app.task.TaskConstants;
@@ -64,35 +81,31 @@ import com.minto.app.task.manager.*;
 import com.minto.app.task.manager.plugin.MenuPluginParam;
 import com.minto.app.task.util.*;
 import com.minto.app.task.vo.ViewTaskVo;
-import com.minto.tip.affair.enums.AffairEnum;
-import com.minto.tip.affair.manager.AffairManager;
-import com.minto.app.integration.beans.ConfigurationIntegrationBean;
-import com.minto.app.integration.enums.IntegrateEnum;
-import com.minto.app.integration.manager.IntegrationManager;
 import com.minto.app.tc.knowledge.beans.ArcSummaryBean;
 import com.minto.app.tc.knowledge.enums.KmEnum;
 import com.minto.app.tc.knowledge.enums.KmEnum.ArcSummaryTypeEnum;
 import com.minto.app.tc.knowledge.manager.IKnowledgeManager;
-import com.minto.app.space.bo.SpaceFileBO;
-import com.minto.app.space.beans.SpaceFileBean;
-import com.minto.app.space.controller.SpaceFileController;
-import com.minto.app.space.manager.ISpaceManager;
-import com.minto.app.space.util.SpaceFileUtil;
-import com.minto.app.tipenum.po.TipEnumBean;
 import com.minto.app.tipenum.manager.TipEnumManager;
+import com.minto.app.tipenum.po.TipEnumBean;
 import com.minto.app.workflow.beans.NodeBO;
 import com.minto.app.workflow.beans.ProcessBO;
 import com.minto.core.base.BaseEnum;
 import com.minto.core.base.ListObject;
+import com.minto.core.base.R;
 import com.minto.core.common.AppContext;
 import com.minto.core.common.SystemEnvironment;
 import com.minto.core.constants.BaseConstants;
 import com.minto.core.controller.BaseController;
+import com.minto.core.po.BasePO;
 import com.minto.core.util.*;
 import com.minto.core.util.SimpleObjectEncoder.Translation;
 import com.minto.core.util.concurrent.ConjunctionTask;
+import com.minto.tip.affair.enums.AffairEnum;
+import com.minto.tip.affair.manager.AffairManager;
 import com.minto.tip.common.authenticate.bo.User;
 import com.minto.tip.common.exceptions.BusinessException;
+import com.minto.tip.common.util.annotation.PostOperation;
+import com.minto.tip.lock.RestLockUtil;
 import com.minto.tip.organization.enums.BusinessCode;
 import com.minto.tip.organization.service.BusinessService;
 import org.apache.commons.lang3.StringUtils;
@@ -110,19 +123,6 @@ import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
 
-import javax.annotation.Resource;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.OutputStream;
-import java.sql.SQLException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.stream.Collectors;
-
 import static com.minto.app.task.enums.TaskEnum.TaskMemberRelTypeEnum.TaskLeadUnit;
 
 @Controller
@@ -1644,16 +1644,14 @@ public class MtTaskController extends BaseController {
 
 			//检查如果是流程参与人员,不能看书记区长、区领导的批示留言数据
 			List<TaskMemberBean> taskMemberBeans = taskManager.findTaskMembersByTaskId(id);
-			final List<TaskMemberBean> currentMemberBeans = TaskMemberUtil.getMemberBeansByPid(taskMemberBeans, userId);
-			List<Long> shujQuzhangQuLingDaoPersonIds = null;
-			if(!TaskKaizhouUtil.isShujiQuZhangQuLingDao()){
-				isNodeManager = TaskMemberUtil.isNodeManager(taskMemberBeans, currentMemberBeans, userId);
-				if(isNodeManager){
-					shujQuzhangQuLingDaoPersonIds = TaskKaizhouUtil.findShuJiQuZhangQuLingDaoPersonIds();
-				}
-			}
+			List<TaskMemberBean> currentMemberBeans = TaskMemberUtil.getMemberBeansByPid(taskMemberBeans, userId);
+			Object[] obj = TaskKaizhouUtil.findShowKaiZhouLeaderPiShiBehSummarys(id, taskMemberBeans,
+					currentMemberBeans, userId);
+			List<BehSummaryBean> showList = (List<BehSummaryBean>)obj[0];
+			List<BehSummaryBean> notShowList = (List<BehSummaryBean>)obj[1];
             // 获得该事项的查看次数以及批示次数
-			List<Map<String, Object>> maps = taskManager.findInstructionsAndLeavingaMessageCount(id, shujQuzhangQuLingDaoPersonIds);
+			List<Map<String, Object>> maps = taskManager.findInstructionsAndLeavingaMessageCount(id,
+					notShowList.stream().map(e -> Long.valueOf(e.getExt1())).toList());
             List<Map<String, Object>> instructionsCount = maps.stream().filter(map -> {
 				Integer ptype = (Integer) map.get("ptype");
 				boolean flag = TaskProcessTypeEnum.Instructions.getKey()==ptype || TaskProcessTypeEnum.ProgressReport.getKey() == ptype;
@@ -1676,11 +1674,11 @@ public class MtTaskController extends BaseController {
 			}
 
 			//model.put("instructionsCount",instructionsCount.size() == 0 ? "0" : String.valueOf(instructionsCount.get(0).get("count")));
-				model.put("instructionsCount", instructAndMsg);
+			model.put("instructionsCount", instructAndMsg);
             model.put("leavingaMessageCount",LeavingaMessageCount.size() == 0 ? "0" : String.valueOf(LeavingaMessageCount.get(0).get("count")));
-			AppContext.putThreadContext("notShowSJQZQLDpishi", shujQuzhangQuLingDaoPersonIds);
+			AppContext.putThreadContext("showInstructionsTaskLimitScope", true);
+			AppContext.putThreadContext("instructionsTaskLimitScopeShowIds",showList.stream().map(BehSummaryBean::getId).toList());
 			model.put("allTask",taskManager.countTaskProcess("-1","","",-1,-1,"","",cid,id,personId));
-
             //查询事项的类型是否允许显示汇报进度
             ITaskByTypeManager typeManager = AppContext.getBean(ITaskByTypeManager.class);
             model.put("taskTypeName",taskTypeBean.getName());
@@ -2454,6 +2452,9 @@ public class MtTaskController extends BaseController {
 			log.error(ExceptionUtil.printExceptionStackTrace(e));
 			RespUtil.rendHtml(response, "数据加载失败");
 			return null;
+		} finally{
+			AppContext.removeThreadContext("showInstructionsTaskLimitScope");
+			AppContext.removeThreadContext("instructionsTaskLimitScopeShowIds");
 		}
 	}
 
@@ -6903,32 +6904,31 @@ public class MtTaskController extends BaseController {
 			Long userId = user.getId();
 
 			Long personId = AppContext.currentUserId();
-			ITaskManager manager = AppContext.getBean(ITaskManager.class);
-			List<ViewTaskVo> viewTaskVos = manager.findViewTaskVos(String.valueOf(id), BehaviorEnum.BehSummaryBehTypeEnum.ViewTask.getKey());
+			List<ViewTaskVo> viewTaskVos = taskManager.findViewTaskVos(String.valueOf(id), BehaviorEnum.BehSummaryBehTypeEnum.ViewTask.getKey());
 			//			List<Map<String, Object>> instructionsCount = manager.findInstructionsCount(id);
-			//查批示和留言
-			List<TaskMemberBean> taskMemberBeans = taskManager.findTaskMembersByTaskId(id);
-			final List<TaskMemberBean> currentMemberBeans = TaskMemberUtil.getMemberBeansByPid(taskMemberBeans, userId);
-			List<Long> shujQuzhangQuLingDaoPersonIds = null;
-			if(!TaskKaizhouUtil.isShujiQuZhangQuLingDao()){
-				boolean isNodeManager = TaskMemberUtil.isNodeManager(taskMemberBeans, currentMemberBeans, userId);
-				if(isNodeManager){
-					shujQuzhangQuLingDaoPersonIds = TaskKaizhouUtil.findShuJiQuZhangQuLingDaoPersonIds();
-				}
-			}
-
-			List<Map<String, Object>> instructionsCount = manager.findInstructionsAndLeavingaMessageCount(id,
-					shujQuzhangQuLingDaoPersonIds);
-
 			modelMap.put("viewCount",viewTaskVos.size());
 			//modelMap.put("allTask",manager.countTaskProcessSummaryByTaskId(id));
-			AppContext.putThreadContext("notShowSJQZQLDpishi", shujQuzhangQuLingDaoPersonIds);
+			//查批示和留言
+			List<TaskMemberBean> taskMemberBeans = taskManager.findTaskMembersByTaskId(id);
+			List<TaskMemberBean> currentMemberBeans = TaskMemberUtil.getMemberBeansByPid(taskMemberBeans, userId);
+			Object[] obj = TaskKaizhouUtil.findShowKaiZhouLeaderPiShiBehSummarys(id, taskMemberBeans,
+					currentMemberBeans, userId);
+			List<BehSummaryBean> showList = (List<BehSummaryBean>)obj[0];
+			List<BehSummaryBean> notShowList = (List<BehSummaryBean>)obj[1];
+			List<Map<String, Object>> instructionsCount = taskManager.findInstructionsAndLeavingaMessageCount(id,
+					notShowList.stream().map(e->Long.valueOf(e.getExt1())).toList());
+			//可以查询区长书记、区领导批示留言数据的一个标识
+			AppContext.putThreadContext("showInstructionsTaskLimitScope", true);
+			AppContext.putThreadContext("instructionsTaskLimitScopeShowIds",showList.stream().map(BehSummaryBean::getId).toList());
 			modelMap.put("allTask",taskManager.countTaskProcess("-1","","",-1,-1,"","",cid,id,personId));
 			modelMap.put("instructionsCount",instructionsCount.size() == 0 ? "0" : String.valueOf(instructionsCount.get(0).get("count")));
 			RespUtil.rendJson(response, modelMap);
 		} catch (BusinessException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
+		} finally{
+			AppContext.removeThreadContext("showInstructionsTaskLimitScope");
+			AppContext.removeThreadContext("instructionsTaskLimitScopeShowIds");
 		}
 		return null;
 	}

+ 31 - 8
tip-front/src/main/java/com/minto/app/task/controller/TaskByTypeController.java

@@ -7811,6 +7811,21 @@ public class TaskByTypeController extends BaseController{
                 var taskTypeBeanByTaskId = taskManager.findTaskTypeBeanByTaskId(taskId);
             }
             map.put("meetingFlag",meetingFlag);
+            Integer behType = ReqUtil.getInt(request, "behType");
+            //开州领导批示的调整
+            if(behType==null || BehaviorEnum.BehSummaryBehTypeEnum.InstructionsTask.getKey() == behType){
+                Long userId = AppContext.currentUserId();
+                List<TaskMemberBean> taskMemberBeans = taskManager.findTaskMembersByTaskId(taskId);
+                List<TaskMemberBean> currentMemberBeans = TaskMemberUtil.getMemberBeansByPid(taskMemberBeans,
+                        userId);
+                Object[] obj = TaskKaizhouUtil.findShowKaiZhouLeaderPiShiBehSummarys(taskId, taskMemberBeans,
+                        currentMemberBeans, userId);
+                List<BehSummaryBean> showList = (List<BehSummaryBean>)obj[0];
+                List<BehSummaryBean> notShowList = (List<BehSummaryBean>)obj[1];
+                AppContext.putThreadContext("showInstructionsTaskLimitScope", true);
+                AppContext.putThreadContext("instructionsTaskLimitScopeShowIds",
+                        showList.stream().map(BehSummaryBean::getId).toList());
+            }
             Map<String,Object> behMap = communityManager.findByUsers(map, start, pageSize);
             result.put("log",behMap);
             PageUtil.setPageCount(request, Integer.valueOf((int)behMap.get("count")));
@@ -7818,6 +7833,9 @@ public class TaskByTypeController extends BaseController{
             log.error(ExceptionUtil.printExceptionStackTrace(e));
             result.put("state","error");
             result.put("message", "获取日志失败,请稍后重试");
+        } finally{
+            AppContext.removeThreadContext("showInstructionsTaskLimitScope");
+            AppContext.removeThreadContext("instructionsTaskLimitScopeShowIds");
         }
         //  RespUtil.returnResult(request,response,result);
         ModelAndView mv=null;
@@ -8055,14 +8073,15 @@ public class TaskByTypeController extends BaseController{
                     //大角色 领导 by zhangyu 2018-10-18
                     Boolean isLeader = TaskByTypeUtil.isLeader(pid, cid);
                     model.put("isLeader",isLeader || isSuperviseBoss);
-                    if(!TaskKaizhouUtil.isShujiQuZhangQuLingDao()){
-                        //检查如果是流程参与人员,不能看书记区长、区领导的批示留言数据
-                        boolean isNodeManager = TaskMemberUtil.isNodeManager(taskMemberBeans, currentMemberBeans, pid);
-                        if(isNodeManager){
-                            //找到所有的区长书记、区领导人员,不查询这些人员的数据
-                            AppContext.putThreadContext("notShowSJQZQLDpishi", TaskKaizhouUtil.findShuJiQuZhangQuLingDaoPersonIds());
-                        }
-                    }
+
+                    //督办人员可以设置区长书记、区领导批示留言公开范围
+                    model.put("isSupervise", TaskKaizhouUtil.isSupervise(taskMemberBeans, pid));
+                    Object[] objectArray = TaskKaizhouUtil.findShowKaiZhouLeaderPiShiBehSummarys(taskId,
+                            taskMemberBeans, currentMemberBeans, pid);
+                    List<BehSummaryBean> showList = (List<BehSummaryBean>)objectArray[0];
+                    List<BehSummaryBean> notShowList = (List<BehSummaryBean>)objectArray[1];
+                    AppContext.putThreadContext("showInstructionsTaskLimitScope", true);
+                    AppContext.putThreadContext("instructionsTaskLimitScopeShowIds",showList.stream().map(BehSummaryBean::getId).toList());
 
                     // 查询动态
                     ListObject result = null;
@@ -8233,6 +8252,7 @@ public class TaskByTypeController extends BaseController{
                     model.put("list", list2);
                     model.put("type",(isLeader || isSuperviseBoss)?TaskEnum.TaskProcessTypeEnum.Instructions.getKey():TaskEnum.TaskProcessTypeEnum.CommonOpinion.getKey());
                     model.put("count", result.getCount());
+
                     PageUtil.setPageCount(request, count);
                 }
             });
@@ -8461,6 +8481,9 @@ public class TaskByTypeController extends BaseController{
             log.error(ExceptionUtil.printExceptionStackTrace(e));
             RespUtil.rendHtml(response, "数据加载失败");
             return null;
+        } finally{
+            AppContext.removeThreadContext("showInstructionsTaskLimitScope");
+            AppContext.removeThreadContext("instructionsTaskLimitScopeShowIds");
         }
         return mv;
     }

+ 60 - 16
tip-front/src/main/java/com/minto/app/task/controller/TaskController.java

@@ -83,6 +83,7 @@ import com.minto.app.task.enums.CategoryEnum;
 import com.minto.app.task.enums.TaskEnum;
 import com.minto.app.task.enums.TaskEnum.*;
 import com.minto.app.task.enums.TaskFromEnum;
+import com.minto.app.task.enums.TaskProcessVisibilityScopeEnum;
 import com.minto.app.task.manager.*;
 import com.minto.app.task.service.TaskService;
 import com.minto.app.task.sms.SmsEnum;
@@ -1294,7 +1295,49 @@ public class TaskController extends BaseController {
         try{
             Long itemId = ReqUtil.getLong(request, "itemId");
             Long pid = AppContext.getCurrentUser().getId();
-            taskManager.deleteTaskProcess(itemId,pid);
+            taskManager.deleteTaskProcess(itemId, pid);
+            result.put("state", "success");
+        } catch(Exception e){
+            result.put("state", "error");
+            result.put("message", e.getMessage());
+            log.error(e.getMessage(), e);
+        } finally{
+            RespUtil.rendJson(response, result);
+        }
+    }
+
+    @RequestMapping(value = "/task/{id}/bbs/", method = RequestMethod.GET, params = {"m=taskProcessVisibilityInfo"})
+    public ModelAndView getTaskProcessVisibilityInfo(@PathVariable("id") Long id, HttpServletRequest request,
+            HttpServletResponse response) throws Exception{
+        Map<String, Object> result = new HashMap<>();
+        ModelAndView m = new ModelAndView();
+        //todo
+        m.setViewName("/tc_suite/task/taskProcessVisibility.jsp");
+        try{
+            Long itemId = ReqUtil.getLong(request, "itemId");
+            Long pid = AppContext.getCurrentUser().getId();
+            result.put("taskId",id);
+            result.put("itemId",itemId);
+            result.putAll(taskManager.findTaskProcessVisibilityInfo(itemId));
+            result.put("state", "success");
+        } catch(Exception e){
+            result.put("state", "error");
+            result.put("message", e.getMessage());
+            log.error(e.getMessage(), e);
+        }
+        m.addAllObjects(result);
+        return m;
+    }
+    @RequestMapping(value = "/task/{id}/bbs/", method = RequestMethod.POST, params = {"m=taskProcessVisibility"})
+    public void updateTaskProcessVisibility(@PathVariable("id") Long taskId, HttpServletRequest request,
+            HttpServletResponse response) throws Exception{
+        Map<String, Object> result = new HashMap<>();
+        try{
+            Long itemId = ReqUtil.getLong(request, "itemId");
+            String visibilityScope = ReqUtil.getString(request, "visibilityScope");
+            String[] resourceKeyArray = ReqUtil.getArray(request, "resourceKeys[]");
+            Long pid = AppContext.getCurrentUser().getId();
+            taskManager.updateTaskProcessVisibility(itemId, visibilityScope, resourceKeyArray, pid);
             result.put("state", "success");
         } catch(Exception e){
             result.put("state", "error");
@@ -3462,24 +3505,21 @@ public class TaskController extends BaseController {
         //汇报信息id
         Long reportId = ReqUtil.getLong(request, "reportId", 0L);
 
-
         String[] attachments = ReqUtil.getArray(request, "attachment");
         String[] rels = ReqUtil.getArray(request, "relResource");
         Boolean isHide = ReqUtil.getBoolean(request, "hideReplay", false);
         Integer ptype = ReqUtil.getInt(request, "type", tp);
-        String processTypeName = "留言";
-        boolean flag = false;
-        if(ptype == TaskEnum.TaskProcessTypeEnum.Instructions.getKey()){
-            processTypeName = "批示";
-            flag = true;
-        }
+
+        //判断是否是领导批示
+        boolean flag = ptype == TaskEnum.TaskProcessTypeEnum.Instructions.getKey();
+        String processTypeName = flag ? "批示" : "留言";
         try {
             Long personId = AppContext.currentUserId();
             TaskProcessBO processBO = new TaskProcessBO();
             CommonResourceRelationBO bo = new CommonResourceRelationBO(AppContext.currentLoginAccount(), AppContext.currentLoginCorporation());
+            //构建TaskProcessSummaryBean对象
             TaskProcessSummaryBean processBean = new TaskProcessSummaryBean();
             Long processId = UUIDUtil.UUIDAbsLong();
-            result.put("processId", processId);
             processBean.setId(processId);
             processBean.setTaskId(Long.parseLong(id));
             processBean.setOpinion(defaultContent + opinion);
@@ -3515,6 +3555,12 @@ public class TaskController extends BaseController {
                 }
 
             }
+            //区领导、区长书记发布的批示留言,先不发布
+            boolean isKaizhouLeader = TaskKaizhouUtil.isShujiQuZhangQuLingDao();
+            if(0L == processBean.getParentId() && flag && isKaizhouLeader){
+                processBean.setIsPublished(BaseEnum.BooleanEnum.False.getKey());
+                processBean.setVisibilityScope(TaskProcessVisibilityScopeEnum.None.getKey());
+            }
             processBO.setProcessBean(processBean);
             bo.setResource(ResourceEnum.ResourceTypeEnum.Task.getKey(), Long.valueOf(id), new Long[] { processBean.getId() });
             boolean isAddResource = false;
@@ -3587,8 +3633,8 @@ public class TaskController extends BaseController {
                      *@lastdate : 2020/1/9
                      */
 
-                    IResourceManager resourceManager = AppContext.getBean(IResourceManager.class);
-                    IColManager colManager = AppContext.getBean(IColManager.class);
+                    //IResourceManager resourceManager = AppContext.getBean(IResourceManager.class);
+                    //IColManager colManager = AppContext.getBean(IColManager.class);
                       //判断是否已经生成该事项的领导批交办数据
                     //Criterion cr=Restrictions.eq("sourceType",ResourceEnum.ResourceTypeEnum.Task.getKey());
                     //cr=Restrictions.and(cr,Restrictions.eq("targetType",targetType));
@@ -3655,6 +3701,8 @@ public class TaskController extends BaseController {
                     }
                 }
             }
+            //构建返回数据
+            result.put("processId", processId);
             result.put("createTime", DateUtil.getCalendarData(processBean.getProcessDate()));
             result.put("createAllTime", DateUtil.getDate(processBean.getProcessDate(), "yyyy-MM-dd HH:mm"));
             result.put("option", StringUtil.convert2HtmlStr(opinion));
@@ -3675,11 +3723,7 @@ public class TaskController extends BaseController {
                 }
             });
             result.put("rels", relObj);
-            if (StringUtil.isNotEmpty(parentId.toString())) {
-                result.put("parentId", parentId);
-            } else {
-                result.put("parentId", null);
-            }
+            result.put("parentId", StringUtil.isNotEmpty(parentId.toString()) ? parentId : null);
             result.put("state", "success");
             result.put("message", "发布"+processTypeName+"成功!");
             taskManager.addTaskAttention(summ.getCreatorId(), AppContext.currentLoginCorporation(), personId, Long.parseLong(id), opinion, "update");

+ 101 - 2
tip-front/src/main/java/com/minto/app/task/util/TaskKaizhouUtil.java

@@ -1,8 +1,20 @@
 package com.minto.app.task.util;
 
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
+import com.minto.app.behavior.beans.BehSummaryBean;
+import com.minto.app.behavior.enums.BehaviorEnum;
+import com.minto.app.behavior.manager.IBehManager;
+import com.minto.app.organization.manager.IOrgManager;
+import com.minto.app.resource.enums.ResourceEnum;
+import com.minto.app.task.beans.TaskMemberBean;
+import com.minto.app.task.enums.TaskEnum;
+import com.minto.app.task.manager.ITaskManager;
 import com.minto.core.common.AppContext;
+import com.minto.core.util.CollectionUtil;
+import com.minto.tip.common.exceptions.BusinessException;
+import com.minto.tip.common.util.ApplicationContextHolder;
 
 /**
  * 应用模块名称<p>
@@ -13,9 +25,11 @@ import com.minto.core.common.AppContext;
  */
 public final class TaskKaizhouUtil{
     private static final String SHUJQUZHANG_ROLE_CODE = "ShujQuzhang";
-    private static final String QULINGDAO_ROLE_CODE = "QuLingDao";
+    private static final String QULINGDAO_ROLE_CODE   = "QuLingDao";
+
     /**
      * 当前登录人是否是书记、区长、区领导角色
+     *
      * @return
      */
     public static boolean isShujiQuZhangQuLingDao(){
@@ -24,10 +38,95 @@ public final class TaskKaizhouUtil{
 
     /**
      * 查找书记、区长、区领导角色绑定的人员id
+     *
      * @return
      */
     public static List<Long> findShuJiQuZhangQuLingDaoPersonIds(){
         return TaskMemberAgentUtil.getAccountPersonByRoleCodes(AppContext.currentLoginAccount(),
                 List.of(SHUJQUZHANG_ROLE_CODE, QULINGDAO_ROLE_CODE));
     }
+
+    /**
+     * 判断是否是流程参与人,如果是流程参与人员,不能看书记区长、区领导的批示留言数据
+     *
+     * @param memberBeans
+     *         当前任务成员集合
+     * @param currentMemberBeans
+     *         通过 getMemberBeansByPid方法获取到的当前人员数据
+     * @param personId
+     *         人员id
+     * @return
+     * @see com.minto.app.task.util.TaskMemberUtil#getMemberBeansByPid
+     */
+    public static boolean isNodeManager(List<TaskMemberBean> memberBeans, List<TaskMemberBean> currentMemberBeans,
+            Long personId){
+        boolean isNodeManager = false;
+        if(CollectionUtil.isEmpty(currentMemberBeans)){
+            IOrgManager orgManager = ApplicationContextHolder.getBean(IOrgManager.class);
+            //没找到对应的成员数据,检查一下流程参与者是部门的任务成员数据。如果是部门的部门长、分管领导、科长、经办人那么认定是流程参与人员
+            isNodeManager = memberBeans.stream().filter(e ->
+                                               TaskEnum.TaskMemberRelTypeEnum.NodeManager.getKey() == e.getRelationType()
+                                                       && ResourceEnum.ResourceTypeEnum.OrgDepartment.getKey() == e.getResourceType())
+                                       .anyMatch(e -> TaskMemberUtil.isDepSpecifiedRole(e.getResourceId(), personId));
+        } else{
+            //有对应的成员,那么检查是否是
+            isNodeManager = currentMemberBeans.stream().allMatch(
+                    e -> TaskEnum.TaskMemberRelTypeEnum.NodeManager.getKey() == e.getRelationType());
+        }
+        return isNodeManager;
+    }
+
+
+    public static Object[] findShowKaiZhouLeaderPiShiBehSummarys(Long taskId, List<TaskMemberBean> taskMemberBeans,
+            List<TaskMemberBean> currentMemberBeans, Long userId){
+        IBehManager behManager = AppContext.getBean(IBehManager.class);
+        List<BehSummaryBean> list = behManager.findByBehTypeAndResId(
+                BehaviorEnum.BehSummaryBehTypeEnum.InstructionsTaskLimitScope.getKey(),
+                ResourceEnum.ResourceTypeEnum.Task.getKey(), String.valueOf(taskId));
+        List<BehSummaryBean> showList = new ArrayList<>();
+        List<BehSummaryBean> notShowList = new ArrayList<>();
+        if(isSupervise(taskMemberBeans, userId)){
+            //督办人员看全部区长书记、区领导批示
+            showList.addAll(list);
+        } else{
+            Set<Long> showIds = new HashSet<>();
+            //优先级1:区长书记、区领导可以看自己的批示留言数据
+            if(TaskKaizhouUtil.isShujiQuZhangQuLingDao()){
+                showIds.addAll(list.stream().filter(e -> userId.equals(e.getBelongToResId())).map(BehSummaryBean::getId)
+                                   .toList());
+            }
+            //优先级2:根据公布范围设置可以看的区长书记、区领导发布的批示Id
+            ITaskManager taskManager = AppContext.getBean(ITaskManager.class);
+            List<Long> processIds = taskManager.findTaskProcessVisibilityRunTime(taskId, userId);
+            if(CollectionUtil.isNotEmpty(processIds)){
+                List<String> ext1Strs = processIds.stream().map(String::valueOf).toList();
+                showIds.addAll(
+                        list.stream().filter(e -> ext1Strs.contains(e.getExt1())).map(BehSummaryBean::getId).toList());
+            }
+            //优先级3:流程参与人员不能看区长书记、区领导批示留言数据
+            if(TaskKaizhouUtil.isNodeManager(taskMemberBeans, currentMemberBeans, userId)){
+                List<Long> leaderPersonIds = TaskKaizhouUtil.findShuJiQuZhangQuLingDaoPersonIds();
+                showIds.addAll(list.stream().filter(e -> !(
+                                           ResourceEnum.ResourceTypeEnum.OrgPerson.getKey() == e.getBelongToResType()
+                                                   && leaderPersonIds.contains(e.getBelongToResId()))).map(BehSummaryBean::getId)
+                                   .toList());
+            }
+            Map<Boolean, List<BehSummaryBean>> collect = list.stream().collect(
+                    Collectors.partitioningBy(e -> showIds.contains(e.getId())));
+            showList.addAll(collect.get(Boolean.TRUE));
+            notShowList.addAll(collect.get(Boolean.FALSE));
+        }
+        return new Object[]{showList, notShowList};
+    }
+    public static boolean isSupervise(List<TaskMemberBean> memberBeans,Long pid) throws BusinessException{
+        boolean isManager = false;
+        List<TaskMemberBean> taskMemberBeans = TaskMemberUtil.getMemberBeansByPid(memberBeans,pid);
+        for (TaskMemberBean member : taskMemberBeans) {
+            if ((member.getRelationType().intValue() == TaskEnum.TaskMemberRelTypeEnum.Supervise.getKey())) {
+                isManager = true;
+                break;
+            }
+        }
+        return isManager;
+    }
 }

+ 1 - 0
tip-front/src/main/webapp/apps_res/common/js/workDynamicCommon.js

@@ -63,6 +63,7 @@ function openDifferentBeh(resType, resId, title,behType,ext,params) {
         case 20002016:
         case 10002020:
         case 10002024:
+        case 10002025:
             //任务分派
         case 20002018://上报计划
         case 20002023:

+ 178 - 0
tip-front/src/main/webapp/tc_suite/task/taskProcessVisibility.jsp

@@ -0,0 +1,178 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+<%@ taglib prefix="tc" uri="http://www.mingto.net/tip" %>
+<%@ page isELIgnored="false" %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
+<head>
+    <title>公开设置</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+    <meta http-equiv="X-UA-Compatible" content="IE=11;IE=10;IE=9; IE=8; IE=7; IE=EDGE,chrome=1"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+    <style type="text/css">
+        body {
+            font-size: 14px;
+        }
+
+        .list-item {
+            display: flex;
+            align-items: center;
+            padding: 10px;
+            cursor: pointer;
+        }
+
+        .item-content {
+            flex: 1;
+            display: flex;
+            flex-direction: column;
+            cursor: pointer;
+        }
+
+        .title {
+            color: #333;
+            margin-bottom: 4px;
+        }
+
+        .subtitle {
+            color: #999;
+        }
+
+        input[type='radio'] {
+            -webkit-appearance: none;
+            -moz-appearance: none;
+            appearance: none;
+            border: 2px solid #409eff;
+            width: 16px;
+            height: 16px;
+            border-radius: 50%;
+            margin-right: 10px;
+            position: relative;
+            top: 2px;
+            cursor: pointer;
+        }
+
+        input[type='radio']:checked {
+            border-width: 5px;
+        }
+
+        .arrow {
+            border: solid #aaa;
+            border-width: 0 2px 2px 0;
+            display: inline-block;
+            padding: 3px;
+            transform: rotate(-45deg);
+        }
+    </style>
+</head>
+<body>
+<div class="list-item">
+    <input type="radio" name="option" id="None"
+           <c:if test="${visibilityScope eq 'None' }">checked</c:if> onchange="resetParam(this)"/>
+    <label for="None" class="item-content">
+        <div class="title"><span>不公开</span></div>
+        <div class="subtitle"><span>仅自己可见</span></div>
+    </label>
+</div>
+<div class="list-item">
+    <input type="radio" name="option" id="All"
+           <c:if test="${visibilityScope eq 'All' }">checked</c:if> onchange="resetParam(this)"/>
+    <label for="All" class="item-content">
+        <div class="title"><span>全部公开</span></div>
+        <div class="subtitle"><span>该任务所有相关人员/部门查看</span></div>
+    </label>
+</div>
+<div class="list-item">
+    <input type="radio" name="option" id="Part"
+           <c:if test="${visibilityScope eq 'Part' }">checked</c:if> onclick="choosePerson(this)"/>
+    <label for="Part" class="item-content">
+        <div class="title"><span>部分公开</span></div>
+        <div class="subtitle"><span>该任务下的相关人员/部门选择人员/部门查看</span></div>
+    </label>
+    <div class="arrow"></div>
+</div>
+<%--<div class="list-item">--%>
+<%--    <input type="radio" name="option" id="item4"/>--%>
+<%--    <label for="item4" class="item-content">--%>
+<%--        <div class="title"><span>其他单位查看</span></div>--%>
+<%--        <div class="subtitle"><span>选择不是该任务相关联的单位/人员</span></div>--%>
+<%--    </label>--%>
+<%--    <div class="arrow"></div>--%>
+<%--</div>--%>
+</body>
+<script type="text/javascript" src="${path}/tc_ttp/common/jquery.min.js"></script>
+<script type="text/javascript" src="${path}/tc_ttp/common/tc.js"></script>
+<script type="text/javascript" src="${path}/tc_tap/choosePerson/js/choosePersonConfig.js"></script>
+<script type="text/javascript" src="${path}/tc_ttp/lhgdialog4.2.0/lhgdialog.js"></script>
+<script type="text/javascript" src="${path}/tc_ttp/jquery.percentageloader/js/jquery.percentageloader-0.1.min.js"></script>
+<script type="text/javascript" src="${path}/tc_ttp/jPlayer/dist/jplayer/jquery.jplayer.js"></script>
+<script type="text/javascript" src="${path}/common/mCustomScrollbar/js/jquery.mCustomScrollbar.concat.min.js"></script>
+<script type="text/javascript">
+    var param = {
+        taskId: '${taskId}',
+        itemId: '${itemId}',
+        visibilityScope: '${visibilityScope}',
+        resourceKeys: ${resourceKeys},
+    }
+
+    function choosePerson(obj) {
+        var orgInitChooseDatas = [];
+        var visibilityScope = $(obj).attr("id");
+        if (visibilityScope == param.visibilityScope) {
+            orgInitChooseDatas = param.resourceKeys;
+        }
+        var config = {
+            title: "请选择",
+            chooseModule: "ChooseInAll",
+            orgOrgUnitRange: ["OrgDepartment", "OrgTeam", "OrgPost", "OrgLevel",
+                "OrgRole", "RelationPerson", "OrgOutPerson", "MyAttention"],
+            orgChooseDataType: ["10000002", "10000003"],
+            orgInitChooseDatas: orgInitChooseDatas,
+            orgInitDatas:[],//初始化待选择的数据
+            orgCannotChooseData:[],//不允许选择的数据
+            orgChooseCount: 0,//选择人数.0-多选,1-单选,其他正数-制定数目
+            minCount:1,// 最少选择数,默认为0,即不限制
+        };
+        //打开选人之前,清空数据
+        resetParam(obj);
+        ChooseOrg.choosePerson("show3", config, null, function (w, results) {
+            var id = [];
+            var name = [];
+            var existName = [];
+            for (var i = 0; i < results.length; i++) {
+                id.push(results[i].key);
+                name.push(results[i].name);
+            }
+            param.resourceKeys = id;
+        });
+    }
+
+    function resetParam(obj) {
+        param.visibilityScope = $(obj).attr("id");
+        param.resourceKeys = [];
+    }
+
+    function visibilityRequest(callback){
+        console.log(JSON.stringify(param));
+        debugger;
+        var url = TC.config.baseUrl+'/task/'+param.taskId+'/bbs/?m=taskProcessVisibility';
+        $.ajax({
+            url: url,
+            type: "post",
+            dataType: "json",
+            data: param,
+            sync: false,
+            success: function (result) {
+                if ($.isFunction(callback)) {
+                    callback(result);
+                }
+            },
+            error: function () {
+                $.alert("设置公开范围失败!");
+            }
+        });
+    }
+</script>
+</html>
+

+ 28 - 28
tip-front/src/main/webapp/tc_suite/taskmt/byType/mergeTask.jsp

@@ -161,34 +161,34 @@
 
  })
 function mergeRequest(callback){
-    console.log('合并表单的数据:',this.form);
-                var ids = [];
-                var _this = this.vm;
-                _this.titles.forEach(item => {
-                    ids.push(item.value);
-                });
-                $.ajax({
-                    url: TC.config.baseUrl + "/taskByType/mergeTask",
-                    type: "post",
-                    dataType: "json",
-                    data: {
-                        taskType: _this.taskType,
-                        ids: ids,
-                        titleId: _this.form.titleId,
-                        typeId: _this.form.typeId,
-                        contentId: _this.form.contentId,
-                        directoryId: _this.form.directoryId,
-                        fromId: _this.form.fromId,
-                    },
-                    success: function (result) {
-                        if ($.isFunction(callback)) {
-                            callback(result);
-                        }
-                    },
-                    error:function(){
-                        $.alert("合并失败!");
-                    }
-                });
+    console.log('合并表单的数据:', this.form);
+    var ids = [];
+    var _this = this.vm;
+    _this.titles.forEach(item => {
+        ids.push(item.value);
+    });
+    $.ajax({
+        url: TC.config.baseUrl + "/taskByType/mergeTask",
+        type: "post",
+        dataType: "json",
+        data: {
+            taskType: _this.taskType,
+            ids: ids,
+            titleId: _this.form.titleId,
+            typeId: _this.form.typeId,
+            contentId: _this.form.contentId,
+            directoryId: _this.form.directoryId,
+            fromId: _this.form.fromId,
+        },
+        success: function (result) {
+            if ($.isFunction(callback)) {
+                callback(result);
+            }
+        },
+        error: function () {
+            $.alert("合并失败!");
+        }
+    });
 }
 </script>
 </body>

+ 63 - 18
tip-front/src/main/webapp/tc_suite/taskmt/js/task.js

@@ -1279,6 +1279,7 @@ task.process.initProcessEvent = function() {
 	$("a[name='reply']").unbind().click($(this),task.process.showReplay);
 	$("a[name='replys']").unbind().click($(this),task.process.showReplays);
 	$("a[name='withdraw']").unbind().click($(this),task.process.withdraw);
+	$("span[name='visibilityScope']").unbind().click($(this),task.process.visibilityScope);
 	$("textarea[name='opinion']").unbind().click($(this), task.cleanText);
 	$("a[name='cancelReply']").unbind().click($(this), task.process.cancelReplay);
 	$("a[name='saveReply']").unbind().click($(this), task.process.saveReplay);
@@ -1662,29 +1663,73 @@ task.process.saveReplay = function(event) {
     }
 };
 task.process.withdraw = function(event) {
-	var _this = $(this);
-	var itemId = _this.attr("itemId");
+	var itemId = $(this).attr("itemId");
 	var taskId = $("input[name=taskId]").val();
 	var url = TC.config.baseUrl+'/task/'+taskId+'/bbs/?m=withdrawTaskProcess&itemId='+itemId;
-	$.ajax({
-		url:url,
-		type:"POST",
-		async:false,
-		success: function (result) {
-			if(result.state==='success'){
-				$.ok("撤回成功!",function(){
-					window.location.reload();
-					if(window.parent && $.isFunction(window.parent.selectCount)){
-						window.parent.selectCount();
+	$.confirm("确定要撤回当前批示/留言内容?",function(){
+		$.ajax({
+			url:url,
+			type:"POST",
+			async:false,
+			success: function (result) {
+				if(result.state==='success'){
+					$.ok("撤回成功!",function(){
+						window.location.reload();
+						if(window.parent && $.isFunction(window.parent.selectCount)){
+							window.parent.selectCount();
+						}
+					});
+				}else{
+					if (result.message) {
+						$.error(result.message);
+					} else {
+						$.error("撤回失败!");
 					}
-				});
-			}else{
-				if (result.message) {
-					$.error(result.message);
-				} else {
-					$.error("撤回失败!");
 				}
 			}
+		});
+	});
+};
+task.process.visibilityScope = function(event) {
+	var _this = $(this);
+	var itemId = _this.attr("itemId");
+	var taskId = $("input[name=taskId]").val();
+	var url = TC.config.baseUrl+'/task/'+taskId+'/bbs/?m=taskProcessVisibilityInfo&itemId='+itemId;
+	$.dialog({
+		title :"公开设置",
+		max: false,
+		min: false,
+		width:"500px",
+		height:"300px",
+		content : "url:"+url,
+		lock : true,
+		button : [{
+			"name":"确认",// "发送",
+			callback:function(){
+				var _this = this;
+				this.iframe.contentWindow.visibilityRequest(function(result){
+					if (result.state=="success") {
+						_this.close();
+						$.ok("设置公开范围成功!",function(){
+							window.location.reload();
+							if(window.parent && $.isFunction(window.parent.selectCount)){
+								window.parent.selectCount();
+							}
+						});
+					} else {
+						if (result.message) {
+							$.error(result.message);
+						} else {
+							$.error("设置公开范围失败!");
+						}
+					}
+				});
+				return false;
+			},
+			focus:true
+		}],
+		cancel:function(){
+
 		}
 	});
 };

+ 22 - 10
tip-front/src/main/webapp/tc_suite/taskmt/taskMessageList.jsp

@@ -248,11 +248,14 @@
                                     <%--<a id="addAtt"  href="javascript:;" style="float: left;margin-top: 3px;">--%>
                                         <%--<lable style="float: left;">${tc:i18n("common.add.attachment")}</lable>--%>
                                     <%--</a>--%>
-                                    <div class="mt-btn mt-btn-blue" id="tempStoreBtn" style="float: right;margin:0;">
-                                        <span class="input" href="javascript:;">${tc:i18n("task.temporarily.store")}</span><%--暂存--%>
-                                    </div>
-                                    <div class="mt-btn mt-btn-blue" id="btn2" style="float: right;margin:0;">
-                                        <span class="input" href="javascript:;">${tc:i18n("task.submit")}</span><%--提交--%>
+                                    <div style="display: flex;align-items:center">
+                                        <div class="mt-btn mt-btn-blue" id="tempStoreBtn"
+                                             style="float: right;margin-right:10px;">
+                                            <span class="input" href="javascript:;">${tc:i18n("task.temporarily.store")}</span><%--暂存--%>
+                                        </div>
+                                        <div class="mt-btn mt-btn-blue" id="btn2" style="float: right;margin:0;">
+                                            <span class="input" href="javascript:;">${tc:i18n("task.submit")}</span><%--提交--%>
+                                        </div>
                                     </div>
                                 </div>
                             </div>
@@ -291,11 +294,14 @@
                                     <%--<a id="addAtt"  href="javascript:;" style="float: left;">--%>
                                         <%--<lable style="float: left;">${tc:i18n("task.add.attachments")}</lable><!--添加附件-->--%>
                                     <%--</a>--%>
-                                    <div class="mt-btn mt-btn-blue" id="tempStoreBtn" style="float: right;margin:0;">
-                                        <span class="input" href="javascript:;">${tc:i18n("task.temporarily.store")}</span><%--暂存--%>
-                                    </div>
-                                    <div class="mt-btn mt-btn-blue" id="btn2" style="float: right;margin:0;">
-                                        <span class="input">${tc:i18n("task.submit")}</span><%--提交--%>
+                                    <div style="display: flex;align-items:center">
+                                        <div class="mt-btn mt-btn-blue" id="tempStoreBtn"
+                                             style="float: right;margin:10px;">
+                                            <span class="input" href="javascript:;">${tc:i18n("task.temporarily.store")}</span><%--暂存--%>
+                                        </div>
+                                        <div class="mt-btn mt-btn-blue" id="btn2" style="float: right;margin:0;">
+                                            <span class="input">${tc:i18n("task.submit")}</span><%--提交--%>
+                                        </div>
                                     </div>
                                 </div>
                             </div>
@@ -906,6 +912,12 @@
                                         <a href="javascript:;" name="withdraw" class="mt-btn-font" itemId="${process.itemId}"
                                            style="float: right;margin: 0;">[${tc:i18n("task.porcess.withdraw")}]</a>
                                     </c:if>
+                                    <%-- 领导批示[公布范围]文字按钮 --%>
+                                    <c:if test="${process.itemType == 10002004 && process.isKaizhouLingDao && isSupervise}">
+                                        <div class="mt-btn mt-btn-blue" style="float: right;margin-right:10px
+                                            <span name="visibilityScope" itemId="${process.itemId}">${process.visibilityScopeStr}</span>
+                                        </div>
+                                    </c:if>
                                 </div>
                             </td>
                         </tr>

+ 30 - 21
tip-service/tip-common/src/main/java/com/minto/app/behavior/dao/BehSummaryDaoImpl.java

@@ -7,10 +7,8 @@ package com.minto.app.behavior.dao;
 
 import com.google.common.collect.Maps;
 import com.minto.app.behavior.beans.BehSummaryBean;
-import com.minto.app.behavior.enums.BehaviorEnum;
 import com.minto.app.behavior.enums.BehaviorEnum.BehSummaryBehCategoryEnum;
 import com.minto.app.behavior.enums.BehaviorEnum.BehSummaryBehTypeEnum;
-import com.minto.app.behavior.util.BehUtil;
 import com.minto.app.resource.enums.ResourceEnum;
 import com.minto.app.resource.enums.ResourceEnum.ResourceTypeEnum;
 import com.minto.core.base.BaseEnum.OrgEnum;
@@ -21,12 +19,11 @@ import com.minto.core.ds.DBAgent;
 import com.minto.core.ds.enums.DSEnum;
 import com.minto.core.util.*;
 import com.minto.tip.common.exceptions.BusinessException;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.stream.Streams;
+import org.hibernate.criterion.Conjunction;
 import org.hibernate.criterion.Criterion;
 import org.hibernate.criterion.Order;
 import org.hibernate.criterion.Restrictions;
-import org.jetbrains.annotations.NotNull;
 import org.springframework.stereotype.Repository;
 
 import java.util.*;
@@ -142,19 +139,6 @@ public class BehSummaryDaoImpl extends BaseDaoImpl implements IBehSummaryDao {
                 criterion = Restrictions.and(criterion, Restrictions.eq("belongToResId", o));
             }
         }
-        //流程参与人不看区长、书记、区领导的批示数据
-        if(conditions.get("notShowSJQZQLDpishi") != null){
-            Object o = conditions.get("notShowSJQZQLDpishi");
-            String sqlParam = null;
-            if (o.getClass().isArray()) {
-                sqlParam = "IN ( "+ Streams.of(o).map(Object::toString).collect(Collectors.joining(", ")) +" )";
-            }else if(o instanceof Collection){
-                sqlParam = "IN ( "+ ((Collection<?>)o).stream().map(Object::toString).collect(Collectors.joining(", ")) +" )";
-            }else{
-                sqlParam = "= " + o.toString();
-            }
-            criterion = Restrictions.and(criterion, Restrictions.sqlRestriction("id not in (select id from beh_summary where belong_to_res_id "+sqlParam+" AND beh_type = 10002004)"));
-        }
         // 行为所属资源ID
         if (conditions.get("resId") != null) {
             Object o = conditions.get("resId");
@@ -206,12 +190,37 @@ public class BehSummaryDaoImpl extends BaseDaoImpl implements IBehSummaryDao {
             if(o.equals(0)){
                 criterion = Restrictions.and(criterion,Restrictions.in("behType", Arrays.asList(10002001,20002001,10002002,20002008)));
             }else{
+                Set<Object> behTypes = new HashSet<>();
                 if (o.getClass().isArray()) {
-                    criterion = Restrictions.and(criterion, Restrictions.in("behType", (Object[]) o));
+                    behTypes.addAll(Arrays.stream(((Object[]) o)).toList());
                 } else if (o instanceof Collection) {
-                    criterion = Restrictions.and(criterion, Restrictions.in("behType", (Collection) o));
-                } else {
-                    criterion = Restrictions.and(criterion, Restrictions.eq("behType", o));
+                    behTypes.addAll((Collection<?>)o);
+                }else{
+                    behTypes.add(o);
+                }
+                Criterion and = null;
+                Boolean showInstructionsTaskLimitScope = (Boolean)conditions.get("showInstructionsTaskLimitScope");
+                List<Long> showIds = (List<Long>)conditions.get("instructionsTaskLimitScopeShowIds");
+                if(Boolean.TRUE.equals(showInstructionsTaskLimitScope) && CollectionUtil.isNotEmpty(showIds)){
+                    if(behTypes.size() == 1){
+                        and = Restrictions.disjunction(Restrictions.eq("behType", behTypes.stream().findFirst().get()),
+                                Restrictions.conjunction(Restrictions.eq("behType",
+                                                BehSummaryBehTypeEnum.InstructionsTaskLimitScope.getKey()),
+                                        Restrictions.in("id", showIds)));
+                    } else if(behTypes.size() > 1){
+                        and = Restrictions.disjunction(Restrictions.in("behType", behTypes), Restrictions.conjunction(
+                                Restrictions.eq("behType", BehSummaryBehTypeEnum.InstructionsTaskLimitScope.getKey()),
+                                Restrictions.in("id", showIds)));
+                    }
+                } else{
+                    if(behTypes.size() == 1){
+                        and = Restrictions.eq("behType", behTypes.stream().findFirst().get());
+                    } else if(behTypes.size() > 1){
+                        and = Restrictions.in("behType", behTypes);
+                    }
+                }
+                if(and != null){
+                    criterion = Restrictions.and(criterion, and);
                 }
             }
 

+ 20 - 10
tip-service/tip-common/src/main/java/com/minto/app/behavior/manager/BehManagerImpl.java

@@ -5,6 +5,12 @@
 
 package com.minto.app.behavior.manager;
 
+import java.sql.SQLException;
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.stream.Collectors;
+
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.google.common.collect.Lists;
@@ -35,12 +41,6 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.sql.SQLException;
-import java.time.LocalDateTime;
-import java.util.*;
-import java.util.concurrent.CountDownLatch;
-import java.util.stream.Collectors;
-
 @Service("IBehManager")
 public class BehManagerImpl extends AsynchronousBatchTask<BehSummaryBean> implements IBehManager {
 
@@ -894,13 +894,15 @@ public class BehManagerImpl extends AsynchronousBatchTask<BehSummaryBean> implem
     @Override
     public ListObject<BehSummaryBean> findBehsOfResource(Long resourceId, Integer resourceType, Long[] perIds, Date startTime,
             Date endTime, Integer[] behType, Integer start, Integer range) throws BusinessException {
-        List<String> notPersonIds = AppContext.removeThreadContext("notShowSJQZQLDpishi");
+        Boolean showInstructionsTaskLimitScope = AppContext.removeThreadContext("showInstructionsTaskLimitScope");
+        List<Long> instructionsTaskLimitScopeShowIds = AppContext.removeThreadContext("instructionsTaskLimitScopeShowIds");
         ListObject<BehSummaryBean> result = null;
         if (resourceType != null && resourceId != null) {
             Map<String, Object> condition = buildFindBehsOfResourceParam(resourceId, resourceType, perIds, startTime, endTime, behType);
             condition.put("start", start);
             condition.put("range", range);
-            condition.put("notShowSJQZQLDpishi", notPersonIds);
+            condition.put("showInstructionsTaskLimitScope", showInstructionsTaskLimitScope);
+            condition.put("instructionsTaskLimitScopeShowIds", instructionsTaskLimitScopeShowIds);
             result = behSummaryDao.findByCondition(condition);
         }
         return result;
@@ -911,7 +913,8 @@ public class BehManagerImpl extends AsynchronousBatchTask<BehSummaryBean> implem
             Date endTime, Integer[] behType) throws BusinessException {
         if (resourceType != null && resourceId != null) {
             Map<String, Object> condition = buildFindBehsOfResourceParam(resourceId, resourceType, perIds, startTime, endTime, behType);
-            condition.put("notShowSJQZQLDpishi", AppContext.removeThreadContext("notShowSJQZQLDpishi"));
+            condition.put("showInstructionsTaskLimitScope", AppContext.removeThreadContext("showInstructionsTaskLimitScope"));
+            condition.put("instructionsTaskLimitScopeShowIds", AppContext.removeThreadContext("instructionsTaskLimitScopeShowIds"));
             return behSummaryDao.countByCondition(condition);
         }
         return 0;
@@ -1444,10 +1447,17 @@ public class BehManagerImpl extends AsynchronousBatchTask<BehSummaryBean> implem
     }
 
     @Override
-    public void deleteByBehTypeAndExt1(Integer resType, String resId, String ext1){
+    public void deleteByResTypeAndExt1(Integer resType, String resId, String ext1){
         LogicalExpression c = Restrictions.and(Restrictions.eq("resType", resType),
                 Restrictions.eq("resId", resId));
         c = Restrictions.and(c,Restrictions.eq("ext1", ext1));
         behSummaryDao.delete(BehSummaryBean.class,c);
     }
+
+    @Override
+    public List<BehSummaryBean> findByBehTypeAndResId(Integer behType, Integer resType, String resId){
+        Criterion c = Restrictions.and(Restrictions.eq("resType", resType),
+                Restrictions.eq("resId", resId),Restrictions.eq("behType", behType));
+        return behSummaryDao.findBehByCriterion(c);
+    }
 }

+ 2 - 0
tip-service/tip-common/src/main/resources/META-INF/module/behavior/i18n/behavior_en.properties

@@ -98,6 +98,8 @@ behavior.attention.task.desc=
 behavior.instructions.task=
 behavior.receive.instructions.task.en=
 behavior.instructions.task.desc=
+behavior.instructions.temp.task=
+behavior.instructions.temp.task.desc=
 behavior.send.online.msg=
 behavior.send.online.msg.desc={2}
 behavior.space.bbs=

+ 2 - 0
tip-service/tip-common/src/main/resources/META-INF/module/behavior/i18n/behavior_zh_CN.properties

@@ -101,6 +101,8 @@ behavior.attention.task=\u4E8B\u9879\u5173\u6CE8
 behavior.attention.task.desc={0}{1}\u4E8B\u9879
 behavior.instructions.task=\u6279\u793A
 behavior.instructions.task.desc=\u5728{1}\u4E2D\u6279\u793A\uFF1A{2}
+behavior.instructions.temp.task=\u6279\u793A
+behavior.instructions.temp.task.desc=\u5728{1}\u4E2D\u6279\u793A\uFF1A{2}
 behavior.receive.instructions.task={0} \u5BF9{1}\u8FDB\u884C\u4E86\u6279\u793A\uFF1A{2}
 behavior.send.online.msg=\u53D1\u9001\u5728\u7EBF\u6D88\u606F
 behavior.send.online.msg.desc={2}