This commit is contained in:
=
2026-04-17 17:20:43 +08:00
parent 34ae7010d6
commit ff26ef5c9e
3 changed files with 644 additions and 0 deletions
@@ -0,0 +1,203 @@
package com.budwk.app.zhgh.democratic.proposal.controller.transact;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result;
import com.budwk.app.flow.entity.ProcessInstance;
import com.budwk.app.flow.entity.ProcessTask;
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.democratic.proposal.models.ProposalSecond;
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
import com.budwk.app.zhgh.democratic.proposal.service.ProposalSecondedService;
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.Static;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.validation.Valid;
import java.util.List;
@IocBean
@At("/platform/proposal/positiveSeconded")
@Slf4j
@Ok("json:full")
@Api(tags = "提案管理系统-提案主动附议")
public class ProposalPositiveSecondedController {
@Inject
private Dao dao;
@Inject
private ProposalCommonService proposalCommonService;
@Inject
private ProposalSecondedService proposalSecondedService;
@At("")
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/positiveSeconded/index.html")
@SaCheckPermission(value = {"proposal.seconded", "h5.proposal.seconded"}, mode = SaMode.OR)
public void index() {
}
@At("/h5")
@Ok("beetl:/platform/zhghh5/democratic/proposal/transact/positiveSeconded/index.html")
@SaCheckPermission(value = {"proposal.seconded", "h5.proposal.seconded"}, mode = SaMode.OR)
public void h5Index() {
}
@At
@SaCheckPermission(value = {"proposal.seconded", "h5.proposal.seconded"}, mode = SaMode.OR)
public Result pageData(@Valid ProposalSearchParam pageForm, boolean approval) {
// 主动附议查询规则:
// 1. 受邀附议的提案不能出现在主动附议中;
// 2. 自己发起的提案不能出现在主动附议“未附议”中;
// 3. 主动附议“未附议”只展示:未被邀请、不是自己写、自己还没主动附议过的提案;
// 4. 主动附议“已附议”只展示:本人已经主动附议过的提案,不混入受邀附议记录;
// 5. 受邀附议识别同时兼容 proposal_second.mode=1 的新数据和 second 节点办理人的历史流程数据。
Sql sql = Sqls.create("""
SELECT
info.*,
type.name AS typeName,
tcs.fullName AS sessionName,
tcd.`name` AS delegationName,
ins.state instanceState,
t.displayName taskName,
IFNULL(GROUP_CONCAT(DISTINCT t.displayName),'结束') curTaskName,
sum( CASE WHEN ps.seconderId=@seconderId and ps.isAgree is not null THEN 1 ELSE 0 END ) as count
FROM
proposal_info info
LEFT JOIN proposal_second ps ON ps.proposalId = info.id
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();
sql.setCondition(cnd);
sql.setParam("seconderId", SecurityUtil.getUserId());
cnd.and("ins.id", "is not", null);
if (approval) {
// 已附议列表保留本人已主动附议过的提案,后续流转到委员会立案等节点后仍可查看。
cnd.and("t.taskName", "in", List.of("invite", "second", "delegation", "committee"));
cnd.and("ps.seconderId", "=", SecurityUtil.getUserId());
cnd.and("ps.mode", "=", false);
cnd.and("ps.isAgree", "is not", null);
// 已附议列表也排除“被邀请附议”的提案,保证这里只展示主动附议记录。
cnd.and(new Static("info.id not in (select proposalId from proposal_second where seconderId = '%s' and mode = 1)".formatted(SecurityUtil.getUserId())));
cnd.and(new Static("""
info.id not in (
select ins2.businessNo
from wf_process_instance ins2
inner join wf_process_task t2 on t2.processInstanceId = ins2.id and t2.taskName = 'second'
inner join wf_process_task_actor ta2 on ta2.processTaskId = t2.id
where ta2.actorId = '%s'
)
""".formatted(SecurityUtil.getUserId())));
} else {
// 未附议列表只保留团长审核结束前的流程节点。
// 一旦流转到提案委员会立案阶段,主动附议页面就不再展示该提案。
cnd.and("t.taskName", "in", List.of("invite", "second", "delegation"));
// 未附议列表中排除自己发起的提案,已附议列表保留本人已主动附议记录。
cnd.and("info.createdBy", "!=", SecurityUtil.getUserId());
// 主动附议列表只查询当前用户可主动附议的提案。
// 这里同时兼容两类受邀附议识别方式:
// 1. proposal_second.mode = 1 的新数据;
// 2. 流程中存在当前用户的 second 节点办理记录的历史数据。
cnd.and(new Static("info.id not in (select proposalId from proposal_second where seconderId = '%s' and mode = 1)".formatted(SecurityUtil.getUserId())));
cnd.and(new Static("""
info.id not in (
select ins2.businessNo
from wf_process_instance ins2
inner join wf_process_task t2 on t2.processInstanceId = ins2.id and t2.taskName = 'second'
inner join wf_process_task_actor ta2 on ta2.processTaskId = t2.id
where ta2.actorId = '%s'
)
""".formatted(SecurityUtil.getUserId())));
cnd.and(new Static("info.id not in (select proposalId from proposal_second where seconderId = '%s' and isAgree is not null)".formatted(SecurityUtil.getUserId())));
}
cnd.groupBy("info.id");
ProposalSearchParam.buildSearch(cnd, pageForm);
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@Aop(TransAop.READ_COMMITTED)
@ApiOperation("主动附议")
@SLog(tag = "提案管理系统-主动附议", msg = "主动附议")
@SaCheckPermission(value = {"proposal.seconded", "h5.proposal.seconded"}, mode = SaMode.OR)
public Result handle(@Param("proposalId") String proposalId,
@Param("opinion") String opinion,
@Param("submitType") Integer submitType) {
Result validateResult = validateBeforeDelegation(proposalId);
if (validateResult.getCode() != 0) {
return validateResult;
}
return proposalSecondedService.handlePositiveSecond(proposalId, opinion, submitType);
}
@At
@SaCheckPermission(value = {"proposal.seconded", "h5.proposal.seconded"}, mode = SaMode.OR)
public Result listPositiveSeconded(String bizId) {
List<ProposalSecond> list = dao.query(
ProposalSecond.class,
Cnd.where(ProposalSecond::getProposalId, "=", bizId).and(ProposalSecond::getMode, "=", false)
);
return Result.success(list);
}
@At
@SaCheckPermission(value = {"proposal.seconded", "h5.proposal.seconded"}, mode = SaMode.OR)
public Result validateCanSeconded(String proposalId) {
return validateBeforeDelegation(proposalId);
}
/**
* 主动附议只允许发生在团长审核完成之前。
*/
private Result validateBeforeDelegation(String proposalId) {
ProcessInstance processInstance = dao.fetch(ProcessInstance.class, Cnd.where("businessNo", "=", proposalId));
if (processInstance == null) {
return Result.error(99, "未查询到提案流程信息");
}
int delegationFinishedCount = dao.count(
ProcessTask.class,
Cnd.where("processInstanceId", "=", processInstance.getId())
.and("taskName", "=", "delegation")
.and("taskState", "=", ProcessTaskStateEnum.FINISHED.getCode())
);
if (delegationFinishedCount > 0) {
return Result.error(99, "团长已审核,不能再主动附议");
}
int availableTaskCount = dao.count(
ProcessTask.class,
Cnd.where("processInstanceId", "=", processInstance.getId())
.and("taskState", "=", ProcessTaskStateEnum.DOING.getCode())
.and("taskName", "in", List.of("invite", "second", "delegation"))
);
if (availableTaskCount == 0) {
return Result.error(99, "当前提案不在主动附议阶段");
}
return Result.success();
}
}
@@ -0,0 +1,221 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app">
<guava ref="guava">
<el-card shadow="never">
<search @search="doSearch">
<search-item label="教代会">
<el-select @change="meetingChange" clearable filterable placeholder="请选择所属教代会"
v-model="pageForm.sessionId">
<el-option :key="item.id" :label="item.fullName" :value="item.id"
v-for="item in sessionOptions"></el-option>
</el-select>
</search-item>
<search-item label="提案名称">
<el-input v-model="pageForm.name" placeholder="请输入提案名称" @keyup.enter.native="doSearch" clearable
style="width: 100%"></el-input>
</search-item>
<search-item label="姓名/工号">
<el-input clearable placeholder="请输入姓名或工号" v-model="pageForm.createUserKeyword"
@keyup.enter.native="doSearch"></el-input>
</search-item>
<search-item label="代表团">
<el-select clearable filterable placeholder="请选择所属代表团" v-model="pageForm.delegationId">
<el-option :key="item.id" :label="item.name" :value="item.id"
v-for="item in delegationOptions"></el-option>
</el-select>
</search-item>
</search>
</el-card>
<el-card shadow="never">
<table-tool :columns.sync="tableColumns">
<el-radio-group v-model="pageForm.approval" size="small" @change="doSearch">
<el-radio-button :label="true">已附议</el-radio-button>
<el-radio-button :label="false">未附议</el-radio-button>
</el-radio-group>
</table-tool>
<el-table :data="tableData" @sort-change="pageOrder" style="width: 100%">
<el-table-column label="序号" width="50" type="index" :index="indexMethod" fixed="left"></el-table-column>
<el-table-column
:label="column.label"
:prop="column.prop"
:key="column.key"
:min-width="column.width"
:fixed="column.fixed"
show-overflow-tooltip
v-for="column in tableColumns"
v-if="column.visible !== false"
>
<template v-if="column.prop === 'caseFilingResult'" scope="{row}">
<dict-tag :options="dict.type.PROPOSAL_CASE_FILING_RESULT"
:value="row.caseFilingResult"></dict-tag>
</template>
<template v-else-if="column.prop === 'merge'" scope="{row}">
<el-tag v-if="row.merge" size="small">是</el-tag>
</template>
<template v-else-if="column.prop === 'instanceState'" scope="{row}">
<enum-tag :value="row.instanceState" name="ProcessInstanceStateEnum" label_key="message"
size="small"></enum-tag>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="300px">
<template slot-scope="{row}">
<el-button @click="openView(row)" size="mini" type="primary">查看</el-button>
<el-button v-if="row.count === 0" @click="openAudit(row)" size="mini" type="primary">附议</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<template #edit>
<proposal-info ref="proposalInfoRef">
<div v-if="showApprovalForm">
<div class="process-title">主动附议</div>
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="0" label-suffix=":"
class="flow-task-form">
<el-form-item label="审批意见" prop="tf_opinion"
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
</el-form-item>
</el-form>
<el-row type="flex" justify="end">
<el-button @click="$refs.guava.index()" size="small">取消</el-button>
<el-button @click="handleTaskAction(20)" size="small" type="danger">不同意</el-button>
<el-button @click="handleTaskAction(1)" size="small" type="primary">同意</el-button>
</el-row>
</div>
</proposal-info>
</template>
</guava>
</div>
<script nonce="${cspNonce!}">
<!--#include('../../common/info.js'){}#-->
new Vue({
el: "#app",
store,
mixins: [initTableMixins],
components: {
"proposal-info": PROPOSAL_INFO
},
data() {
return {
tableColumns: [
{label: "提案编号", prop: "code"},
{label: "提案名称", prop: "name", width: "200px"},
{label: "提案人", prop: "createUserName"},
{label: "提案类别", prop: "typeName"},
{label: "代表团", prop: "delegationName"},
{label: "当前节点", prop: "curTaskName"},
{label: "流程状态", prop: "instanceState"}
],
pageForm: {
approval: false
},
showApprovalForm: false,
sessionOptions: [],
delegationOptions: [],
row: {},
}
},
methods: {
openView(row) {
this.$refs.guava.edit(() => {
this.showApprovalForm = false
this.$refs.proposalInfoRef.onOpen(row)
})
},
async openAudit(row) {
const validatePass = await this.validateCanSeconded(row.id)
if (!validatePass) {
return
}
this.row = row
this.$refs.guava.edit(() => {
this.showApprovalForm = true
this.formData = {
tf_opinion: "同意该提案"
}
this.$refs.proposalInfoRef.onOpen(row)
})
},
validateCanSeconded(proposalId) {
return this.$axios.post("/platform/proposal/positiveSeconded/validateCanSeconded", {
proposalId: proposalId
}).then((res) => {
if (res.code !== 0) {
this.$message.error(res.msg)
return false
}
return true
})
},
handleTaskAction(val) {
this.$refs.formRef.validate(valid => {
if (!valid) return
this.$confirm("您确定要提交吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$axios.post("/platform/proposal/positiveSeconded/handle", {
proposalId: this.row.id,
opinion: this.formData.tf_opinion,
submitType: val,
}).then((res) => {
if (res.code === 0) {
this.$refs.guava.index()
this.$message.success(res.msg)
this.doSearch()
}
})
})
})
},
async meetingChange() {
this.formData.delegationId = null
this.formData.committeeId = null
this.doSearch()
this.listDelegation()
},
listOpenSession() {
this.$axios.post("/platform/proposal/common/listOpenSession").then((res) => {
if (res.code === 0) {
this.sessionOptions = res.data
if (this.sessionOptions) {
this.$set(this.pageForm, "sessionId", this.sessionOptions[0].id)
this.pageData()
this.listDelegation()
}
}
})
},
listDelegation() {
this.$axios.post("/platform/proposal/common/listDelegation", {sessionId: this.pageForm.sessionId}).then((res) => {
if (res.code === 0) {
this.delegationOptions = res.data
}
})
},
},
created() {
this.pageData()
this.listOpenSession()
this.listDelegation()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,220 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<div id="app" v-cloak>
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="主动附议" placeholder fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-search
v-model="pageForm.name"
:show-action="false"
:reverse-color="false"
input-align="left"
placeholder="请输入提案名称搜索"
@search="doSearch"
></van-search>
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item v-model="pageForm.sessionId" :options="sessionOptions" :multiple="false"
@change="sessionChange"></van-dropdown-item>
<van-dropdown-item
v-model="pageForm.delegationId"
:options="delegationOptions"
@change="doSearch"
></van-dropdown-item>
</van-dropdown-menu>
<van-tabs v-model="pageForm.approvalText"
@change="(val)=>{this.pageForm.approval = val==='1';this.doSearch();}">
<van-tab title="已附议" name="1"></van-tab>
<van-tab title="未附议" name="0"></van-tab>
</van-tabs>
</van-sticky>
<table-list api="/platform/proposal/positiveSeconded/pageData" :page_form.sync="pageForm" @ready="onReady"
ref="tableListRef"
title="name">
<template v-slot="{index,row}">
<table-column label="提案编号">{{row.code}}</table-column>
<table-column label="提案类别">{{row.typeName}}</table-column>
<table-column label="提案人">{{row.createUserName}}</table-column>
<table-column label="代表团">{{row.delegationName}}</table-column>
<table-column label="当前节点">{{row.curTaskName}}</table-column>
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn" v-if="row.count === 0" @click="onApproval(row)">
<i class="fa fa-edit"></i>
<span>附议</span>
</div>
</template>
</table-list>
<proposal-info ref="proposalInfoRef">
<div v-if="showApprovalForm">
<div class="process-title">主动附议</div>
<van-form ref="formRef">
<van-field
v-model="formData.tf_opinion"
name="tf_opinion"
label="审批意见"
placeholder="请输入审批意见"
:rules="[{ required: true, message: '请填写审批意见' }]"
required
maxlength="100"
show-word-limit
></van-field>
</van-form>
<div style="display: flex; justify-content: space-between; column-gap: 10px; padding: 10px">
<van-button type="danger" block @click="handleTaskAction(20)">不同意</van-button>
<van-button type="primary" block @click="handleTaskAction(1)">同意</van-button>
</div>
</div>
</proposal-info>
</div>
<script nonce="${cspNonce!}">
<!--#include("../../common/info.js"){}#-->
const vue = new Vue({
el: "#app",
store,
data() {
return {
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
name: null,
sessionId: null,
approvalText: "0",
approval: false,
delegationId: null,
},
sessionOptions: [],
delegationOptions: [
{
text: "全部代表团",
value: null
}
],
formData: {},
showApprovalForm: false,
rules: {
approvalSignature: [{required: true, message: "请签字"}]
},
row: {},
}
},
components: {
"proposal-info": PROPOSAL_INFO
},
methods: {
onReady() {
this.listSession()
},
sessionChange() {
this.pageForm.delegationId = null
if (this.pageForm.sessionId) {
this.listDelegation()
} else {
this.delegationOptions = [
{
text: "全部代表团",
value: null
}
]
}
this.doSearch()
},
listDelegation() {
this.$axios.post("/platform/proposal/common/listDelegation", { sessionId: this.pageForm.sessionId }).then((res) => {
if (res.code === 0) {
this.delegationOptions = [
{
text: "全部代表团",
value: null
}
].concat(res.data.map((v) => ({ text: v.name, value: v.id })))
}
})
},
listSession() {
this.$axios.post("/platform/proposal/common/listSession").then((res) => {
if (res.code === 0) {
this.sessionOptions = res.data.map((v) => ({text: v.fullName, value: v.id}))
if (this.sessionOptions.length > 0) {
this.pageForm.sessionId = this.sessionOptions[0].value
this.doSearch()
this.listDelegation()
}
}
})
},
onView(row) {
this.showApprovalForm = false
this.$refs.proposalInfoRef.onOpen(row)
},
async onApproval(row) {
const validatePass = await this.validateCanSeconded(row.id)
if (!validatePass) {
return
}
this.row = row
this.showApprovalForm = true
this.$refs.proposalInfoRef.onOpen(row)
this.formData = {
tf_opinion: "同意该提案"
}
},
validateCanSeconded(proposalId) {
return this.$axios.post("/platform/proposal/positiveSeconded/validateCanSeconded", {
proposalId: proposalId
}).then((res) => {
if (res.code !== 0) {
this.$toast(res.msg)
return false
}
return true
})
},
async handleTaskAction(val) {
try {
await this.$refs.formRef.validate()
this.$dialog.confirm({
title: "提示",
message: "您确定要提交吗?"
}).then(() => {
this.$axios.post("/platform/proposal/positiveSeconded/handle", {
proposalId: this.row.id,
opinion: this.formData.tf_opinion,
submitType: val,
}).then((res) => {
if (res.code === 0) {
this.$refs.proposalInfoRef.onClose()
this.$toast.success(res.msg)
this.doSearch()
}
})
}).catch(() => {})
} catch (error) {}
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
}
})
</script>
<!--#
}
#-->