fix: 管理员跳过积分检查,所有部门开放积分池配置

This commit is contained in:
Your Name 2026-01-04 10:32:32 +08:00
parent 3161ebfd59
commit f7bb31433d
2 changed files with 16 additions and 8 deletions

View File

@ -139,8 +139,9 @@ public class TaskService {
}
}
// 检查部门积分是否充足
if (task.getPublisherDeptId() != null && task.getScore() != null) {
// 检查部门积分是否充足(管理员跳过积分检查)
boolean isAdminPublisher = task.getPublisherId() != null && isAdminUser(task.getPublisherId());
if (!isAdminPublisher && task.getPublisherDeptId() != null && task.getScore() != null) {
if (!teamScorePoolService.checkBalance(task.getPublisherDeptId(), task.getScore())) {
throw new BusinessException(ResultCode.INSUFFICIENT_SCORE, "部门积分余额不足");
}
@ -151,6 +152,10 @@ public class TaskService {
}
}
if (isAdminPublisher) {
log.info("管理员发布任务,跳过积分检查: publisherId={}", task.getPublisherId());
}
// 生成任务编号
task.setTaskNo(generateTaskNo());
@ -248,8 +253,8 @@ public class TaskService {
totalHours += itemHours;
}
// 检查部门积分是否充足
if (user.getDeptId() != null) {
// 检查部门积分是否充足(管理员跳过积分检查)
if (!isAdmin && user.getDeptId() != null) {
if (!teamScorePoolService.checkBalance(user.getDeptId(), totalScore)) {
throw new BusinessException(ResultCode.INSUFFICIENT_SCORE, "部门积分余额不足");
}
@ -258,6 +263,10 @@ public class TaskService {
throw new BusinessException(ResultCode.SCORE_LIMIT_EXCEEDED, "超过本周期积分消耗限制");
}
}
if (isAdmin) {
log.info("管理员创建流水线任务,跳过积分检查: publisherId={}", publisherId);
}
// 创建主任务
Task task = new Task();

View File

@ -467,7 +467,7 @@
</template>
<template v-else-if="column.key === 'score'">
<div v-if="record.deptType === 'demand'" class="score-display">
<div class="score-display">
<div class="score-main">
<span class="score-value">{{ record.scoreBalance ?? 0 }}</span>
<span class="score-unit">分</span>
@ -488,7 +488,7 @@
</template>
<template v-else-if="column.key === 'limit'">
<div v-if="record.deptType === 'demand'" class="limit-display">
<div class="limit-display">
<template v-if="record.limitEnabled === 1">
<div class="limit-period">
<span class="period-label">{{ getLimitPeriodLabel(record.limitPeriod) }}</span>
@ -505,7 +505,7 @@
</template>
<template v-else-if="column.key === 'alert'">
<div v-if="record.deptType === 'demand' && record.limitEnabled === 1" class="alert-display">
<div v-if="record.limitEnabled === 1" class="alert-display">
<div v-if="record.limitAlert" class="alert-badge warning">
<Icon name="alert" size="sm" />
<span>预警中</span>
@ -542,7 +542,6 @@
编辑
</a-button>
<a-button
v-if="record.deptType === 'demand'"
type="text"
size="small"
@click="showScorePoolModal(record)"