This commit is contained in:
@jyuhsin
2026-01-30 13:42:01 +08:00
parent 7393cc2421
commit 6dab151b79
7 changed files with 342 additions and 21 deletions
@@ -0,0 +1,79 @@
package com.budwk.app.flow.handler;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.exception.BaseException;
import com.budwk.app.flow.engine.AssignmentHandler;
import com.budwk.app.flow.engine.core.Execution;
import com.budwk.app.flow.engine.core.ServiceContext;
import com.budwk.app.flow.engine.model.TaskModel;
import com.budwk.app.sys.models.Sys_role;
import com.budwk.app.sys.models.Sys_user;
import com.budwk.app.sys.models.Sys_user_role;
import com.budwk.app.sys.services.SysRoleService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.lang.Lang;
import java.util.List;
/**
* @ClassName FlowGeneralViceDelegationAuditSelfUnitByArgsAssignmentHandler
* @Author JyuHsin
* @Date 2026/1/30 10:14
* @Version 1.0
* @Description 获取代表团副团长,只有联合代表团才有副团长审核,而且只审核副团长自己单位的提案
*/
public class FlowGeneralViceDelegationAuditSelfUnitByArgsAssignmentHandler implements AssignmentHandler {
@Override
public List<String> assign(TaskModel model, Execution execution) {
String sessionId = execution.getArgs().getStr("sessionId");
String delegationId = execution.getArgs().getStr("delegationId");
String unitId = execution.getArgs().getStr("unitId");
if (StrUtil.isBlank(sessionId)) {
throw new BaseException("参数 sessionId 不能为空");
}
if (StrUtil.isBlank(delegationId)) {
throw new BaseException("参数 delegationId 不能为空");
}
if (StrUtil.isBlank(unitId)) {
throw new BaseException("参数 unitId 不能为空");
}
SysRoleService sysRoleService = ServiceContext.find(SysRoleService.class);
Sys_role role = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_VICE_DELEGATION_HEAD);
List<Sys_user_role> roles = ServiceContext.find(Dao.class).query(
Sys_user_role.class,
Cnd.where(Sys_user_role::getRoleId, "=", role.getId())
.and(Sys_user_role::getTcDelegationId, "=", delegationId)
.and(Sys_user_role::getTcSessionId, "=", sessionId)
);
if (Lang.isEmpty(roles)) {
throw new RuntimeException("您所在的代表团没有设置副团长,无法流转到下一步,请联系校工会进行设置。");
}
List<String> list = roles.stream().map(Sys_user_role::getUserId).toList();
List<Sys_user> userList = ServiceContext.find(Dao.class).query(Sys_user.class, Cnd.where(Sys_user::getId, "in", list));
// 过滤本单位的副团长
List<Sys_user> auditUserList = userList.stream().filter(user -> user.getUnitId().equals(unitId)).toList();
if (Lang.isEmpty(auditUserList)) {
throw new RuntimeException("您所在的代表团没有设置和您所在单位相符的副团长。");
}
return auditUserList.stream().map(Sys_user::getId).toList();
}
@Override
public String getMessage() {
return "获取代表团副团长(审核副团长本单位,根据args中的sessionId和delegationId和unitId)";
}
@Override
public int getOrder() {
return AssignmentHandler.super.getOrder();
}
}
@@ -68,7 +68,6 @@ public class SysLoginController {
@Ok("re")
@ApiOperation("用户本地登录页面")
@Filters
@SaCheckLogin
public String login(HttpServletRequest req, HttpSession session) {
return "beetl:/platform/sys/login.html";
}
@@ -76,7 +75,6 @@ public class SysLoginController {
@At
@Ok("re")
@Filters
@SaCheckLogin
public String h5() {
return "beetl:/platform/sys/login.html";
}
@@ -92,7 +90,6 @@ public class SysLoginController {
@At("/doLogin")
@Ok("json")
@ApiOperation("用户本地账号密码登录")
@SaCheckLogin
public Object doLogin(@Param("username") String username,
@Param("password") String password,
@Param("platformKey") String captchaKey,
@@ -4,7 +4,9 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result;
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
import io.swagger.annotations.Api;
@@ -19,6 +21,7 @@ import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import javax.validation.Valid;
import java.util.List;
@IocBean
@At("/platform/proposal/vice/delegation")
@@ -45,8 +48,8 @@ public class ProposalViceDelegationController {
@At
@SaCheckPermission("proposal.vice.delegation")
@ApiOperation("分页列表")
public Result pageData(@Valid ProposalSearchParam pageForm) {
Sql sql = Sqls.create("""
public Result pageData(@Valid ProposalSearchParam pageForm, boolean approval) {
/*Sql sql = Sqls.create("""
SELECT
info.*,
type.NAME AS typeName,
@@ -83,8 +86,59 @@ public class ProposalViceDelegationController {
cnd.groupBy("info.id");
sql.setCondition(cnd);
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
return Result.success(pagination);*/
Sql sql = Sqls.create("""
SELECT
info.*,
type.name AS typeName,
tcs.fullName AS sessionName,
tcd.`name` AS delegationName,
ins.id AS instanceId,
ins.businessNo,
ins.state instanceState,
ins.variable instanceVariable,
ins.processDefineId instanceProcessDefineId,
t.id taskId,
t.taskName AS taskKey,
t.displayName taskName,
t.taskType,
t.performType taskPerformType,
t.taskState,
t.finishTime,
t.taskParentId,
t.variable taskVariable,
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
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 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 AND rt.taskState = 10
LEFT JOIN proposal_info info ON info.id = ins.businessNo
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
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("t.taskName", "=", "viceDelegation");
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())){
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
}
if (approval) {
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
} else {
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
}
ProposalSearchParam.buildSearch(cnd, pageForm);
cnd.groupBy("t.id");
cnd.desc("t.createdAt");
sql.setCondition(cnd);
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(),pageForm.getPageSize(), sql);
return Result.success(pagination);
}
}
@@ -0,0 +1,87 @@
package com.budwk.app.zhgh.democratic.proposal.interceptor;
import cn.hutool.core.util.ObjectUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.flow.constant.FlowConst;
import com.budwk.app.flow.engine.FlowInterceptor;
import com.budwk.app.flow.engine.core.Execution;
import com.budwk.app.flow.engine.core.ServiceContext;
import com.budwk.app.sys.models.Sys_role;
import com.budwk.app.sys.models.Sys_user;
import com.budwk.app.sys.models.Sys_user_role;
import com.budwk.app.sys.services.SysRoleService;
import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
import com.budwk.app.zhgh.democratic.teachercongress.delegation.models.Teacher_congress_delegation;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import java.util.List;
/**
* @ClassName ProposalDelegationPrefixInterceptor
* @Author JyuHsin
* @Date 2026/1/30 10:27
* @Version 1.0
* @Description 提案团长审核前置拦截器 用于设置是否联合代表团 tf_unite
*/
public class ProposalDelegationPrefixInterceptor implements FlowInterceptor {
@Override
public void intercept(Execution execution) {
Dao dao = ServiceContext.find(Dao.class);
String proposalId = execution.getProcessInstance().getBusinessNo();
// 获取提案信息
ProposalInfo proposalInfo = dao.fetch(ProposalInfo.class, proposalId);
// 获取代表团信息
Teacher_congress_delegation delegation = dao.fetch(Teacher_congress_delegation.class, proposalInfo.getDelegationId());
// 是否联合代表团
Boolean untie = ObjectUtil.defaultIfNull(delegation.getUnite(), false);
String delegationAudit = "";
if (!untie) {
delegationAudit = "delegation";
} else {
// 如果是联合代表团,查询提案人的单位是否有副团长
Sys_user user = dao.fetch(Sys_user.class, proposalInfo.getCreateUserId());
SysRoleService sysRoleService = ServiceContext.find(SysRoleService.class);
Sys_role role = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_VICE_DELEGATION_HEAD);
Sql sql = Sqls.fetchInt("""
SELECT
count(1) as count
FROM
`sys_user` u
LEFT JOIN sys_user_role ur ON u.id = ur.userId
WHERE
u.unitId = @unitId
AND ur.roleId = @roleId
AND ur.tcSessionId = @sessionId
AND ur.tcDelegationId = @delegationId
""");
sql.setParam("unitId", user.getUnitId());
sql.setParam("roleId", role.getId());
sql.setParam("sessionId", proposalInfo.getSessionId());
sql.setParam("delegationId", proposalInfo.getDelegationId());
dao.execute(sql);
int count = sql.getInt();
if (count == 0) {
delegationAudit = "delegation";
} else {
delegationAudit = "viceDelegation";
}
}
execution.getArgs().set(FlowConst.TASK_FORM_DATA_PREFIX + "delegationAudit", delegationAudit);
// 存储一些参数,方便查询副团长
execution.getArgs().set("sessionId", proposalInfo.getSessionId());
execution.getArgs().set("delegationId", proposalInfo.getDelegationId());
Sys_user user = dao.fetch(Sys_user.class, proposalInfo.getCreateUserId());
execution.getArgs().set("unitId", user.getUnitId());
}
}
@@ -25,12 +25,13 @@ layout("/layouts/platform.html"){
<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>-->
<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"
@@ -53,9 +54,13 @@ layout("/layouts/platform.html"){
size="small"></enum-tag>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="100px">
<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.taskState === 10" @click="openAudit(row)" size="mini" type="primary">审核
</el-button>
<el-button v-if="row.canRevoke" @click="onRevoke(row)" size="mini" type="danger">撤回
</el-button>
</template>
</el-table-column>
</el-table>
@@ -63,7 +68,26 @@ layout("/layouts/platform.html"){
</el-card>
<template #edit>
<proposal-info ref="proposalInfoRef"></proposal-info>
<proposal-info ref="proposalInfoRef">
<div v-if="showApprovalForm">
<div class="process-title">
{{formData.taskName}}
</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(6)" size="small" type="info">退回到提案人</el-button>
<el-button @click="handleTaskAction(2)" 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>
@@ -80,6 +104,7 @@ layout("/layouts/platform.html"){
},
data() {
return {
sessionOptions: [],
tableColumns: [
{label: "提案编号", prop: "code"},
{label: "提案名称", prop: "name", width: "200px"},
@@ -66,7 +66,7 @@ layout("/layouts/platform_h5.html"){
</van-form>
<div style="display: flex; justify-content: space-between; column-gap: 10px; padding: 10px">
<van-button type="danger" block @click="handleTaskAction(6)">退回</van-button>
<van-button type="danger" block @click="handleTaskAction(20)">不同意</van-button>
<van-button type="danger" block @click="handleTaskAction(2)">不同意</van-button>
<van-button type="primary" block @click="handleTaskAction(1)">同意</van-button>
</div>
</div>
@@ -2,7 +2,7 @@
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-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"
@@ -16,11 +16,11 @@ layout("/layouts/platform_h5.html"){
<van-dropdown-item v-model="pageForm.sessionId" :options="sessionOptions" :multiple="false"
@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-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/vice/delegation/pageData" :page_form.sync="pageForm" @ready="onReady"
@@ -38,10 +38,39 @@ layout("/layouts/platform_h5.html"){
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn" v-if="row.taskState === 10" @click="onApproval(row)">
<i class="fa fa-edit"></i>
<span>审核</span>
</div>
<div class="action-btn delete" v-if="row.canRevoke" @click="onRevoke(row)">
<i class="fa fa-reply"></i>
<span>撤回</span>
</div>
</template>
</table-list>
<proposal-info ref="proposalInfoRef"></proposal-info>
<proposal-info ref="proposalInfoRef">
<div v-if="showApprovalForm">
<div class="process-title">{{formData.taskName}}</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(6)">退回</van-button>
<van-button type="danger" block @click="handleTaskAction(2)">不同意</van-button>
<van-button type="primary" block @click="handleTaskAction(1)">同意</van-button>
</div>
</div>
</proposal-info>
</div>
<script>
@@ -96,6 +125,56 @@ layout("/layouts/platform_h5.html"){
this.$refs.proposalInfoRef.onOpen(row)
},
onApproval(row) {
this.showApprovalForm = true
this.$refs.proposalInfoRef.onOpen(row)
this.formData = {
processTaskId: row.taskId,
taskName: row.curTaskName
}
},
async handleTaskAction(val) {
try {
await this.$refs.formRef.validate();
this.$dialog.confirm({
title: "提示",
message: "您确定要提交吗?"
}).then(() => {
this.$axios.post("/flow/common/executeTask", {
data: JSON.stringify({
...this.formData,
submitType: val
})
}).then((res) => {
if (res.code === 0) {
this.$refs.proposalInfoRef.onClose()
this.$toast.success(res.msg)
this.doSearch()
}
})
}).catch(() => {
})
} catch (error) {
}
},
onRevoke(row){
this.$dialog.confirm({
title: "提示",
message: "您确定要撤回吗?"
}).then(() => {
this.$axios.post("/flow/common/revokeTask", {taskId: row.taskId}).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
this.doSearch()
}
})
})
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1