Ver código fonte

新增流程待办和工作台待办计数接口

wangliang 1 ano atrás
pai
commit
96abca5b22

+ 12 - 0
sop-business/src/main/java/com/qmth/sop/business/activiti/service/ActivitiService.java

@@ -78,6 +78,18 @@ public interface ActivitiService {
      */
     public IPage<WorkTaskResult> getFlowTaskList(IPage<Map> iPage, Long userId, TFCustomTypeEnum type, Long serviceId, String customName, FlowTaskTypeEnum flowTaskTypeEnum);
 
+    /**
+     * 获取用户待办计数
+     *
+     * @param userId
+     * @param type
+     * @param serviceId
+     * @param customName
+     * @param flowTaskTypeEnum
+     * @return
+     */
+    public int getFlowTaskListCount(Long userId, TFCustomTypeEnum type, Long serviceId, String customName, FlowTaskTypeEnum flowTaskTypeEnum);
+
     /**
      * 流程节点转他人审批
      *

+ 17 - 0
sop-business/src/main/java/com/qmth/sop/business/activiti/service/impl/ActivitiServiceImpl.java

@@ -467,6 +467,23 @@ public class ActivitiServiceImpl implements ActivitiService {
         return workTaskResultIPage;
     }
 
+    /**
+     * 获取用户待办计数
+     *
+     * @param userId
+     * @param type
+     * @param serviceId
+     * @param customName
+     * @param flowTaskTypeEnum
+     * @return
+     */
+    @Override
+    public int getFlowTaskListCount(Long userId, TFCustomTypeEnum type, Long serviceId, String customName, FlowTaskTypeEnum flowTaskTypeEnum) {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        userId = Objects.nonNull(sysUser) ? sysUser.getId() : userId;
+        return sysUserService.getFlowTaskListCount(userId, type, serviceId, customName, flowTaskTypeEnum);
+    }
+
     /**
      * 流程节点转他人审批
      *

+ 13 - 2
sop-business/src/main/java/com/qmth/sop/business/mapper/SysUserMapper.java

@@ -4,12 +4,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.qmth.sop.business.bean.dto.UserDto;
 import com.qmth.sop.business.bean.dto.VerifyCodeCheckDto;
-import com.qmth.sop.business.bean.result.WorkTaskResult;
 import com.qmth.sop.business.bean.result.SysUserResult;
 import com.qmth.sop.business.bean.result.UserRoleNameResult;
+import com.qmth.sop.business.bean.result.WorkTaskResult;
 import com.qmth.sop.business.entity.SysUser;
 import com.qmth.sop.common.enums.RoleTypeEnum;
-import com.qmth.sop.common.enums.TFCustomTypeEnum;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -46,6 +45,18 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
      */
     IPage<WorkTaskResult> getFlowTaskList(IPage<Map> iPage, @Param("userId") Long userId, @Param("type") String type, @Param("serviceId") Long serviceId, @Param("customName") String customName, @Param("flowTaskTypeEnum") String flowTaskTypeEnum);
 
+    /**
+     * 获取工作台待办
+     *
+     * @param userId
+     * @param type
+     * @param serviceId
+     * @param customName
+     * @param flowTaskTypeEnum
+     * @return
+     */
+    int getFlowTaskListCount(@Param("userId") Long userId, @Param("type") String type, @Param("serviceId") Long serviceId, @Param("customName") String customName, @Param("flowTaskTypeEnum") String flowTaskTypeEnum);
+
     /**
      * 根据机构id查询用户
      *

+ 11 - 0
sop-business/src/main/java/com/qmth/sop/business/mapper/TBDelayWarnMapper.java

@@ -39,4 +39,15 @@ public interface TBDelayWarnMapper extends BaseMapper<TBDelayWarn> {
      * @return
      */
     IPage<WorkWarnResult> getWarnTaskList(IPage<Map> iPage, @Param("userId") Long userId, @Param("type") String type, @Param("serviceId") Long serviceId, @Param("customName") String customName);
+
+    /**
+     * 获取预警待办计数
+     *
+     * @param userId
+     * @param type
+     * @param serviceId
+     * @param customName
+     * @return
+     */
+    int getWarnTaskListCount(@Param("userId") Long userId, @Param("type") String type, @Param("serviceId") Long serviceId, @Param("customName") String customName);
 }

+ 12 - 0
sop-business/src/main/java/com/qmth/sop/business/service/SysUserService.java

@@ -139,6 +139,18 @@ public interface SysUserService extends IService<SysUser> {
      */
     IPage<WorkTaskResult> getFlowTaskList(IPage<Map> iPage, Long userId, TFCustomTypeEnum type, Long serviceId, String customName, FlowTaskTypeEnum flowTaskTypeEnum);
 
+    /**
+     * 获取工作台待办
+     *
+     * @param userId
+     * @param type
+     * @param serviceId
+     * @param customName
+     * @param flowTaskTypeEnum
+     * @return
+     */
+    int getFlowTaskListCount(Long userId, TFCustomTypeEnum type, Long serviceId, String customName, FlowTaskTypeEnum flowTaskTypeEnum);
+
     /**
      * 根据角色类型查询用户
      *

+ 11 - 0
sop-business/src/main/java/com/qmth/sop/business/service/TBDelayWarnService.java

@@ -57,5 +57,16 @@ public interface TBDelayWarnService extends IService<TBDelayWarn> {
      */
     public IPage<WorkWarnResult> getWarnTaskList(IPage<Map> iPage, Long userId, WarnTypeEnum type, Long serviceId, String customName);
 
+    /**
+     * 获取预警待办计数
+     *
+     * @param userId
+     * @param type
+     * @param serviceId
+     * @param customName
+     * @return
+     */
+    public int getWarnTaskListCount(Long userId, WarnTypeEnum type, Long serviceId, String customName);
+
     TBDelayWarnResult get(long id);
 }

+ 15 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysUserServiceImpl.java

@@ -448,6 +448,21 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         return this.baseMapper.getFlowTaskList(iPage, userId, Objects.nonNull(type) ? type.name() : null, serviceId, customName, Objects.nonNull(flowTaskTypeEnum) ? flowTaskTypeEnum.name() : null);
     }
 
+    /**
+     * 获取用户待办计数
+     *
+     * @param userId
+     * @param type
+     * @param serviceId
+     * @param customName
+     * @param flowTaskTypeEnum
+     * @return
+     */
+    @Override
+    public int getFlowTaskListCount(Long userId, TFCustomTypeEnum type, Long serviceId, String customName, FlowTaskTypeEnum flowTaskTypeEnum) {
+        return this.baseMapper.getFlowTaskListCount(userId, Objects.nonNull(type) ? type.name() : null, serviceId, customName, Objects.nonNull(flowTaskTypeEnum) ? flowTaskTypeEnum.name() : null);
+    }
+
     @Override
     public List<SysUser> findUserListByRoleType(RoleTypeEnum roleType) {
         return this.baseMapper.findByRoleType(roleType);

+ 17 - 2
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDelayWarnServiceImpl.java

@@ -37,8 +37,7 @@ import java.util.Objects;
 public class TBDelayWarnServiceImpl extends ServiceImpl<TBDelayWarnMapper, TBDelayWarn> implements TBDelayWarnService {
 
     @Resource
-    TBDelayWarnDetailService
-            tBDelayWarnDetailService;
+    TBDelayWarnDetailService tBDelayWarnDetailService;
 
     /**
      * 查询列表
@@ -119,4 +118,20 @@ public class TBDelayWarnServiceImpl extends ServiceImpl<TBDelayWarnMapper, TBDel
         userId = Objects.nonNull(sysUser) ? sysUser.getId() : userId;
         return this.baseMapper.getWarnTaskList(iPage, userId, Objects.nonNull(type) ? type.name() : null, serviceId, customName);
     }
+
+    /**
+     * 获取预警待办计数
+     *
+     * @param userId
+     * @param type
+     * @param serviceId
+     * @param customName
+     * @return
+     */
+    @Override
+    public int getWarnTaskListCount(Long userId, WarnTypeEnum type, Long serviceId, String customName) {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        userId = Objects.nonNull(sysUser) ? sysUser.getId() : userId;
+        return this.baseMapper.getWarnTaskListCount(userId, Objects.nonNull(type) ? type.name() : null, serviceId, customName);
+    }
 }

+ 9 - 1
sop-business/src/main/resources/db/log/wangliang_update_log.sql

@@ -891,4 +891,12 @@ CREATE TABLE t_d_form_widget_metadata
     create_time BIGINT
         COMMENT '创建时间' NOT NULL
 );
