This commit is contained in:
zlwu committed 2025-08-05 13:21:49 +08:00
1 parent e39d98e655
commit 109577a578
10 files changed
+229 -11

No files matched your search

@@ -119,6 +119,12 @@ public class PageQuery implements Serializable {
return (pageNum - 1) * pageSize;
}
/**
* 无参构造器
*/
public PageQuery() {
}
public PageQuery(Integer pageSize, Integer pageNum) {
this.pageSize = pageSize;
this.pageNum = pageNum;
@@ -81,7 +81,8 @@ public class WorkflowGlobalListener implements GlobalListener {
String applyNodeCode = flwCommonService.applyNodeCode(definition.getId());
for (Task flowTask : nextTasks) {
// 如果办理或者退回并行存在需要指定办理人,则直接覆盖办理人
if (variable.containsKey(flowTask.getNodeCode()) && (TaskStatusEnum.PASS.getStatus().equals(flowParams.getHisStatus())
if (variable.containsKey(flowTask.getNodeCode())
&& (TaskStatusEnum.PASS.getStatus().equals(flowParams.getHisStatus())
|| TaskStatusEnum.BACK.getStatus().equals(flowParams.getHisStatus()))) {
String userIds = variable.get(flowTask.getNodeCode()).toString();
flowTask.setPermissionList(List.of(userIds.split(StringUtils.SEPARATOR)));
@@ -116,10 +117,11 @@ public class WorkflowGlobalListener implements GlobalListener {
params.put("message", flowParams.getMessage());
variable = flowParams.getVariable();
}
//申请人提交事件
// 申请人提交事件
Boolean submit = MapUtil.getBool(variable, FlowConstant.SUBMIT);
if (submit != null && submit) {
flowProcessEventHandler.processHandler(definition.getFlowCode(), instance, instance.getFlowStatus(), variable, true);
flowProcessEventHandler.processHandler(definition.getFlowCode(), instance, instance.getFlowStatus(),
variable, true);
} else {
// 判断流程状态(发布:撤销,退回,作废,终止,已完成事件)
String status = determineFlowStatus(instance);
@@ -127,7 +129,7 @@ public class WorkflowGlobalListener implements GlobalListener {
flowProcessEventHandler.processHandler(definition.getFlowCode(), instance, status, params, false);
}
}
//发布任务事件
// 发布任务事件
if (task != null) {
flowProcessEventHandler.processTaskHandler(definition.getFlowCode(), instance, task.getId());
}
@@ -788,6 +788,40 @@ public class XgStudentMsgController extends BaseController {
return xgStudentMsgService.advancedSearch(bo);
}
/**
* 根据学生ID获取班主任ID
*
* @param studentId 学生ID
* @return 班主任ID
*/
@SaCheckPermission("studentMsg:studentMsg:query")
@GetMapping("/getClassTeacherId/{studentId}")
public R<Long> getClassTeacherId(@NotNull(message = "学生ID不能为空") @PathVariable Long studentId) {
log.info("根据学生ID获取班主任ID - 学生ID: {}", studentId);
Long classTeacherId = xgStudentMsgService.getClassTeacherIdByStudentId(studentId);
if (classTeacherId == null) {
return R.fail("未找到该学生对应的班主任信息");
}
return R.ok(classTeacherId);
}
/**
* 根据学生ID获取学院请假审批人列表
*
* @param studentId 学生ID
* @return 请假审批人用户ID列表
*/
@SaCheckPermission("studentMsg:studentMsg:query")
@GetMapping("/getCollegeLeaveApprovers/{studentId}")
public R<List<Long>> getCollegeLeaveApprovers(@NotNull(message = "学生ID不能为空") @PathVariable Long studentId) {
log.info("根据学生ID获取学院请假审批人列表 - 学生ID: {}", studentId);
List<Long> approverUserIds = xgStudentMsgService.getCollegeLeaveApproversByStudentId(studentId);
if (approverUserIds.isEmpty()) {
return R.fail("未找到该学生所在学院的请假审批人");
}
return R.ok(approverUserIds);
}
/**
* 导入数据
*
@@ -51,4 +51,30 @@ public interface XgStudentMsgMapper extends BaseMapperPlus<XgStudentMsg, XgStude
*/
List<XgStudentMsgVo> selectStudentsByClassId(@Param("classId") String classId, @Param("name") String name);
/**
* 根据学生ID查询班主任ID
*
* @param studentId 学生ID
* @return 班主任ID
*/
Long selectClassTeacherIdByStudentId(@Param("studentId") Long studentId);
/**
* 根据学生ID查询学院ID
*
* @param studentId 学生ID
* @return 学院ID
*/
Long selectCollegeIdByStudentId(@Param("studentId") Long studentId);
/**
* 根据学院ID和角色Key查询具备该角色的用户列表
*
* @param collegeId 学院ID
* @param roleKey 角色Key
* @return 用户ID列表
*/
List<Long> selectUserIdsByCollegeIdAndRoleKey(@Param("collegeId") Long collegeId,
@Param("roleKey") String roleKey);
}
@@ -122,4 +122,20 @@ public interface IXgStudentMsgService {
* @return 学生信息分页列表
*/
TableDataInfo<XgStudentMsgVo> advancedSearch(XgStudentMsgAdvancedSearchBo bo);
/**
* 根据学生ID查询班主任ID
*
* @param studentId 学生ID
* @return 班主任ID
*/
Long getClassTeacherIdByStudentId(Long studentId);
/**
* 根据学生ID获取学院请假审批人列表
*
* @param studentId 学生ID
* @return 请假审批人用户ID列表
*/
List<Long> getCollegeLeaveApproversByStudentId(Long studentId);
}
@@ -1049,4 +1049,42 @@ public class XgStudentMsgServiceImpl implements IXgStudentMsgService {
return lqw;
}
/**
* 根据学生ID查询班主任ID
*
* @param studentId 学生ID
* @return 班主任ID
*/
@Override
public Long getClassTeacherIdByStudentId(Long studentId) {
log.info("根据学生ID查询班主任ID - 学生ID: {}", studentId);
return baseMapper.selectClassTeacherIdByStudentId(studentId);
}
/**
* 根据学生ID获取学院请假审批人列表
*
* @param studentId 学生ID
* @return 请假审批人用户ID列表
*/
@Override
public List<Long> getCollegeLeaveApproversByStudentId(Long studentId) {
log.info("根据学生ID获取学院请假审批人列表 - 学生ID: {}", studentId);
// 1. 根据学生ID查询学院ID
Long collegeId = baseMapper.selectCollegeIdByStudentId(studentId);
if (collegeId == null) {
log.warn("未找到学生对应的学院信息 - 学生ID: {}", studentId);
return new ArrayList<>();
}
log.info("学生所在学院ID: {}", collegeId);
// 2. 根据学院ID和角色Key查询具备请假审批角色的用户列表
List<Long> approverUserIds = baseMapper.selectUserIdsByCollegeIdAndRoleKey(collegeId, "xsqj-ejxyspr");
log.info("找到的请假审批人数量: {}", approverUserIds.size());
return approverUserIds;
}
}
@@ -137,4 +137,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY create_time DESC
</select>
<!-- 根据学生ID查询班主任ID -->
<select id="selectClassTeacherIdByStudentId" resultType="java.lang.Long">
SELECT c.class_teacher_id
FROM xg_student_msg s
INNER JOIN xg_class_msg c ON s.class_id = c.id
WHERE s.id = #{studentId}
AND s.deleted = 0
AND c.deleted = 0
</select>
<!-- 根据学生ID查询学院ID -->
<select id="selectCollegeIdByStudentId" resultType="java.lang.Long">
SELECT college_id
FROM xg_student_msg
WHERE id = #{studentId}
AND deleted = 0
</select>
<!-- 根据学院ID和角色Key查询具备该角色的用户列表 -->
<select id="selectUserIdsByCollegeIdAndRoleKey" resultType="java.lang.Long">
SELECT DISTINCT u.user_id
FROM sys_user u
INNER JOIN sys_user_role ur ON u.user_id = ur.user_id
INNER JOIN sys_role r ON ur.role_id = r.role_id
INNER JOIN sys_dept d ON u.dept_id = d.dept_id
WHERE u.del_flag = '0'
AND u.status = '0'
AND u.account_type = '1'
AND d.del_flag = '0'
AND d.status = '0'
AND r.role_key = #{roleKey}
AND (d.dept_id = #{collegeId} OR FIND_IN_SET(#{collegeId}, d.ancestors))
</select>
</mapper>
@@ -84,3 +84,25 @@ export const downloadImportTemplate = () => {
responseType: 'blob'
});
};
/**
* 根据学生ID获取班主任ID
* @param studentId 学生ID
*/
export const getClassTeacherId = (studentId: string | number): AxiosPromise<{ data: number }> => {
return request({
url: `/studentMsg/studentMsg/getClassTeacherId/${studentId}`,
method: 'get'
});
};
/**
* 根据学生ID获取学院请假审批人列表
* @param studentId 学生ID
*/
export const getCollegeLeaveApprovers = (studentId: string | number): AxiosPromise<{ data: number[] }> => {
return request({
url: `/studentMsg/studentMsg/getCollegeLeaveApprovers/${studentId}`,
method: 'get'
});
};
+2 -2
View File
@@ -28,7 +28,7 @@
</div>
</el-tooltip>
<!-- 消息 -->
<el-tooltip :content="proxy.$t('navbar.message')" effect="dark" placement="bottom">
<!-- <el-tooltip :content="proxy.$t('navbar.message')" effect="dark" placement="bottom">
<div>
<el-popover placement="bottom" trigger="click" transition="el-zoom-in-top" :width="300" :persistent="false">
<template #reference>
@@ -41,7 +41,7 @@
</template>
</el-popover>
</div>
</el-tooltip>
</el-tooltip> -->
<!-- <el-tooltip content="Github" effect="dark" placement="bottom">
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
</el-tooltip> -->
+45 -5
View File
@@ -243,7 +243,7 @@ import ApprovalButton from '@/components/Process/approvalButton.vue';
import { AxiosResponse } from 'axios';
import { StartProcessBo } from '@/api/workflow/workflowCommon/types';
import { addStudentLeave, getStudentLeave, updateStudentLeave } from '@/api/workflow/studentLeave/studentLeave';
import { getStudentMsg } from '@/api/xg/xsjcxx/studentMsg/studentMsg';
import { getStudentMsg, getClassTeacherId, getCollegeLeaveApprovers } from '@/api/xg/xsjcxx/studentMsg/studentMsg';
import { startWorkFlow } from '@/api/workflow/task';
import { StudentLeaveForm, StudentLeaveVO } from '@/api/workflow/studentLeave/studentLeave/types';
import { StudentMsgVO } from '@/api/xg/xsjcxx/studentMsg/studentMsg/types';
@@ -686,8 +686,9 @@ const disabledEndDate = (time: Date) => {
// 但需要确保结束时间不能早于开始时间
if (form.startTime) {
const startDate = new Date(form.startTime);
if (time.getTime() <= startDate.getTime()) {
return true; // 禁用早于或等于开始时间的日期
// 修改逻辑:允许选择与开始时间同一天及之后的日期
if (time.getTime() < startDate.getTime()) {
return true; // 只禁用早于开始时间的日期,允许同一天
}
}
@@ -766,6 +767,42 @@ const submitFlow = async () => {
// 启动工作流
const handleStartWorkFlow = async (data: StudentLeaveForm) => {
try {
// 1. 调用接口获取班主任ID
let classTeacherId: number | null = null;
try {
const classTeacherResponse = await getClassTeacherId(data.studentId);
if (classTeacherResponse && classTeacherResponse.data) {
classTeacherId = classTeacherResponse.data;
console.log('获取到班主任ID:', classTeacherId);
} else {
console.warn('获取班主任ID失败');
ElMessage.error('获取班主任信息失败,请稍后重试');
return; // 停止后续操作
}
} catch (error) {
console.error('调用获取班主任ID接口失败:', error);
ElMessage.error('获取班主任信息失败,请稍后重试');
return; // 停止后续操作
}
// 2. 调用接口获取学院请假审批人列表
let collegeApprovers: number[] = [];
try {
const collegeApproversResponse = await getCollegeLeaveApprovers(data.studentId);
if (collegeApproversResponse && collegeApproversResponse.data) {
collegeApprovers = collegeApproversResponse.data;
console.log('获取到学院请假审批人列表:', collegeApprovers);
} else {
console.warn('获取学院请假审批人列表失败');
ElMessage.error('获取学院审批人信息失败,请稍后重试');
return; // 停止后续操作
}
} catch (error) {
console.error('调用获取学院请假审批人接口失败:', error);
ElMessage.error('获取学院审批人信息失败,请稍后重试');
return; // 停止后续操作
}
submitFormData.value.flowCode = flowCode.value;
submitFormData.value.businessId = data.id;
// 流程变量
@@ -773,9 +810,12 @@ const handleStartWorkFlow = async (data: StudentLeaveForm) => {
// hzdyjs-qj 使用的流程变量
qjts: data.leaveDuration,
// leave2/6 使用的流程变量
leaveDays: data.leaveDuration,
// leaveDays: data.leaveDuration,
// leave4/5 使用的流程变量
userList: ['1', '3', '4']
// userList: ['1', '3', '4'],
// 新增的流程变量
bzrspr: classTeacherId,
ejxyspr: collegeApprovers
};
submitFormData.value.variables = taskVariables.value;
const resp = await startWorkFlow(submitFormData.value);