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())) { if (!teamScorePoolService.checkBalance(task.getPublisherDeptId(), task.getScore())) {
throw new BusinessException(ResultCode.INSUFFICIENT_SCORE, "部门积分余额不足"); throw new BusinessException(ResultCode.INSUFFICIENT_SCORE, "部门积分余额不足");
} }
@ -151,6 +152,10 @@ public class TaskService {
} }
} }
if (isAdminPublisher) {
log.info("管理员发布任务,跳过积分检查: publisherId={}", task.getPublisherId());
}
// 生成任务编号 // 生成任务编号
task.setTaskNo(generateTaskNo()); task.setTaskNo(generateTaskNo());
@ -248,8 +253,8 @@ public class TaskService {
totalHours += itemHours; totalHours += itemHours;
} }
// 检查部门积分是否充足 // 检查部门积分是否充足(管理员跳过积分检查)
if (user.getDeptId() != null) { if (!isAdmin && user.getDeptId() != null) {
if (!teamScorePoolService.checkBalance(user.getDeptId(), totalScore)) { if (!teamScorePoolService.checkBalance(user.getDeptId(), totalScore)) {
throw new BusinessException(ResultCode.INSUFFICIENT_SCORE, "部门积分余额不足"); throw new BusinessException(ResultCode.INSUFFICIENT_SCORE, "部门积分余额不足");
} }
@ -259,6 +264,10 @@ public class TaskService {
} }
} }
if (isAdmin) {
log.info("管理员创建流水线任务,跳过积分检查: publisherId={}", publisherId);
}
// 创建主任务 // 创建主任务
Task task = new Task(); Task task = new Task();
task.setTaskNo(generateTaskNo()); task.setTaskNo(generateTaskNo());

View File

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