-ALTER TABLE t_d_form_widget_metadata COMMENT = '动态表单元数据表';
+ALTER TABLE t_d_form_widget_metadata COMMENT = '动态表单元数据表';
+
+--2023.8.31update
+INSERT INTO sys_privilege
+(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
+VALUES(3032, '获取流程待办计数接口', '/api/admin/flow/task/list/count', 'URL', 64, 29, 'SYS', NULL, 1, 1, 0);
+INSERT INTO sys_privilege
+(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
+VALUES(3033, '获取违规/延期预警待办计数接口', '/api/admin/my/work_bench/warn/list/count', 'URL', 64, 30, 'SYS', NULL, 1, 1, 0);

+ 116 - 109
sop-business/src/main/resources/mapper/SysUserMapper.xml

@@ -6,122 +6,129 @@
         select ARP.ID_ from ACT_RE_PROCDEF ARP where ARP.DEPLOYMENT_ID_ = #{deploymentId}
     </select>
 
-    <select id="getFlowTaskList" resultType="com.qmth.sop.business.bean.result.WorkTaskResult">
+    <sql id="flowTaskListCommonSql">
+        (select
+        cast(art.ASSIGNEE_ as Decimal(24)) as userId,
+        tfcf.type,
+        tfcfe.code,
+        tffa.status,
+        tffa.setup,
+        tfcf.version,
+        tfcfe.obj_id as objId,
+        tfcfe.crm_no as crmNo,
+        tbc.name as crmName,
+        tbs.id as serviceId,
+        tbs.name as serviceName,
+        tbs.type as serviceType,
+        sc.id as customId,
+        sc.type as customType,
+        sc.name as customName,
+        tfcfe.create_id as createId,
+        su.real_name as createRealName,
+        art.PROC_INST_ID_ as flowId,
+        art.NAME_ as taskName,
+        art.TASK_DEF_KEY_ as taskDefKey,
+        art.ID_ as taskId,
+        tfcfe.flow_process_var as flowProcessVar,
+        tfcfe.t_f_custom_flow_id as customFlowId,
+        tfcf.flow_deployment_id as flowDeploymentId,
+        tfcfe.id as customFlowEntityid,
+        tffa.update_time as flowTime,
+        datediff(now(),FROM_UNIXTIME(tffa.update_time / 1000,'%Y-%m-%d %H:%i:%s')) as diffTime,
+        24 - TIMESTAMPDIFF(HOUR,DATE_FORMAT(FROM_UNIXTIME(tsjr.exec_time / 1000), '%Y-%m-%d %H:%i:%s'),NOW()) as processHour
+        from
+        ACT_RU_TASK art
+        left join t_f_flow_approve tffa on art.PROC_INST_ID_ = tffa.flow_id
+        left join t_f_custom_flow_entity tfcfe on tfcfe.flow_id = tffa.flow_id
+        left join t_f_custom_flow tfcf on tfcf.id = tfcfe.t_f_custom_flow_id
+        left join t_b_crm tbc on tbc.crm_no = tfcfe.crm_no
+        left join t_b_service tbs on tbs.id = tbc.service_id
+        left join sys_custom sc on sc.id = tbc.custom_id
+        left join sys_user su ON tfcfe.create_id = su.id
+        left join t_s_job_remind tsjr on tsjr.code  = tfcfe.code
+        <where> 1 = 1
+            and art.ASSIGNEE_ = cast(#{userId} as char)
+            <if test="flowTaskTypeEnum != null and flowTaskTypeEnum != '' and flowTaskTypeEnum == 'DRAFT'">
+                and tffa.status = #{flowTaskTypeEnum}
+            </if>
+            <if test="type != null and type != ''">
+                and tfcf.type = #{type}
+            </if>
+            <if test="customName != null and customName != ''">
+                and sc.name like concat('%', #{customName}, '%')
+            </if>
+        </where>
+        UNION ALL
         select
-            t.*
+        cast(ari.USER_ID_ as Decimal(24)) as userId,
+        tfcf.type,
+        tfcfe.code,
+        tffa.status,
+        tffa.setup,
+        tfcf.version,
+        tfcfe.obj_id as objId,
+        tfcfe.crm_no as crmNo,
+        tbc.name as crmName,
+        tbs.id as serviceId,
+        tbs.name as serviceName,
+        tbs.type as serviceType,
+        sc.id as customId,
+        sc.type as customType,
+        sc.name as customName,
+        tfcfe.create_id as createId,
+        su.real_name as createRealName,
+        art.PROC_INST_ID_ as flowId,
+        art.NAME_ as taskName,
+        art.TASK_DEF_KEY_ as taskDefKey,
+        art.ID_ as taskId,
+        tfcfe.flow_process_var as flowProcessVar,
+        tfcfe.t_f_custom_flow_id as customFlowId,
+        tfcf.flow_deployment_id as flowDeploymentId,
+        tfcfe.id as customFlowEntityid,
+        tffa.update_time as flowTime,
+        datediff(now(),FROM_UNIXTIME(tffa.update_time / 1000,'%Y-%m-%d %H:%i:%s')) as diffTime,
+        24 - TIMESTAMPDIFF(HOUR,DATE_FORMAT(FROM_UNIXTIME(tsjr.exec_time / 1000), '%Y-%m-%d %H:%i:%s'),NOW()) as processHour
         from
-            (select
-                    cast(art.ASSIGNEE_ as Decimal(24)) as userId,
-                    tfcf.type,
-                    tfcfe.code,
-                    tffa.status,
-                    tffa.setup,
-                    tfcf.version,
-                    tfcfe.obj_id as objId,
-                    tfcfe.crm_no as crmNo,
-                    tbc.name as crmName,
-                    tbs.id as serviceId,
-                    tbs.name as serviceName,
-                    tbs.type as serviceType,
-                    sc.id as customId,
-                    sc.type as customType,
-                    sc.name as customName,
-                    tfcfe.create_id as createId,
-                    su.real_name as createRealName,
-                    art.PROC_INST_ID_ as flowId,
-                    art.NAME_ as taskName,
-                    art.TASK_DEF_KEY_ as taskDefKey,
-                    art.ID_ as taskId,
-                    tfcfe.flow_process_var as flowProcessVar,
-                    tfcfe.t_f_custom_flow_id as customFlowId,
-                    tfcf.flow_deployment_id as flowDeploymentId,
-                    tfcfe.id as customFlowEntityid,
-                    tffa.update_time as flowTime,
-                    datediff(now(),FROM_UNIXTIME(tffa.update_time / 1000,'%Y-%m-%d %H:%i:%s')) as diffTime,
-                    24 - TIMESTAMPDIFF(HOUR,DATE_FORMAT(FROM_UNIXTIME(tsjr.exec_time / 1000), '%Y-%m-%d %H:%i:%s'),NOW()) as processHour
-                from
-                    ACT_RU_TASK art
-                    left join t_f_flow_approve tffa on art.PROC_INST_ID_ = tffa.flow_id
-                    left join t_f_custom_flow_entity tfcfe on tfcfe.flow_id = tffa.flow_id
-                    left join t_f_custom_flow tfcf on tfcf.id = tfcfe.t_f_custom_flow_id
-                    left join t_b_crm tbc on tbc.crm_no = tfcfe.crm_no
-                    left join t_b_service tbs on tbs.id = tbc.service_id
-                    left join sys_custom sc on sc.id = tbc.custom_id
-                    left join sys_user su ON tfcfe.create_id = su.id
-                    left join t_s_job_remind tsjr on tsjr.code  = tfcfe.code
-                    <where> 1 = 1
-                        and art.ASSIGNEE_ = cast(#{userId} as char)
-                    <if test="flowTaskTypeEnum != null and flowTaskTypeEnum != '' and flowTaskTypeEnum == 'DRAFT'">
-                        and tffa.status = #{flowTaskTypeEnum}
-                    </if>
-                    <if test="type != null and type != ''">
-                        and tfcf.type = #{type}
-                    </if>
-                    <if test="customName != null and customName != ''">
-                        and sc.name like concat('%', #{customName}, '%')
-                    </if>
-                </where>
-                UNION ALL
-                select
-                    cast(ari.USER_ID_ as Decimal(24)) as userId,
-                    tfcf.type,
-                    tfcfe.code,
-                    tffa.status,
-                    tffa.setup,
-                    tfcf.version,
-                    tfcfe.obj_id as objId,
-                    tfcfe.crm_no as crmNo,
-                    tbc.name as crmName,
-                    tbs.id as serviceId,
-                    tbs.name as serviceName,
-                    tbs.type as serviceType,
-                    sc.id as customId,
-                    sc.type as customType,
-                    sc.name as customName,
-                    tfcfe.create_id as createId,
-                    su.real_name as createRealName,
-                    art.PROC_INST_ID_ as flowId,
-                    art.NAME_ as taskName,
-                    art.TASK_DEF_KEY_ as taskDefKey,
-                    art.ID_ as taskId,
-                    tfcfe.flow_process_var as flowProcessVar,
-                    tfcfe.t_f_custom_flow_id as customFlowId,
-                    tfcf.flow_deployment_id as flowDeploymentId,
-                    tfcfe.id as customFlowEntityid,
-                    tffa.update_time as flowTime,
-                    datediff(now(),FROM_UNIXTIME(tffa.update_time / 1000,'%Y-%m-%d %H:%i:%s')) as diffTime,
-                    24 - TIMESTAMPDIFF(HOUR,DATE_FORMAT(FROM_UNIXTIME(tsjr.exec_time / 1000), '%Y-%m-%d %H:%i:%s'),NOW()) as processHour
-                from
-                    ACT_RU_TASK art
-                    left join act_ru_identitylink ari on ari.TASK_ID_ = art.ID_
-                    left join t_f_flow_approve tffa on tffa.flow_id = art.PROC_INST_ID_
-                    left join t_f_custom_flow_entity tfcfe on tfcfe.flow_id = tffa.flow_id
-                    left join t_f_custom_flow tfcf on tfcf.id = tfcfe.t_f_custom_flow_id
-                    left join t_b_crm tbc on tbc.crm_no = tfcfe.crm_no
-                    left join t_b_service tbs on tbs.id = tbc.service_id
-                    left join sys_custom sc on sc.id = tbc.custom_id
-                    left join sys_user su ON tfcfe.create_id = su.id
-                    left join t_s_job_remind tsjr on tsjr.code  = tfcfe.code
-                 <where> 1 = 1
-                    and art.ASSIGNEE_ is null
-                  and ari.USER_ID_ = cast(#{userId} as char)
-                  and ari.TYPE_ = 'candidate'
-                  <if test="flowTaskTypeEnum != null and flowTaskTypeEnum != '' and flowTaskTypeEnum == 'DRAFT'">
-                      and tffa.status = #{flowTaskTypeEnum}
-                  </if>
-                  <if test="type != null and type != ''">
-                      and tfcf.type = #{type}
-                  </if>
-                  <if test="customName != null and customName != ''">
-                      and sc.name like concat('%', #{customName}, '%')
-                  </if>
-                </where>
-                ) t
+        ACT_RU_TASK art
+        left join act_ru_identitylink ari on ari.TASK_ID_ = art.ID_
+        left join t_f_flow_approve tffa on tffa.flow_id = art.PROC_INST_ID_
+        left join t_f_custom_flow_entity tfcfe on tfcfe.flow_id = tffa.flow_id
+        left join t_f_custom_flow tfcf on tfcf.id = tfcfe.t_f_custom_flow_id
+        left join t_b_crm tbc on tbc.crm_no = tfcfe.crm_no
+        left join t_b_service tbs on tbs.id = tbc.service_id
+        left join sys_custom sc on sc.id = tbc.custom_id
+        left join sys_user su ON tfcfe.create_id = su.id
+        left join t_s_job_remind tsjr on tsjr.code  = tfcfe.code
+        <where> 1 = 1
+            and art.ASSIGNEE_ is null
+            and ari.USER_ID_ = cast(#{userId} as char)
+            and ari.TYPE_ = 'candidate'
+            <if test="flowTaskTypeEnum != null and flowTaskTypeEnum != '' and flowTaskTypeEnum == 'DRAFT'">
+                and tffa.status = #{flowTaskTypeEnum}
+            </if>
+            <if test="type != null and type != ''">
+                and tfcf.type = #{type}
+            </if>
+            <if test="customName != null and customName != ''">
+                and sc.name like concat('%', #{customName}, '%')
+            </if>
+        </where>
+        ) t
         <where>
             <if test="flowTaskTypeEnum != null and flowTaskTypeEnum != '' and flowTaskTypeEnum == 'OVER_TIME'">
                 and t.diffTime <![CDATA[ >= ]]> 1
             </if>
         </where>
+    </sql>
+
+    <select id="getFlowTaskList" resultType="com.qmth.sop.business.bean.result.WorkTaskResult">
+        select t.* from
+        <include refid="flowTaskListCommonSql" />
+    </select>
+
+    <select id="getFlowTaskListCount" resultType="java.lang.Integer">
+        select count(1) from
+        <include refid="flowTaskListCommonSql" />
     </select>
 
     <select id="findSysUserResultList" resultType="com.qmth.sop.business.bean.result.SysUserResult">

+ 67 - 57
sop-business/src/main/resources/mapper/TBDelayWarnMapper.xml

@@ -53,63 +53,73 @@
         ORDER BY a.create_time DESC
     </select>
 
+    <sql id="warnTaskListCommonSql">
+        (select
+        tbdw.id,
+        tbdw.code,
+        tbdw.sop_no as sopNo,
+        tbdw.crm_no as crmNo,
+        tbc.name as crmName,
+        tbs.id as serviceId,
+        tbs.name as serviceName,
+        tbs.type as serviceType,
+        sc.id as customId,
+        sc.name as customName,
+        sc.type as customType,
+        tbdw.create_id as createId,
+        su.real_name as createRealName,
+        tbdw.create_time as createTime,
+        'DELAY_WARN' as warnType
+        from t_b_delay_warn tbdw
+        left join t_b_crm tbc on tbc.crm_no = tbdw.crm_no
+        left join t_b_service tbs on tbs.id = tbc.service_id
+        left join sys_custom sc on sc.id = tbc.custom_id
+        left join sys_user su ON tbdw.create_id = su.id
+        UNION ALL
+        select
+        tbv.id,
+        tbv.code,
+        tbv.sop_no as sopNo,
+        tbv.crm_no as crmNo,
+        tbc.name as crmName,
+        tbs.id as serviceId,
+        tbs.name as serviceName,
+        tbs.type as serviceType,
+        sc.id as customId,
+        sc.name as customName,
+        sc.type as customType,
+        tbv.create_id as createId,
+        su.real_name as createRealName,
+        tbv.create_time as createTime,
+        'VIOLATION_WARN' as warnType
+        from t_b_violation tbv
+        left join t_b_crm tbc on tbc.crm_no = tbv.crm_no
+        left join t_b_service tbs on tbs.id = tbc.service_id
+        left join sys_custom sc on sc.id = tbc.custom_id
+        left join sys_user su ON tbv.create_id = su.id) t
+        <where>
+            <if test="userId != null and userId != ''">
+                and t.createId = #{userId}
+            </if>
+            <if test="type != null and type != ''">
+                and t.warnType = #{type}
+            </if>
+            <if test="serviceId != null and serviceId != ''">
+                and t.serviceId = #{serviceId}
+            </if>
+            <if test="customName != null and customName != ''">
+                and t.customName like concat('%', #{customName}, '%')
+            </if>
+        </where>
+    </sql>
+
     <select id="getWarnTaskList" resultType="com.qmth.sop.business.bean.result.WorkWarnResult">
-        select t.* from(select
-                          tbdw.id,
-                          tbdw.code,
-                          tbdw.sop_no as sopNo,
-                          tbdw.crm_no as crmNo,
-                          tbc.name as crmName,
-                          tbs.id as serviceId,
-                          tbs.name as serviceName,
-                          tbs.type as serviceType,
-                          sc.id as customId,
-                          sc.name as customName,
-                          sc.type as customType,
-                          tbdw.create_id as createId,
-                          su.real_name as createRealName,
-                          tbdw.create_time as createTime,
-                          'DELAY_WARN' as warnType
-                      from t_b_delay_warn tbdw
-                               left join t_b_crm tbc on tbc.crm_no = tbdw.crm_no
-                               left join t_b_service tbs on tbs.id = tbc.service_id
-                               left join sys_custom sc on sc.id = tbc.custom_id
-                               left join sys_user su ON tbdw.create_id = su.id
-                      UNION ALL
-                      select
-                          tbv.id,
-                          tbv.code,
-                          tbv.sop_no as sopNo,
-                          tbv.crm_no as crmNo,
-                          tbc.name as crmName,
-                          tbs.id as serviceId,
-                          tbs.name as serviceName,
-                          tbs.type as serviceType,
-                          sc.id as customId,
-                          sc.name as customName,
-                          sc.type as customType,
-                          tbv.create_id as createId,
-                          su.real_name as createRealName,
-                          tbv.create_time as createTime,
-                          'VIOLATION_WARN' as warnType
-                      from t_b_violation tbv
-                               left join t_b_crm tbc on tbc.crm_no = tbv.crm_no
-                               left join t_b_service tbs on tbs.id = tbc.service_id
-                               left join sys_custom sc on sc.id = tbc.custom_id
-                               left join sys_user su ON tbv.create_id = su.id) t
-            <where>
-                <if test="userId != null and userId != ''">
-                    and t.createId = #{userId}
-                </if>
-                <if test="type != null and type != ''">
-                    and t.warnType = #{type}
-                </if>
-                <if test="serviceId != null and serviceId != ''">
-                    and t.serviceId = #{serviceId}
-                </if>
-                <if test="customName != null and customName != ''">
-                    and t.customName like concat('%', #{customName}, '%')
-                </if>
-            </where>
+        select t.* from
+        <include refid="warnTaskListCommonSql" />
+    </select>
+
+    <select id="getWarnTaskListCount" resultType="java.lang.Integer">
+        select count(1) from
+        <include refid="warnTaskListCommonSql" />
     </select>
 </mapper>

+ 10 - 0
sop-server/src/main/java/com/qmth/sop/server/api/MyWorkBenchController.java

@@ -49,4 +49,14 @@ public class MyWorkBenchController {
                                   @ApiParam(value = "页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
         return ResultUtil.ok(tbDelayWarnService.getWarnTaskList(new Page<>(pageNumber, pageSize), userId, type, serviceId, customName));
     }
+
+    @ApiOperation(value = "获取违规/延期预警待办计数接口")
+    @RequestMapping(value = "/warn/list/count", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = WorkTaskResult.class)})
+    public Result getWarnTaskListCount(@ApiParam(value = "用户id") @RequestParam(required = false) Long userId,
+                                       @ApiParam(value = "预警类型") @RequestParam(required = false) WarnTypeEnum type,
+                                       @ApiParam(value = "服务单元id") @RequestParam(required = false) Long serviceId,
+                                       @ApiParam(value = "客户名称") @RequestParam(required = false) String customName) {
+        return ResultUtil.ok(tbDelayWarnService.getWarnTaskListCount(userId, type, serviceId, customName));
+    }
 }

+ 11 - 0
sop-server/src/main/java/com/qmth/sop/server/api/TFCustomFlowController.java

@@ -107,6 +107,17 @@ public class TFCustomFlowController {
         return ResultUtil.ok(activitiService.getFlowTaskList(new Page<>(pageNumber, pageSize), userId, type, serviceId, customName, flowTaskTypeEnum));
     }
 
+    @ApiOperation(value = "获取流程待办计数接口")
+    @RequestMapping(value = "/task/list/count", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Integer.class)})
+    public Result getFlowTaskListCount(@ApiParam(value = "用户id") @RequestParam(required = false) Long userId,
+                                       @ApiParam(value = "流程类型") @RequestParam(required = false) TFCustomTypeEnum type,
+                                       @ApiParam(value = "服务单元id") @RequestParam(required = false) Long serviceId,
+                                       @ApiParam(value = "客户名称") @RequestParam(required = false) String customName,
+                                       @ApiParam(value = "待办任务类型", required = true) @RequestParam FlowTaskTypeEnum flowTaskTypeEnum) {
+        return ResultUtil.ok(activitiService.getFlowTaskListCount(userId, type, serviceId, customName, flowTaskTypeEnum));
+    }
+
     @ApiOperation(value = "结束流程接口")
     @RequestMapping(value = "/delete", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})