XQ-20260414-002: 修复已办列表问题
1. 修复已办列表显示全自治区记录的问题 - Controller层始终设置机构过滤参数 - 默认childUnitSwitch为0(不查看下级) - 增加isAutonomousRegion参数判断自治区账号 2. 修复已办列表重复显示同一业务多条记录的问题 - 使用ROW_NUMBER()窗口函数按BIZSEQID去重 - 每笔业务只显示最新环节的一条记录 涉及文件: - TaskController.java: finishTaskUnionPage方法 - TSTaskListMapper.xml: selectFinishUnionTaskPage查询
This commit is contained in:
parent
209eb48bb7
commit
c3cc3898b4
|
|
@ -0,0 +1,27 @@
|
||||||
|
# XQ-20260414-002 失败报告
|
||||||
|
|
||||||
|
## 状态
|
||||||
|
- **开发状态**: 已完成
|
||||||
|
- **编译状态**: 未验证(环境无mvn)
|
||||||
|
- **推送状态**: 待推送
|
||||||
|
|
||||||
|
## 尝试修复的问题
|
||||||
|
|
||||||
|
### 问题1: 已办列表显示全自治区记录
|
||||||
|
- **根本原因**: 当 `childUnitSwitch` 参数不存在时,SQL子查询没有任何过滤条件,返回所有记录
|
||||||
|
- **修复方案**:
|
||||||
|
1. Controller层始终设置机构过滤参数
|
||||||
|
2. 默认 `childUnitSwitch = "0"`(不查看下级)
|
||||||
|
3. 增加 `isAutonomousRegion` 参数判断是否为自治区账号
|
||||||
|
4. Mapper XML中根据这些参数正确过滤
|
||||||
|
|
||||||
|
### 问题2: 已办列表重复显示同一业务的多条记录
|
||||||
|
- **根本原因**: 每笔业务在TShwfProcessNode表中有多条记录(每个环节一条),DISTINCT无法合并
|
||||||
|
- **修复方案**: 使用窗口函数 `ROW_NUMBER() OVER (PARTITION BY BIZSEQID ORDER BY LAUPTIME DESC)` 去重,只取每笔业务最新的一条记录
|
||||||
|
|
||||||
|
## 未解决问题
|
||||||
|
暂无
|
||||||
|
|
||||||
|
## 备注
|
||||||
|
- 本次修改涉及TaskController.java和TSTaskListMapper.xml两个文件
|
||||||
|
- 由于环境限制,未能执行Maven编译验证,建议在IDE中验证后推送
|
||||||
|
|
@ -0,0 +1,209 @@
|
||||||
|
# XQ-20260414-002 开发思路与改动
|
||||||
|
|
||||||
|
## 问题分析
|
||||||
|
|
||||||
|
### 问题1根因分析
|
||||||
|
查看 `TSTaskListMapper.xml` 的 `selectFinishUnionTaskPage` 查询:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT DISTINCT ta.TASKLISTID, ta.WORKFLOWID, ...
|
||||||
|
FROM TSTaskList ta
|
||||||
|
LEFT JOIN TShwfProcessNode n ON ta.WorkflowID = n.processid
|
||||||
|
WHERE ta.BUSSTATUS = 2
|
||||||
|
AND ta.WORKFLOWID IN (
|
||||||
|
SELECT DISTINCT WORKFLOWID FROM tsopinion tso
|
||||||
|
<where>
|
||||||
|
<if test="customParamMap.childUnitSwitch != null and customParamMap.childUnitSwitch != ''">
|
||||||
|
-- 有 childUnitSwitch 时的过滤逻辑
|
||||||
|
</if>
|
||||||
|
-- 注意:如果 childUnitSwitch 为空或不存在,整个 WHERE 块不生效
|
||||||
|
-- 导致子查询返回 tsopinion 表中所有 WORKFLOWID
|
||||||
|
</where>
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
**根本原因**:当 `childUnitSwitch` 参数不存在时,子查询没有任何过滤条件,返回 tsopinion 表中所有 WORKFLOWID,导致已办列表显示全自治区的记录。
|
||||||
|
|
||||||
|
### 问题2根因分析
|
||||||
|
查询结果中每条 TASKLIST 记录会对应 TShwfProcessNode 表中的多个节点记录(每个环节一个),而 DISTINCT 无法将同一业务的多条记录合并成一条。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 解决方案
|
||||||
|
|
||||||
|
### 修复1: 已办列表按机构范围过滤
|
||||||
|
|
||||||
|
**修改文件**: `TaskController.java` (第280行附近 `finishTaskUnionPage` 方法)
|
||||||
|
|
||||||
|
**当前逻辑**:
|
||||||
|
```java
|
||||||
|
if (customParamMap != null && customParamMap.containsKey("childUnitSwitch")) {
|
||||||
|
// 只有当 childUnitSwitch 存在时才设置机构过滤参数
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**修改后逻辑**:
|
||||||
|
```java
|
||||||
|
// 获取当前用户机构信息
|
||||||
|
String myOrgNumber = StringUtils.clearRegionZero(curUser.getRegionID());
|
||||||
|
if (StringUtils.isNotBlank(myOrgNumber)) {
|
||||||
|
customParamMap.put("myOrgNumber", myOrgNumber);
|
||||||
|
customParamMap.put("myOrgNumberLike", myOrgNumber + "%");
|
||||||
|
|
||||||
|
// 判断是否为自治区账号(机构等级为1)
|
||||||
|
Map<String, String> orgParams = new HashMap<>();
|
||||||
|
orgParams.put("deleted", "0");
|
||||||
|
orgParams.put("unittype", "1");
|
||||||
|
orgParams.put("orgNumber", myOrgNumber);
|
||||||
|
OrgUnits org = aicorgService.queryByOrgNumberMap(orgParams);
|
||||||
|
boolean isAutonomousRegion = org != null && org.getOrgLevel() != null && org.getOrgLevel() == 1;
|
||||||
|
|
||||||
|
// 设置是否查看下级单位标志
|
||||||
|
// childUnitSwitch = "1" 表示查看下级
|
||||||
|
// childUnitSwitch 不传或为 "0" 表示不查看下级
|
||||||
|
// 但自治区账号即使不查看下级,也应该能看到本级数据
|
||||||
|
if (customParamMap.containsKey("childUnitSwitch")) {
|
||||||
|
// 前端明确传了 childUnitSwitch,使用前端值
|
||||||
|
} else {
|
||||||
|
// 前端没传,默认不查看下级(childUnitSwitch = "0")
|
||||||
|
customParamMap.put("childUnitSwitch", "0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**同步修改 Mapper XML**: 确保当 `childUnitSwitch = "0"` 时,也要有机构过滤逻辑(不仅仅是 "1" 时)。
|
||||||
|
|
||||||
|
### 修复2: 每笔业务只显示一条记录
|
||||||
|
|
||||||
|
**方案**: 在外层查询使用 GROUP BY BIZSEQID,选择每个业务最新的一条记录。
|
||||||
|
|
||||||
|
**修改文件**: `TSTaskListMapper.xml` 的 `selectFinishUnionTaskPage`
|
||||||
|
|
||||||
|
**当前**:
|
||||||
|
```sql
|
||||||
|
SELECT * FROM (
|
||||||
|
(select DISTINCT ta.TASKLISTID, ta.WORKFLOWID, ta.BIZSEQID, ...
|
||||||
|
from TSTaskList ta
|
||||||
|
LEFT JOIN TShwfProcessNode n on ta.WorkflowID = n.processid
|
||||||
|
where ...)
|
||||||
|
) m
|
||||||
|
ORDER BY m.LAUPTIME DESC
|
||||||
|
```
|
||||||
|
|
||||||
|
**修改后**:
|
||||||
|
```sql
|
||||||
|
SELECT m.* FROM (
|
||||||
|
SELECT * FROM (
|
||||||
|
(select ... from TSTaskList ... UNION all select ... from tsrevtasklist ...)
|
||||||
|
) sub
|
||||||
|
GROUP BY sub.BIZSEQID
|
||||||
|
HAVING sub.LAUPTIME = MAX(sub.LAUPTIME) -- 取每笔业务最新的一条
|
||||||
|
) m
|
||||||
|
ORDER BY m.LAUPTIME DESC
|
||||||
|
```
|
||||||
|
|
||||||
|
或者使用窗口函数:
|
||||||
|
```sql
|
||||||
|
SELECT * FROM (
|
||||||
|
SELECT t.*,
|
||||||
|
ROW_NUMBER() OVER (PARTITION BY t.BIZSEQID ORDER BY t.LAUPTIME DESC) as rn
|
||||||
|
FROM (
|
||||||
|
(select ... from TSTaskList ta ... UNION all select ... from tsrevtasklist ...)
|
||||||
|
) t
|
||||||
|
) tt
|
||||||
|
WHERE tt.rn = 1
|
||||||
|
ORDER BY tt.LAUPTIME DESC
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 具体代码改动
|
||||||
|
|
||||||
|
### 1. TaskController.java 修改(约第290行)
|
||||||
|
|
||||||
|
在 `finishTaskUnionPage` 方法中,修改机构过滤逻辑:
|
||||||
|
|
||||||
|
```java
|
||||||
|
// 原有代码(只处理 childUnitSwitch 存在时):
|
||||||
|
// if (customParamMap != null && customParamMap.containsKey("childUnitSwitch")) {
|
||||||
|
|
||||||
|
// 修改为:无条件设置机构参数
|
||||||
|
if (customParamMap != null) {
|
||||||
|
String myOrgNumber = StringUtils.clearRegionZero(curUser.getRegionID());
|
||||||
|
if (StringUtils.isNotBlank(myOrgNumber)) {
|
||||||
|
customParamMap.put("myOrgNumber", myOrgNumber);
|
||||||
|
customParamMap.put("myOrgNumberLike", myOrgNumber + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保 childUnitSwitch 有值(前端没传时默认为"0")
|
||||||
|
if (!customParamMap.containsKey("childUnitSwitch")) {
|
||||||
|
customParamMap.put("childUnitSwitch", "0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. TSTaskListMapper.xml 修改(约第580-790行)
|
||||||
|
|
||||||
|
**2.1 修改子查询逻辑**:
|
||||||
|
|
||||||
|
当 `childUnitSwitch = "0"`(不查看下级)时,也需要按机构过滤:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<when test='customParamMap.childUnitSwitch eq "0"'>
|
||||||
|
and (
|
||||||
|
tso.HANDLERID = #{customParamMap.userId}
|
||||||
|
or exists(select 1 from CXAICORG.T_USERS tu
|
||||||
|
left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
|
||||||
|
where tso.HANDLERID = tu.USERID
|
||||||
|
and torg.ORGNUMBER = #{customParamMap.myOrgNumber})
|
||||||
|
)
|
||||||
|
</when>
|
||||||
|
```
|
||||||
|
|
||||||
|
**2.2 添加自治区账号特殊处理**:
|
||||||
|
|
||||||
|
当机构等级为1(自治区)时,不过滤:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<when test='customParamMap.childUnitSwitch eq "0"'>
|
||||||
|
<choose>
|
||||||
|
<when test="customParamMap.isAutonomousRegion != null and customParamMap.isAutonomousRegion == true">
|
||||||
|
<!-- 自治区账号,不过滤,返回所有 -->
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and (
|
||||||
|
tso.HANDLERID = #{customParamMap.userId}
|
||||||
|
or exists(select 1 from CXAICORG.T_USERS tu
|
||||||
|
left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
|
||||||
|
where tso.HANDLERID = tu.USERID
|
||||||
|
and torg.ORGNUMBER = #{customParamMap.myOrgNumber})
|
||||||
|
)
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</when>
|
||||||
|
```
|
||||||
|
|
||||||
|
**2.3 去重逻辑**:
|
||||||
|
|
||||||
|
在外层包装查询结果,按 BIZSEQID 分组取最新:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
SELECT * FROM (
|
||||||
|
SELECT m.*,
|
||||||
|
ROW_NUMBER() OVER (PARTITION BY m.BIZSEQID ORDER BY m.LAUPTIME DESC) as rn
|
||||||
|
FROM (
|
||||||
|
<!-- 现有的 UNION ALL 查询 -->
|
||||||
|
) m
|
||||||
|
) mm
|
||||||
|
WHERE mm.rn = 1
|
||||||
|
ORDER BY mm.LAUPTIME DESC
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
1. **自治区账号识别**:需要在 Controller 层判断并传递 `isAutonomousRegion` 参数
|
||||||
|
2. **兼容性**:确保修改后与现有功能兼容,不要破坏其他业务线的已办查询
|
||||||
|
3. **性能**:去重查询可能影响性能,如果 BIZSEQID 已建立索引应无大碍
|
||||||
|
4. **第3点难点**:如果去重逻辑 SQL 难以修改(涉及多表 UNION),可以在 Service 层用 Java 代码处理,但会增加内存压力
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
# XQ-20260414-002 需求清单
|
||||||
|
|
||||||
|
## 任务信息
|
||||||
|
- **待办编号**: XQ-20260414-002
|
||||||
|
- **标题**: 内蒙信用监管-修复我的已办问题
|
||||||
|
- **到期日**: 2026-04-17
|
||||||
|
- **执行人**: LiRunHao
|
||||||
|
|
||||||
|
## 需求描述
|
||||||
|
|
||||||
|
### 问题1: 已办列表范围问题
|
||||||
|
**现状**: 已办列表显示全自治区的已办记录
|
||||||
|
**期望**: 改为按照"是否查看下级单位已办记录"的规则查询
|
||||||
|
- 否:只显示当前单位的已办记录
|
||||||
|
- 是:显示下级单位的已办记录,自治区账号显示全部已办记录
|
||||||
|
|
||||||
|
**具体案例**: 用户 hl_zhangwg (大杨树镇市场监督管理所) 提交了个体工商户移出异常名录业务 YW202603260005,提交成功后从已办业务中搜索不到办理的业务,全是其他单位的业务。
|
||||||
|
|
||||||
|
### 问题2: 已办记录重复问题
|
||||||
|
**现状**: 当前已办功能将每一笔业务的所有环节(如审批中、审批通过)的记录都显示出来了
|
||||||
|
**期望**: 每一笔业务只显示一条记录,显示当前业务的最新环节
|
||||||
|
|
||||||
|
**说明**: 第3点若查询语句难以修改,可以提出修改的难点,后续优化
|
||||||
|
|
||||||
|
## 涉及范围
|
||||||
|
- 后端接口:`/task/finishTaskUnionPage`
|
||||||
|
- Mapper: `TSTaskListMapper.selectFinishUnionTaskPage`
|
||||||
|
- Service: `TSTaskListServiceImpl.searchFinishTaskUnionPage`
|
||||||
|
|
@ -491,11 +491,25 @@ public class TaskController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (customParamMap != null && customParamMap.containsKey("childUnitSwitch")) {
|
if (customParamMap != null) {
|
||||||
String myOrgNumber = StringUtils.clearRegionZero(curUser.getRegionID());
|
String myOrgNumber = StringUtils.clearRegionZero(curUser.getRegionID());
|
||||||
if (StringUtils.isNotBlank(myOrgNumber)) {
|
if (StringUtils.isNotBlank(myOrgNumber)) {
|
||||||
customParamMap.put("myOrgNumber", myOrgNumber);
|
customParamMap.put("myOrgNumber", myOrgNumber);
|
||||||
customParamMap.put("myOrgNumberLike", myOrgNumber + "%");
|
customParamMap.put("myOrgNumberLike", myOrgNumber + "%");
|
||||||
|
|
||||||
|
// 判断是否为自治区账号(机构等级为1)
|
||||||
|
Map<String, String> orgParams = new HashMap<>();
|
||||||
|
orgParams.put("deleted", "0");
|
||||||
|
orgParams.put("unittype", "1");
|
||||||
|
orgParams.put("orgNumber", myOrgNumber);
|
||||||
|
OrgUnits org = aicorgService.queryByOrgNumberMap(orgParams);
|
||||||
|
boolean isAutonomousRegion = org != null && org.getOrgLevel() != null && org.getOrgLevel() == 1;
|
||||||
|
customParamMap.put("isAutonomousRegion", isAutonomousRegion);
|
||||||
|
}
|
||||||
|
|
||||||
|
// childUnitSwitch 默认值为 "0"(不查看下级)
|
||||||
|
if (!customParamMap.containsKey("childUnitSwitch")) {
|
||||||
|
customParamMap.put("childUnitSwitch", "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -578,108 +578,146 @@
|
||||||
ORDER BY n.OPINIONTYPE DESC LIMIT 1
|
ORDER BY n.OPINIONTYPE DESC LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
<select id="selectFinishUnionTaskPage" resultMap="TaskListUnionMap">
|
<select id="selectFinishUnionTaskPage" resultMap="TaskListUnionMap">
|
||||||
SELECT *
|
SELECT * FROM (
|
||||||
from(
|
SELECT m.*, ROW_NUMBER() OVER (PARTITION BY m.BIZSEQID ORDER BY m.LAUPTIME DESC) as rn FROM (
|
||||||
<choose>
|
<choose>
|
||||||
<when test="customParamMap.finished != null and customParamMap.finished != '' ">
|
<when test="customParamMap.finished != null and customParamMap.finished != '' ">
|
||||||
(select DISTINCT ta.TASKLISTID, ta.WORKFLOWID, ta.BIZSEQID, ta.SIGNUSERID, ta.SENDERORGID, ta.SENDERUSERID, ta.SENDTOORGID, ta.ACCEPTNO, ta.BUSNAME, ta.SIGNTIME,ta.BUSTYPE, ta.BUSSTATUS, ta.LINKNAME, ta.AUDITDEPTTYPE, ta.ISSIGNON,ta.SIGNLOGINNAME, ta.SENDERTIME, ta.SENDERNAME, ta.ACCEPTGROUPID, ta.AREA_CODE, ta.LAUPTIME , n.currentNode as currentNodeOrBizStatus,SUBSTR(n.NODEFLOW, 1, INSTR(n.NODEFLOW, '_') - 1) as lastNode, ta.CREATETIME
|
(select DISTINCT ta.TASKLISTID, ta.WORKFLOWID, ta.BIZSEQID, ta.SIGNUSERID, ta.SENDERORGID, ta.SENDERUSERID, ta.SENDTOORGID, ta.ACCEPTNO, ta.BUSNAME, ta.SIGNTIME,ta.BUSTYPE, ta.BUSSTATUS, ta.LINKNAME, ta.AUDITDEPTTYPE, ta.ISSIGNON,ta.SIGNLOGINNAME, ta.SENDERTIME, ta.SENDERNAME, ta.ACCEPTGROUPID, ta.AREA_CODE, ta.LAUPTIME , n.currentNode as currentNodeOrBizStatus,SUBSTR(n.NODEFLOW, 1, INSTR(n.NODEFLOW, '_') - 1) as lastNode, ta.CREATETIME
|
||||||
from TSTaskList ta
|
from TSTaskList ta
|
||||||
LEFT JOIN TShwfProcessNode n on ta.WorkflowID = n.processid
|
LEFT JOIN TShwfProcessNode n on ta.WorkflowID = n.processid
|
||||||
where ta.BUSSTATUS = 2 AND ta.WORKFLOWID IN (
|
where ta.BUSSTATUS = 2 AND ta.WORKFLOWID IN (
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT WORKFLOWID
|
DISTINCT WORKFLOWID
|
||||||
FROM
|
FROM
|
||||||
tsopinion tso
|
tsopinion tso
|
||||||
<where>
|
<where>
|
||||||
<if test="customParamMap.childUnitSwitch != null and customParamMap.childUnitSwitch != ''">
|
|
||||||
<choose>
|
<choose>
|
||||||
<when test='customParamMap.childUnitSwitch eq "1"'>
|
<when test='customParamMap.childUnitSwitch eq "1"'>
|
||||||
and (
|
and (
|
||||||
tso.HANDLERID = #{customParamMap.userId}
|
tso.HANDLERID = #{customParamMap.userId}
|
||||||
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
|
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
|
||||||
where tso.HANDLERID = tu.USERID and torg.ORGNUMBER like #{customParamMap.myOrgNumberLike}
|
where tso.HANDLERID = tu.USERID and torg.ORGNUMBER like #{customParamMap.myOrgNumberLike}
|
||||||
<!-- and torg.ORGNUMBER != #{customParamMap.myOrgNumber}-->
|
|
||||||
))
|
))
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<when test='customParamMap.childUnitSwitch eq "0"'>
|
||||||
and tso.HANDLERID = #{customParamMap.userId}
|
<choose>
|
||||||
</otherwise>
|
<when test="customParamMap.isAutonomousRegion != null and customParamMap.isAutonomousRegion == true">
|
||||||
|
<!-- 自治区账号,不过滤 -->
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and (
|
||||||
|
tso.HANDLERID = #{customParamMap.userId}
|
||||||
|
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
|
||||||
|
where tso.HANDLERID = tu.USERID and torg.ORGNUMBER = #{customParamMap.myOrgNumber}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
</where>) and REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1)
|
||||||
</where>) and REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1)
|
union all
|
||||||
union all
|
(select DISTINCT t.TASKLISTID, t.WORKFLOWID, t.BIZSEQID, t.SIGNUSERID, t.SENDERORGID, t.SENDERUSERID, t.SENDTOORGID, t.ACCEPTNO, t.BUSNAME, t.SIGNTIME, t.BUSTYPE, t.BUSSTATUS, t.LINKNAME, t.AUDITDEPTTYPE, t.ISSIGNON, t.SIGNLOGINNAME, t.SENDERTIME, t.SENDERNAME, t.ACCEPTGROUPID, t.AREA_CODE, t.LAUPTIME , n.currentNode as currentNodeOrBizStatus ,SUBSTR(n.NODEFLOW, 1, INSTR(n.NODEFLOW, '_') - 1) as lastNode, t.CREATETIME
|
||||||
(select DISTINCT t.TASKLISTID, t.WORKFLOWID, t.BIZSEQID, t.SIGNUSERID, t.SENDERORGID, t.SENDERUSERID, t.SENDTOORGID, t.ACCEPTNO, t.BUSNAME, t.SIGNTIME, t.BUSTYPE, t.BUSSTATUS, t.LINKNAME, t.AUDITDEPTTYPE, t.ISSIGNON, t.SIGNLOGINNAME, t.SENDERTIME, t.SENDERNAME, t.ACCEPTGROUPID, t.AREA_CODE, t.LAUPTIME , n.currentNode as currentNodeOrBizStatus ,SUBSTR(n.NODEFLOW, 1, INSTR(n.NODEFLOW, '_') - 1) as lastNode, t.CREATETIME
|
from tsrevtasklist t
|
||||||
from tsrevtasklist t
|
LEFT JOIN TShwfProcessNode n on t.WorkflowID = n.processid
|
||||||
LEFT JOIN TShwfProcessNode n on t.WorkflowID = n.processid
|
where t.BUSSTATUS = 2 AND t.WORKFLOWID IN (
|
||||||
where t.BUSSTATUS = 2 AND t.WORKFLOWID IN (
|
SELECT
|
||||||
SELECT
|
DISTINCT WORKFLOWID
|
||||||
DISTINCT WORKFLOWID
|
FROM
|
||||||
FROM
|
tsopinion tso
|
||||||
tsopinion tso
|
<where>
|
||||||
<where>
|
|
||||||
<if test="customParamMap.childUnitSwitch != null and customParamMap.childUnitSwitch != ''">
|
|
||||||
<choose>
|
<choose>
|
||||||
<when test='customParamMap.childUnitSwitch eq "1"'>
|
<when test='customParamMap.childUnitSwitch eq "1"'>
|
||||||
and (
|
and (
|
||||||
tso.HANDLERID = #{customParamMap.userId}
|
tso.HANDLERID = #{customParamMap.userId}
|
||||||
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
|
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
|
||||||
where tso.HANDLERID = tu.USERID and torg.ORGNUMBER like #{customParamMap.myOrgNumberLike}
|
where tso.HANDLERID = tu.USERID and torg.ORGNUMBER like #{customParamMap.myOrgNumberLike}
|
||||||
<!-- and torg.ORGNUMBER != #{customParamMap.myOrgNumber}-->
|
|
||||||
))
|
))
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<when test='customParamMap.childUnitSwitch eq "0"'>
|
||||||
and tso.HANDLERID = #{customParamMap.userId}
|
<choose>
|
||||||
</otherwise>
|
<when test="customParamMap.isAutonomousRegion != null and customParamMap.isAutonomousRegion == true">
|
||||||
|
<!-- 自治区账号,不过滤 -->
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and (
|
||||||
|
tso.HANDLERID = #{customParamMap.userId}
|
||||||
|
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
|
||||||
|
where tso.HANDLERID = tu.USERID and torg.ORGNUMBER = #{customParamMap.myOrgNumber}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
</where>
|
||||||
</where>
|
) and REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1)
|
||||||
) and REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1)
|
union all
|
||||||
union all
|
</when>
|
||||||
</when>
|
</choose>
|
||||||
</choose>
|
(select DISTINCT t.TASKLISTID, t.WORKFLOWID, t.BIZSEQID, t.SIGNUSERID, t.SENDERORGID, t.SENDERUSERID, t.SENDTOORGID, t.ACCEPTNO, t.BUSNAME, t.SIGNTIME, t.BUSTYPE, t.BUSSTATUS, t.LINKNAME, t.AUDITDEPTTYPE, t.ISSIGNON, t.SIGNLOGINNAME, t.SENDERTIME, t.SENDERNAME, t.ACCEPTGROUPID, t.AREA_CODE, t.LAUPTIME , b.STATUS as currentNodeOrBizStatus, null as lastNode, t.CREATETIME
|
||||||
(select DISTINCT t.TASKLISTID, t.WORKFLOWID, t.BIZSEQID, t.SIGNUSERID, t.SENDERORGID, t.SENDERUSERID, t.SENDTOORGID, t.ACCEPTNO, t.BUSNAME, t.SIGNTIME, t.BUSTYPE, t.BUSSTATUS, t.LINKNAME, t.AUDITDEPTTYPE, t.ISSIGNON, t.SIGNLOGINNAME, t.SENDERTIME, t.SENDERNAME, t.ACCEPTGROUPID, t.AREA_CODE, t.LAUPTIME , b.STATUS as currentNodeOrBizStatus, null as lastNode, t.CREATETIME
|
from tsrevtasklist t, tsbizrevlist b,TShwfProcessNode n
|
||||||
from tsrevtasklist t, tsbizrevlist b,TShwfProcessNode n
|
where t.bizseqid = b.bizseq and t.busstatus = '0' and b.ISREMOVE = '0' AND REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1
|
||||||
where t.bizseqid = b.bizseq and t.busstatus = '0' and b.ISREMOVE = '0' AND REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1
|
and t.WorkflowID = n.processid and t.WORKFLOWID in (SELECT DISTINCT WORKFLOWID FROM tsopinion tso
|
||||||
and t.WorkflowID = n.processid and t.WORKFLOWID in (SELECT DISTINCT WORKFLOWID FROM tsopinion tso
|
<where>
|
||||||
<where>
|
|
||||||
<if test="customParamMap.childUnitSwitch != null and customParamMap.childUnitSwitch != ''">
|
|
||||||
<choose>
|
<choose>
|
||||||
<when test='customParamMap.childUnitSwitch eq "1"'>
|
<when test='customParamMap.childUnitSwitch eq "1"'>
|
||||||
and (
|
and (
|
||||||
tso.HANDLERID = #{customParamMap.userId}
|
tso.HANDLERID = #{customParamMap.userId}
|
||||||
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
|
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
|
||||||
where tso.HANDLERID = tu.USERID and torg.ORGNUMBER like #{customParamMap.myOrgNumberLike}
|
where tso.HANDLERID = tu.USERID and torg.ORGNUMBER like #{customParamMap.myOrgNumberLike}
|
||||||
<!-- and torg.ORGNUMBER != #{customParamMap.myOrgNumber}-->
|
|
||||||
))
|
))
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<when test='customParamMap.childUnitSwitch eq "0"'>
|
||||||
and tso.HANDLERID = #{customParamMap.userId}
|
<choose>
|
||||||
</otherwise>
|
<when test="customParamMap.isAutonomousRegion != null and customParamMap.isAutonomousRegion == true">
|
||||||
|
<!-- 自治区账号,不过滤 -->
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and (
|
||||||
|
tso.HANDLERID = #{customParamMap.userId}
|
||||||
|
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
|
||||||
|
where tso.HANDLERID = tu.USERID and torg.ORGNUMBER = #{customParamMap.myOrgNumber}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
</where>))
|
||||||
</where>))
|
union all
|
||||||
union all
|
(select DISTINCT ta.TASKLISTID, ta.WORKFLOWID, ta.BIZSEQID, ta.SIGNUSERID, ta.SENDERORGID, ta.SENDERUSERID, ta.SENDTOORGID, ta.ACCEPTNO, ta.BUSNAME, ta.SIGNTIME, ta.BUSTYPE, ta.BUSSTATUS, ta.LINKNAME, ta.AUDITDEPTTYPE, ta.ISSIGNON,ta.SIGNLOGINNAME, ta.SENDERTIME, ta.SENDERNAME, ta.ACCEPTGROUPID, ta.AREA_CODE, ta.LAUPTIME, n.currentNode as currentNodeOrBizStatus,SUBSTR(n.NODEFLOW, 1, INSTR(n.NODEFLOW, '_') - 1) as lastNode, ta.CREATETIME
|
||||||
(select DISTINCT ta.TASKLISTID, ta.WORKFLOWID, ta.BIZSEQID, ta.SIGNUSERID, ta.SENDERORGID, ta.SENDERUSERID, ta.SENDTOORGID, ta.ACCEPTNO, ta.BUSNAME, ta.SIGNTIME, ta.BUSTYPE, ta.BUSSTATUS, ta.LINKNAME, ta.AUDITDEPTTYPE, ta.ISSIGNON,ta.SIGNLOGINNAME, ta.SENDERTIME, ta.SENDERNAME, ta.ACCEPTGROUPID, ta.AREA_CODE, ta.LAUPTIME, n.currentNode as currentNodeOrBizStatus,SUBSTR(n.NODEFLOW, 1, INSTR(n.NODEFLOW, '_') - 1) as lastNode, ta.CREATETIME
|
from TSTaskList ta
|
||||||
from TSTaskList ta
|
LEFT JOIN TSTwfProcessNode n on ta.WorkflowID = n.processid
|
||||||
LEFT JOIN TSTwfProcessNode n on ta.WorkflowID = n.processid
|
where ta.BUSSTATUS in ('-1', '0', '1', '3', '5') AND REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1
|
||||||
where ta.BUSSTATUS in ('-1', '0', '1', '3', '5') AND REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1
|
|
||||||
<if test="customParamMap.childUnitSwitch != null and customParamMap.childUnitSwitch != ''">
|
|
||||||
<choose>
|
<choose>
|
||||||
<when test='customParamMap.childUnitSwitch eq "1"'>
|
<when test='customParamMap.childUnitSwitch eq "1"'>
|
||||||
and (
|
and (
|
||||||
n.CURRUSERID = #{customParamMap.userId}
|
n.CURRUSERID = #{customParamMap.userId}
|
||||||
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
|
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
|
||||||
where n.CURRUSERID = tu.USERID and torg.ORGNUMBER like #{customParamMap.myOrgNumberLike}
|
where n.CURRUSERID = tu.USERID and torg.ORGNUMBER like #{customParamMap.myOrgNumberLike}
|
||||||
<!-- and torg.ORGNUMBER != #{customParamMap.myOrgNumber}-->
|
|
||||||
))
|
))
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<when test='customParamMap.childUnitSwitch eq "0"'>
|
||||||
and n.CURRUSERID = #{customParamMap.userId}
|
<choose>
|
||||||
</otherwise>
|
<when test="customParamMap.isAutonomousRegion != null and customParamMap.isAutonomousRegion == true">
|
||||||
|
<!-- 自治区账号,不过滤 -->
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and (
|
||||||
|
n.CURRUSERID = #{customParamMap.userId}
|
||||||
|
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
|
||||||
|
where n.CURRUSERID = tu.USERID and torg.ORGNUMBER = #{customParamMap.myOrgNumber}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
)
|
||||||
)
|
) m
|
||||||
) m
|
) mm
|
||||||
|
WHERE mm.rn = 1
|
||||||
<where>
|
<where>
|
||||||
<if test="customParamMap != null">
|
<if test="customParamMap != null">
|
||||||
<if test="customParamMap.startDate != null and customParamMap.startDate != '' ">
|
<if test="customParamMap.startDate != null and customParamMap.startDate != '' ">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue