This commit is contained in:
2026-07-02 16:52:08 +08:00
parent 4afb3bd835
commit a79280d16d
5 changed files with 193 additions and 14 deletions
@@ -85,8 +85,8 @@ public class ProposalConfigUnitController {
Sql sql = Sqls.create("""
SELECT
t1.*,
u1.username AS branchSchoolLeader,
u2.username AS unitLeader
GROUP_CONCAT(DISTINCT u1.username ORDER BY u1.username SEPARATOR '、') AS branchSchoolLeader,
GROUP_CONCAT(DISTINCT u2.username ORDER BY u2.username SEPARATOR '、') AS unitLeader
FROM
proposal_undertake t1
LEFT JOIN sys_user_role sur1 ON sur1.underTakeId = t1.id
@@ -108,6 +108,7 @@ public class ProposalConfigUnitController {
cnd.where().orLike("t1.name", pageForm.getSearchKeyword());
}
cnd.and("t1.enable","=", true);
cnd.groupBy("t1.id");
cnd.asc("t1.code");
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
@@ -1,13 +1,18 @@
package com.budwk.app.zhgh.democratic.proposal.controller.query;
import cn.hutool.core.bean.BeanUtil;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result;
import com.budwk.app.flow.engine.util.FlowUtil;
import com.budwk.app.flow.entity.ProcessTask;
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
import com.budwk.app.zhgh.democratic.proposal.controller.vo.ProposalUnitReplyProposalVO;
import com.budwk.app.zhgh.democratic.proposal.models.ProposalConfig;
import com.budwk.app.zhgh.democratic.proposal.models.ProposalReplyUnit;
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
@@ -19,6 +24,7 @@ import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import javax.validation.Valid;
import java.util.*;
import java.util.stream.Collectors;
@@ -131,4 +137,43 @@ public class ProposalQueryUnitReplyController {
return Result.success().addData(Map.of("tableData", tableData, "slaveNeedReply", slaveNeedReply));
}
@At
@SaCheckPermission("proposal.query.unitReply")
@ApiOperation("承办单位提案明细")
public Result getProposalsByUnit(@Valid ProposalSearchParam pageForm, String unitCode) {
Sql sql = Sqls.create("""
SELECT
info.id,
info.code,
info.name,
info.createUserName,
type.name AS typeName,
tcs.fullName AS sessionName,
tcd.`name` AS delegationName,
pru.unitName AS underTakeUnitName,
IF(pru.isMaster = 1, '主办', '协办') AS underTakeType,
IFNULL(GROUP_CONCAT(DISTINCT t.displayName), '结束') AS curTaskName
FROM
proposal_reply_unit pru
INNER JOIN proposal_info info ON info.id = pru.proposalId
LEFT JOIN proposal_type type on type.id = info.typeId
LEFT JOIN teacher_congress_session tcs on tcs.id = info.sessionId
LEFT JOIN teacher_congress_delegation tcd on tcd.id = info.delegationId
LEFT JOIN wf_process_instance ins ON ins.businessNo = info.id
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10
$condition
""");
Cnd cnd = Cnd.NEW();
// 明细弹窗按当前届次和点击的承办单位编码查询,返回该单位主办、协办的提案列表。
cnd.andEX("pru.unitCode", "=", unitCode);
ProposalSearchParam.buildSearch(cnd, pageForm);
cnd.groupBy("info.id", "pru.unitName", "pru.isMaster");
sql.setCondition(cnd);
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
List<ProposalUnitReplyProposalVO> list = BeanUtil.copyToList(pagination.getList(), ProposalUnitReplyProposalVO.class);
pagination.setList(list);
return Result.success(pagination);
}
}
@@ -98,9 +98,28 @@ public class ProposalUnderTakeReplyController {
t.finishTime,
t.taskParentId,
t.variable taskVariable,
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
IFNULL(GROUP_CONCAT(DISTINCT nt.taskName),'结束') curTaskKey,
CASE WHEN t.taskState = 20 AND ( rt.id IS NULL OR rt.taskState = 10 ) THEN 1 ELSE 0 END AS canRevoke,
IFNULL((
SELECT GROUP_CONCAT(DISTINCT nt.displayName)
FROM wf_process_task nt
WHERE nt.processInstanceId = ins.id AND nt.taskState = 10
), '结束') curTaskName,
IFNULL((
SELECT GROUP_CONCAT(DISTINCT nt.taskName)
FROM wf_process_task nt
WHERE nt.processInstanceId = ins.id AND nt.taskState = 10
), '结束') curTaskKey,
CASE WHEN t.taskState = 20 AND (
NOT EXISTS (
SELECT 1
FROM wf_process_task rt
WHERE rt.processInstanceId = ins.id AND rt.taskParentId = t.id
)
OR EXISTS (
SELECT 1
FROM wf_process_task rt
WHERE rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
)
) THEN 1 ELSE 0 END AS canRevoke,
IFNULL(pru.unitName, t.variable->>'$.underTakeName') AS underTakeName,
IFNULL(pru.isMaster, IF(JSON_EXTRACT(t.variable, '$.underTakeIsMaster') = true, 1, 0)) AS underTakeIsMaster,
t.variable->>'$.tf_transferUserId' AS tf_transferUserId,
@@ -109,8 +128,6 @@ public class ProposalUnderTakeReplyController {
wf_process_task t
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id
LEFT JOIN proposal_info info ON info.id = ins.businessNo
LEFT JOIN proposal_type type on type.id = info.typeId
LEFT JOIN proposal_merge mer ON mer.proposalId = info.id
@@ -124,6 +141,16 @@ public class ProposalUnderTakeReplyController {
LEFT JOIN sys_user transferUser on transferUser.id = t.variable->>'$.tf_transferUserId'
$condition
""");
// 分页统计只保留任务、办理人和提案查询所需关联,避免完整列表 SQL 的聚合字段参与 count。
Sql countSql = Sqls.create("""
SELECT COUNT(DISTINCT t.id)
FROM
wf_process_task t
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
LEFT JOIN proposal_info info ON info.id = ins.businessNo
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("t.taskName", "in", List.of("master_reply", "slave_reply", "opinion_master_reply"));
@@ -140,11 +167,23 @@ public class ProposalUnderTakeReplyController {
cnd.groupBy("t.id", "pru.unitId", "pru.unitName", "pru.isMaster");
cnd.desc("t.createdAt");
sql.setCondition(cnd);
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
Cnd countCnd = Cnd.NEW();
countCnd.and("t.taskName", "in", List.of("master_reply", "slave_reply", "opinion_master_reply"));
if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) {
countCnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
}
if (approval) {
countCnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.TRANSFER.getCode()));
} else {
countCnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
}
ProposalSearchParam.buildSearch(countCnd, pageForm);
countSql.setCondition(countCnd);
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql, countSql);
List<NutMap> list = pagination.getList();
for (NutMap row : list) {
if (row.getInt("taskIsMaster") == 1) {
if (row.getInt("underTakeIsMaster") == 1) {
boolean b = Stream.of("master_reply", "slave_reply", "school_leader")
.anyMatch(a -> row.getString("curTaskKey").contains(a));
row.setv("canRevoke", b && row.getInt("taskState") == ProcessTaskStateEnum.FINISHED.getCode());
@@ -21,7 +21,11 @@ layout("/layouts/platform.html"){
<el-card shadow="never">
<el-table :data="tableData">
<el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column label="单位名称" prop="unitName" width="400" sortable show-overflow-tooltip></el-table-column>
<el-table-column label="单位名称" prop="unitName" width="400" sortable show-overflow-tooltip>
<template slot-scope="{row}">
<el-link type="primary" @click="openUnitProposals(row)">{{row.unitName}}</el-link>
</template>
</el-table-column>
<el-table-column label="提案总数" prop="sum" sortable></el-table-column>
<el-table-column label="主办提案">
<el-table-column label="提案数量" prop="masterSum" sortable></el-table-column>
@@ -35,6 +39,40 @@ layout("/layouts/platform.html"){
</el-table-column>
</el-table>
</el-card>
<el-dialog :title="detailDialogTitle" :visible.sync="detailDialogVisible" width="80%" :close-on-click-modal="false">
<el-table :data="detailTableData" v-loading="detailLoading" row-key="id">
<el-table-column label="序号" type="index" width="60"></el-table-column>
<el-table-column label="提案编号" prop="code" width="160" show-overflow-tooltip></el-table-column>
<el-table-column label="提案名称" prop="name" min-width="260" show-overflow-tooltip></el-table-column>
<el-table-column label="提案人" prop="createUserName" width="120" show-overflow-tooltip></el-table-column>
<el-table-column label="提案类别" prop="typeName" width="140" show-overflow-tooltip></el-table-column>
<el-table-column label="承办类型" prop="underTakeType" width="100"></el-table-column>
<el-table-column label="当前节点" prop="curTaskName" width="160" show-overflow-tooltip></el-table-column>
<el-table-column label="操作" width="100" fixed="right">
<template slot-scope="{row}">
<el-button size="mini" type="primary" @click="viewSingleProposal(row)">查看</el-button>
</template>
</el-table-column>
</el-table>
<el-row class="el-pagination-container" style="margin-top: 20px">
<el-pagination
@size-change="detailPageSizeChange"
@current-change="detailPageNumberChange"
:current-page="detailPageForm.pageNumber"
:page-sizes="[5,10, 20, 30, 50]"
:page-size="detailPageForm.pageSize"
layout="total, sizes, prev, pager, next"
:total="detailPageForm.totalCount"
></el-pagination>
</el-row>
</el-dialog>
<el-dialog title="提案详情" :visible.sync="proposalInfoVisible" width="1200px" append-to-body top="5vh">
<div style="max-height: 80vh;overflow-y: auto">
<proposal-info ref="infoRef"></proposal-info>
</div>
</el-dialog>
</div>
<script>
@@ -50,7 +88,19 @@ layout("/layouts/platform.html"){
return {
sessionOptions: [],
underTakeOptions: [],
slaveNeedReply: false
slaveNeedReply: false,
detailDialogVisible: false,
detailDialogTitle: "",
detailLoading: false,
detailTableData: [],
detailPageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
sessionId: "",
unitCode: ""
},
proposalInfoVisible: false
}
},
methods: {
@@ -82,6 +132,40 @@ layout("/layouts/platform.html"){
this.slaveNeedReply = res.data.slaveNeedReply
}
})
},
openUnitProposals(row) {
this.detailDialogTitle = row.unitName + "承办提案"
this.detailDialogVisible = true
this.$set(this.detailPageForm, "unitCode", row.unitCode)
this.$set(this.detailPageForm, "sessionId", this.pageForm.sessionId)
this.$set(this.detailPageForm, "pageNumber", 1)
this.loadUnitProposals()
},
loadUnitProposals() {
this.detailLoading = true
this.$axios.post(loc() + "/getProposalsByUnit", this.detailPageForm).then((res) => {
if (res.code === 0) {
this.$set(this, "detailTableData", res.data.list)
this.$set(this.detailPageForm, "totalCount", res.data.totalCount)
}
}).finally(() => {
this.detailLoading = false
})
},
detailPageSizeChange(val) {
this.$set(this.detailPageForm, "pageSize", val)
this.$set(this.detailPageForm, "pageNumber", 1)
this.loadUnitProposals()
},
detailPageNumberChange(val) {
this.$set(this.detailPageForm, "pageNumber", val)
this.loadUnitProposals()
},
viewSingleProposal(row) {
this.proposalInfoVisible = true
this.$nextTick(() => {
this.$refs.infoRef.onOpen(row)
})
}
},
created() {
@@ -305,11 +305,13 @@ layout("/layouts/platform.html"){
getDefaultReplyOpinion(row) {
const contentPlaceholder = "<p>&nbsp;&nbsp;&nbsp;&nbsp;【请在此处填写答复内容】</p><br/>"
const proposalUserName = this.escapeHtml(row.createUserName || "×××")
const proposalName = this.escapeHtml(row.name || "……")
if (row.underTakeIsMaster) {
return [
"<p>×××代表(仅写第一提案人姓名)</p>",
"<p>&nbsp;&nbsp;&nbsp;&nbsp;您提出的关于“……”的提案收悉,现答复如下:</p>",
"<p>" + proposalUserName + "代表</p>",
"<p>&nbsp;&nbsp;&nbsp;&nbsp;您提出的关于“" + proposalName + "”的提案收悉,现答复如下:</p>",
contentPlaceholder,
"<p>&nbsp;&nbsp;&nbsp;&nbsp;感谢您对学校工作的关心和支持。</p>"
].join("")
@@ -324,6 +326,15 @@ layout("/layouts/platform.html"){
].join("")
},
escapeHtml(value) {
return String(value)
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#39;")
},
handleTaskAction(val) {
this.$refs.formRef.validate(valid => {
if (!valid) return
@@ -445,7 +456,6 @@ layout("/layouts/platform.html"){
}
},
created() {
this.pageData()
this.listOpenSession()
}
})