Compare commits
31
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f75c8a6834 | ||
|
|
51abfca40f | ||
|
|
d3f9472cca | ||
|
|
09593b221b | ||
|
|
eeae0af978 | ||
|
|
937cbb6bbd | ||
|
|
a170cc6a48 | ||
|
|
24a1d7f745 | ||
|
|
fa6bf7aea2 | ||
|
|
9b1ce3c4b1 | ||
|
|
5b4be04645 | ||
|
|
da8d332fac | ||
|
|
845c7fd942 | ||
|
|
df4c21bd0d | ||
|
|
0765f00458 | ||
|
|
bea76c9e11 | ||
|
|
2550e9713d | ||
|
|
4e1ca614d4 | ||
|
|
291de33d54 | ||
|
|
902b04a21a | ||
|
|
ba6a6af131 | ||
|
|
5ab54912a5 | ||
|
|
d6af2f1892 | ||
|
|
dcd29040de | ||
|
|
d6769846f5 | ||
|
|
9d93a373ae | ||
|
|
df6ce133dd | ||
|
|
8c33135f4c | ||
|
|
f067c95d93 | ||
|
|
8a48b2cf02 | ||
|
|
2fac0c91f6 |
No files matched your search
@@ -933,15 +933,16 @@ FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memor
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:prod": "node --max-old-space-size=8192 node_modules/vite/bin/vite.js build --mode production",
|
"build:prod": "node --max-old-space-size=6144 node_modules/vite/bin/vite.js build --mode production",
|
||||||
"build:dev": "node --max-old-space-size=8192 node_modules/vite/bin/vite.js build --mode development"
|
"build:dev": "node --max-old-space-size=6144 node_modules/vite/bin/vite.js build --mode development"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 参数说明
|
#### 参数说明
|
||||||
- `--max-old-space-size=8192`:设置堆内存限制为8GB
|
- `--max-old-space-size=6144`:设置堆内存限制为 6GB
|
||||||
- 可根据项目规模和机器内存调整数值(4096=4GB, 8192=8GB)
|
- 可根据项目规模和机器内存调整数值(4096=4GB, 6144=6GB, 8192=8GB)
|
||||||
|
- 2026-10-21:4096MB 会在生产构建 transform 约 2400 个模块时 OOM。当前开发机物理内存为 8GB,脚本使用 6144MB,避免堆上限等于整机内存
|
||||||
|
|
||||||
#### 适用场景
|
#### 适用场景
|
||||||
- 大型前端项目构建
|
- 大型前端项目构建
|
||||||
|
|||||||
+25
-20
@@ -1,5 +1,5 @@
|
|||||||
# 仅 tag 触发:顺序打包 backend / web / mobile-h5
|
# 仅 tag 触发:在内网 Runner 顺序打包 backend / mobile-h5 / web
|
||||||
# 产物:/root/hzdyjs-releases/<tag>/{backend,web,mobile-h5}-<tag>.*
|
# 产物:/root/hzdyjs-releases/<tag>/{backend,mobile-h5,web}-<tag>.*
|
||||||
# Maven 缓存:宿主机 /root/maven-repo → 容器 /maven-repo(由 runner DRONE_RUNNER_VOLUMES 注入)
|
# Maven 缓存:宿主机 /root/maven-repo → 容器 /maven-repo(由 runner DRONE_RUNNER_VOLUMES 注入)
|
||||||
# 发版目录:/root/hzdyjs-releases → /hzdyjs-releases(同上,勿在本文件重复挂载)
|
# 发版目录:/root/hzdyjs-releases → /hzdyjs-releases(同上,勿在本文件重复挂载)
|
||||||
|
|
||||||
@@ -35,22 +35,6 @@ steps:
|
|||||||
- cp -v ruoyi-admin/target/ruoyi-admin.jar "/hzdyjs-releases/${DRONE_TAG}/backend-${DRONE_TAG}.jar"
|
- cp -v ruoyi-admin/target/ruoyi-admin.jar "/hzdyjs-releases/${DRONE_TAG}/backend-${DRONE_TAG}.jar"
|
||||||
- ls -lh "/hzdyjs-releases/${DRONE_TAG}/backend-${DRONE_TAG}.jar"
|
- ls -lh "/hzdyjs-releases/${DRONE_TAG}/backend-${DRONE_TAG}.jar"
|
||||||
|
|
||||||
- name: package-web
|
|
||||||
image: node:20-bookworm
|
|
||||||
environment:
|
|
||||||
NPM_CONFIG_REGISTRY: https://registry.npmmirror.com
|
|
||||||
commands:
|
|
||||||
- set -eu
|
|
||||||
- echo "==> web tag=${DRONE_TAG}"
|
|
||||||
- mkdir -p "/hzdyjs-releases/${DRONE_TAG}"
|
|
||||||
- cd web
|
|
||||||
# package-lock.json 被 gitignore,仓库内无 lock,改用 npm install
|
|
||||||
- npm install
|
|
||||||
- npm run build:prod
|
|
||||||
- test -f dist/index.html
|
|
||||||
- tar -C dist -czf "/hzdyjs-releases/${DRONE_TAG}/web-${DRONE_TAG}.tar.gz" .
|
|
||||||
- ls -lh "/hzdyjs-releases/${DRONE_TAG}/web-${DRONE_TAG}.tar.gz"
|
|
||||||
|
|
||||||
- name: package-mobile-h5
|
- name: package-mobile-h5
|
||||||
image: node:20-bookworm
|
image: node:20-bookworm
|
||||||
environment:
|
environment:
|
||||||
@@ -62,10 +46,31 @@ steps:
|
|||||||
- corepack enable
|
- corepack enable
|
||||||
- corepack prepare pnpm@9 --activate
|
- corepack prepare pnpm@9 --activate
|
||||||
- cd mobile
|
- cd mobile
|
||||||
- pnpm config set registry https://registry.npmmirror.com
|
# H5 构建不需要 Chromium
|
||||||
- pnpm install --frozen-lockfile
|
- export PUPPETEER_SKIP_DOWNLOAD=1 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
|
||||||
|
- pnpm install --frozen-lockfile --registry https://registry.npmmirror.com
|
||||||
- pnpm run build
|
- pnpm run build
|
||||||
- test -d dist/build/h5
|
- test -d dist/build/h5
|
||||||
- tar -C dist/build/h5 -czf "/hzdyjs-releases/${DRONE_TAG}/mobile-h5-${DRONE_TAG}.tar.gz" .
|
- tar -C dist/build/h5 -czf "/hzdyjs-releases/${DRONE_TAG}/mobile-h5-${DRONE_TAG}.tar.gz" .
|
||||||
- ls -lh "/hzdyjs-releases/${DRONE_TAG}/"
|
- ls -lh "/hzdyjs-releases/${DRONE_TAG}/"
|
||||||
- ls -lh "/hzdyjs-releases/${DRONE_TAG}/mobile-h5-${DRONE_TAG}.tar.gz"
|
- ls -lh "/hzdyjs-releases/${DRONE_TAG}/mobile-h5-${DRONE_TAG}.tar.gz"
|
||||||
|
|
||||||
|
- name: package-web
|
||||||
|
image: node:20-bookworm
|
||||||
|
environment:
|
||||||
|
NPM_CONFIG_REGISTRY: https://registry.npmmirror.com
|
||||||
|
commands:
|
||||||
|
- set -eu
|
||||||
|
- echo "==> web tag=${DRONE_TAG} commit=${DRONE_COMMIT}"
|
||||||
|
- test -n "${DRONE_TAG}"
|
||||||
|
- mkdir -p "/hzdyjs-releases/${DRONE_TAG}"
|
||||||
|
- cd web
|
||||||
|
# 固定兼容 Node 20 的 npm 11,避开镜像内 npm 10 的 edgesOut 解析异常。
|
||||||
|
- npm install --global npm@11.21.1 --no-audit --no-fund --registry https://registry.npmmirror.com
|
||||||
|
- npm install --no-audit --no-fund --registry https://registry.npmmirror.com
|
||||||
|
# build:ci 使用 6 GB Node 堆并限制 Vite 并行,避免与其他打包步骤叠加内存。
|
||||||
|
- npm run build:ci
|
||||||
|
- test -s dist/index.html
|
||||||
|
- tar -C dist -czf "/hzdyjs-releases/${DRONE_TAG}/web-${DRONE_TAG}.tar.gz" .
|
||||||
|
- ls -lh "/hzdyjs-releases/${DRONE_TAG}/web-${DRONE_TAG}.tar.gz"
|
||||||
|
- sha256sum "/hzdyjs-releases/${DRONE_TAG}/web-${DRONE_TAG}.tar.gz"
|
||||||
+1
-1
@@ -80,7 +80,7 @@ mobile/yarn-debug.log*
|
|||||||
mobile/yarn-error.log*
|
mobile/yarn-error.log*
|
||||||
mobile/package-lock.json
|
mobile/package-lock.json
|
||||||
mobile/yarn.lock
|
mobile/yarn.lock
|
||||||
mobile/pnpm-lock.yaml
|
# mobile/pnpm-lock.yaml 纳入仓库,保证 CI 与本地依赖树一致
|
||||||
|
|
||||||
# Vue 自动生成的文件
|
# Vue 自动生成的文件
|
||||||
web/auto-imports.d.ts
|
web/auto-imports.d.ts
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.web.controller;
|
package org.dromara.web.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
@@ -178,14 +179,14 @@ public class CasController {
|
|||||||
return R.fail(ue.getMessage());
|
return R.fail(ue.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("处理 CAS profile 失败", e);
|
log.error("处理 CAS profile 失败", e);
|
||||||
return R.fail("处理 CAS profile 失败: " + e.getMessage());
|
return R.fail("处理 CAS profile 失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return R.fail("无法解析 CAS access_token");
|
return R.fail("无法解析 CAS access_token");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("请求 CAS accessToken 失败", e);
|
log.error("请求 CAS accessToken 失败", e);
|
||||||
return R.fail("请求 CAS accessToken 失败: " + e.getMessage());
|
return R.fail("请求 CAS accessToken 失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+27
-16
@@ -73,7 +73,27 @@ public class UserActionListener implements SaTokenListener {
|
|||||||
SpringUtils.context().publishEvent(logininforEvent);
|
SpringUtils.context().publishEvent(logininforEvent);
|
||||||
// 更新登录信息
|
// 更新登录信息
|
||||||
loginService.recordLoginInfo((Long) loginParameter.getExtra(LoginHelper.USER_KEY), ip);
|
loginService.recordLoginInfo((Long) loginParameter.getExtra(LoginHelper.USER_KEY), ip);
|
||||||
log.info("user doLogin, userId:{}, token:{}", loginId, tokenValue);
|
log.info("user doLogin, userId:{}", loginId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清理在线用户缓存。JWT 密钥变更后旧 token 无法 getExtra,绝不能抛异常打断登录流程
|
||||||
|
* (登录时 logoutByMaxLoginCount 会回调 doLogout/doReplaced)。
|
||||||
|
*/
|
||||||
|
private void clearOnlineCache(Object loginId, String tokenValue) {
|
||||||
|
try {
|
||||||
|
String tenantId = Convert.toStr(StpUtil.getExtra(tokenValue, LoginHelper.TENANT_KEY));
|
||||||
|
TenantHelper.dynamic(tenantId, () ->
|
||||||
|
RedisUtils.deleteObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("清理在线缓存时 token 无法解析(多为 JWT 密钥变更后的旧会话), userId={}, err={}",
|
||||||
|
loginId, e.getMessage());
|
||||||
|
try {
|
||||||
|
RedisUtils.deleteObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,11 +101,8 @@ public class UserActionListener implements SaTokenListener {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void doLogout(String loginType, Object loginId, String tokenValue) {
|
public void doLogout(String loginType, Object loginId, String tokenValue) {
|
||||||
String tenantId = Convert.toStr(StpUtil.getExtra(tokenValue, LoginHelper.TENANT_KEY));
|
clearOnlineCache(loginId, tokenValue);
|
||||||
TenantHelper.dynamic(tenantId, () -> {
|
log.info("user doLogout, userId:{}", loginId);
|
||||||
RedisUtils.deleteObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue);
|
|
||||||
});
|
|
||||||
log.info("user doLogout, userId:{}, token:{}", loginId, tokenValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,11 +110,8 @@ public class UserActionListener implements SaTokenListener {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void doKickout(String loginType, Object loginId, String tokenValue) {
|
public void doKickout(String loginType, Object loginId, String tokenValue) {
|
||||||
String tenantId = Convert.toStr(StpUtil.getExtra(tokenValue, LoginHelper.TENANT_KEY));
|
clearOnlineCache(loginId, tokenValue);
|
||||||
TenantHelper.dynamic(tenantId, () -> {
|
log.info("user doKickout, userId:{}", loginId);
|
||||||
RedisUtils.deleteObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue);
|
|
||||||
});
|
|
||||||
log.info("user doKickout, userId:{}, token:{}", loginId, tokenValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -105,11 +119,8 @@ public class UserActionListener implements SaTokenListener {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void doReplaced(String loginType, Object loginId, String tokenValue) {
|
public void doReplaced(String loginType, Object loginId, String tokenValue) {
|
||||||
String tenantId = Convert.toStr(StpUtil.getExtra(tokenValue, LoginHelper.TENANT_KEY));
|
clearOnlineCache(loginId, tokenValue);
|
||||||
TenantHelper.dynamic(tenantId, () -> {
|
log.info("user doReplaced, userId:{}", loginId);
|
||||||
RedisUtils.deleteObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue);
|
|
||||||
});
|
|
||||||
log.info("user doReplaced, userId:{}, token:{}", loginId, tokenValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ public class SysLoginService {
|
|||||||
@Value("${user.password.lockTime}")
|
@Value("${user.password.lockTime}")
|
||||||
private Integer lockTime;
|
private Integer lockTime;
|
||||||
|
|
||||||
|
@Value("${user.password.ipMaxRetryCount:30}")
|
||||||
|
private Integer ipMaxRetryCount;
|
||||||
|
|
||||||
private final ISysTenantService tenantService;
|
private final ISysTenantService tenantService;
|
||||||
private final ISysPermissionService permissionService;
|
private final ISysPermissionService permissionService;
|
||||||
private final ISysSocialService sysSocialService;
|
private final ISysSocialService sysSocialService;
|
||||||
@@ -200,7 +203,23 @@ public class SysLoginService {
|
|||||||
throw new UserException(loginType.getRetryLimitExceed(), maxRetryCount, lockTime);
|
throw new UserException(loginType.getRetryLimitExceed(), maxRetryCount, lockTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 按公网来源 IP 统计失败次数,防止对大量账号逐个试密码;校园内网 / 本机 IP 不计
|
||||||
|
String clientIp = ServletUtils.getClientIP();
|
||||||
|
String ipErrorKey = null;
|
||||||
|
if (ipMaxRetryCount > 0 && StringUtils.isNotBlank(clientIp) && isPublicClientIp(clientIp)) {
|
||||||
|
ipErrorKey = CacheConstants.PWD_ERR_CNT_KEY + "ip:" + clientIp;
|
||||||
|
int ipErrorNumber = ObjectUtil.defaultIfNull(RedisUtils.getCacheObject(ipErrorKey), 0);
|
||||||
|
if (ipErrorNumber >= ipMaxRetryCount) {
|
||||||
|
recordLogininfor(tenantId, username, loginFail, MessageUtils.message("user.ip.retry.limit.exceed", lockTime));
|
||||||
|
throw new UserException("user.ip.retry.limit.exceed", lockTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (supplier.get()) {
|
if (supplier.get()) {
|
||||||
|
if (ipErrorKey != null) {
|
||||||
|
int ipErrorNumber = ObjectUtil.defaultIfNull(RedisUtils.getCacheObject(ipErrorKey), 0);
|
||||||
|
RedisUtils.setCacheObject(ipErrorKey, ipErrorNumber + 1, Duration.ofMinutes(lockTime));
|
||||||
|
}
|
||||||
// 错误次数递增
|
// 错误次数递增
|
||||||
errorNumber++;
|
errorNumber++;
|
||||||
RedisUtils.setCacheObject(errorKey, errorNumber, Duration.ofMinutes(lockTime));
|
RedisUtils.setCacheObject(errorKey, errorNumber, Duration.ofMinutes(lockTime));
|
||||||
@@ -219,6 +238,23 @@ public class SysLoginService {
|
|||||||
RedisUtils.deleteObject(errorKey);
|
RedisUtils.deleteObject(errorKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为需要计入失败锁定的公网 IP。本机、内网 IPv4/IPv6 不计;无法解析时按公网处理,且不得抛异常阻断登录。
|
||||||
|
*/
|
||||||
|
private boolean isPublicClientIp(String ip) {
|
||||||
|
try {
|
||||||
|
if (NetUtils.isIPv6(ip)) {
|
||||||
|
return !NetUtils.isInnerIPv6(ip);
|
||||||
|
}
|
||||||
|
if (NetUtils.isIPv4(ip)) {
|
||||||
|
return !NetUtils.isInnerIP(ip);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("无法判断登录来源 IP 是否内网: {}", ip);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验租户
|
* 校验租户
|
||||||
*
|
*
|
||||||
|
|||||||
+4
-2
@@ -64,7 +64,9 @@ public class PasswordAuthStrategy implements IAuthStrategy {
|
|||||||
}
|
}
|
||||||
LoginUser loginUser = TenantHelper.dynamic(tenantId, () -> {
|
LoginUser loginUser = TenantHelper.dynamic(tenantId, () -> {
|
||||||
SysUserVo user = loadUserByUsername(username);
|
SysUserVo user = loadUserByUsername(username);
|
||||||
loginService.checkLogin(LoginType.PASSWORD, tenantId, username, () -> !BCrypt.checkpw(password, user.getPassword()));
|
// 用户不存在时按密码错误处理,避免通过提示差异枚举账号
|
||||||
|
loginService.checkLogin(LoginType.PASSWORD, tenantId, username,
|
||||||
|
() -> user == null || !BCrypt.checkpw(password, user.getPassword()));
|
||||||
// 此处可根据登录用户的数据不同 自行创建 loginUser
|
// 此处可根据登录用户的数据不同 自行创建 loginUser
|
||||||
return loginService.buildLoginUser(user);
|
return loginService.buildLoginUser(user);
|
||||||
});
|
});
|
||||||
@@ -112,7 +114,7 @@ public class PasswordAuthStrategy implements IAuthStrategy {
|
|||||||
SysUserVo user = userMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, username));
|
SysUserVo user = userMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, username));
|
||||||
if (ObjectUtil.isNull(user)) {
|
if (ObjectUtil.isNull(user)) {
|
||||||
log.info("登录用户:{} 不存在.", username);
|
log.info("登录用户:{} 不存在.", username);
|
||||||
throw new UserException("user.not.exists", username);
|
return null;
|
||||||
} else if (SystemConstants.DISABLE.equals(user.getStatus())) {
|
} else if (SystemConstants.DISABLE.equals(user.getStatus())) {
|
||||||
log.info("登录用户:{} 已被停用.", username);
|
log.info("登录用户:{} 已被停用.", username);
|
||||||
throw new UserException("user.blocked", username);
|
throw new UserException("user.blocked", username);
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
--- # Sa-Token(生产显式固定 JWT 密钥,禁止使用随机密钥,否则已登录会话会整体失效)
|
||||||
|
sa-token:
|
||||||
|
jwt-secret-key: abcdefghijklmnopqrstuvwxyz
|
||||||
|
|
||||||
--- # 临时文件存储位置 避免临时文件被系统清理报错
|
--- # 临时文件存储位置 避免临时文件被系统清理报错
|
||||||
spring.servlet.multipart.location: /ruoyi/server/temp
|
spring.servlet.multipart.location: /ruoyi/server/temp
|
||||||
|
|
||||||
@@ -348,7 +352,8 @@ logging:
|
|||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
configuration:
|
configuration:
|
||||||
# 生产环境关闭 SQL 日志打印,避免性能影响和敏感信息泄露
|
# 生产环境关闭 SQL 日志打印,避免性能影响和敏感信息泄露
|
||||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
# 生产禁止将完整 SQL 及参数(身份证号、手机号等)打印到控制台,需排查时在 dev 环境开启
|
||||||
|
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
# 开启驼峰命名转换
|
# 开启驼峰命名转换
|
||||||
map-underscore-to-camel-case: true
|
map-underscore-to-camel-case: true
|
||||||
# 开启缓存
|
# 开启缓存
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ user:
|
|||||||
maxRetryCount: 5
|
maxRetryCount: 5
|
||||||
# 密码锁定时间(默认10分钟)
|
# 密码锁定时间(默认10分钟)
|
||||||
lockTime: 10
|
lockTime: 10
|
||||||
|
# 同一公网IP在锁定时间内允许的最大登录失败次数(内网IP不计,0为关闭)
|
||||||
|
ipMaxRetryCount: 30
|
||||||
|
|
||||||
# Spring配置
|
# Spring配置
|
||||||
spring:
|
spring:
|
||||||
@@ -174,7 +176,8 @@ mybatis-plus:
|
|||||||
typeAliasesPackage: org.dromara.**.domain
|
typeAliasesPackage: org.dromara.**.domain
|
||||||
# 启用SQL日志输出,用于调试数据库插入问题
|
# 启用SQL日志输出,用于调试数据库插入问题
|
||||||
configuration:
|
configuration:
|
||||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
# 生产禁止将完整 SQL 及参数(身份证号、手机号等)打印到控制台,需排查时在 dev 环境开启
|
||||||
|
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
global-config:
|
global-config:
|
||||||
dbConfig:
|
dbConfig:
|
||||||
# 主键类型
|
# 主键类型
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ user.not.exists=对不起, 您的账号:{0} 不存在.
|
|||||||
user.password.not.match=用户不存在/密码错误
|
user.password.not.match=用户不存在/密码错误
|
||||||
user.password.retry.limit.count=密码输入错误{0}次
|
user.password.retry.limit.count=密码输入错误{0}次
|
||||||
user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
|
user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
|
||||||
|
user.ip.retry.limit.exceed=登录失败次数过多,请{0}分钟后再试
|
||||||
user.password.delete=对不起,您的账号:{0} 已被删除
|
user.password.delete=对不起,您的账号:{0} 已被删除
|
||||||
user.blocked=对不起,您的账号:{0} 已禁用,请联系管理员
|
user.blocked=对不起,您的账号:{0} 已禁用,请联系管理员
|
||||||
role.blocked=角色已封禁,请联系管理员
|
role.blocked=角色已封禁,请联系管理员
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ user.not.exists=Sorry, your account: {0} does not exist
|
|||||||
user.password.not.match=User does not exist/Password error
|
user.password.not.match=User does not exist/Password error
|
||||||
user.password.retry.limit.count=Password input error {0} times
|
user.password.retry.limit.count=Password input error {0} times
|
||||||
user.password.retry.limit.exceed=Password input error {0} times, account locked for {1} minutes
|
user.password.retry.limit.exceed=Password input error {0} times, account locked for {1} minutes
|
||||||
|
user.ip.retry.limit.exceed=Too many failed logins, please try again in {0} minutes
|
||||||
user.password.delete=Sorry, your account:{0} has been deleted
|
user.password.delete=Sorry, your account:{0} has been deleted
|
||||||
user.blocked=Sorry, your account: {0} has been disabled. Please contact the administrator
|
user.blocked=Sorry, your account: {0} has been disabled. Please contact the administrator
|
||||||
role.blocked=Role disabled,please contact administrators
|
role.blocked=Role disabled,please contact administrators
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ user.not.exists=对不起, 您的账号:{0} 不存在.
|
|||||||
user.password.not.match=用户不存在/密码错误
|
user.password.not.match=用户不存在/密码错误
|
||||||
user.password.retry.limit.count=密码输入错误{0}次
|
user.password.retry.limit.count=密码输入错误{0}次
|
||||||
user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
|
user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
|
||||||
|
user.ip.retry.limit.exceed=登录失败次数过多,请{0}分钟后再试
|
||||||
user.password.delete=对不起,您的账号:{0} 已被删除
|
user.password.delete=对不起,您的账号:{0} 已被删除
|
||||||
user.blocked=对不起,您的账号:{0} 已禁用,请联系管理员
|
user.blocked=对不起,您的账号:{0} 已禁用,请联系管理员
|
||||||
role.blocked=角色已封禁,请联系管理员
|
role.blocked=角色已封禁,请联系管理员
|
||||||
|
|||||||
+42
@@ -37,4 +37,46 @@ public class MimeTypeUtils {
|
|||||||
// pdf
|
// pdf
|
||||||
"pdf"};
|
"pdf"};
|
||||||
|
|
||||||
|
private static final java.util.Map<String, String> SAFE_CONTENT_TYPES = java.util.Map.ofEntries(
|
||||||
|
java.util.Map.entry("bmp", IMAGE_BMP),
|
||||||
|
java.util.Map.entry("gif", IMAGE_GIF),
|
||||||
|
java.util.Map.entry("jpg", IMAGE_JPEG),
|
||||||
|
java.util.Map.entry("jpeg", IMAGE_JPEG),
|
||||||
|
java.util.Map.entry("png", IMAGE_PNG),
|
||||||
|
java.util.Map.entry("pdf", "application/pdf"),
|
||||||
|
java.util.Map.entry("txt", "text/plain;charset=UTF-8"),
|
||||||
|
java.util.Map.entry("doc", "application/msword"),
|
||||||
|
java.util.Map.entry("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"),
|
||||||
|
java.util.Map.entry("xls", "application/vnd.ms-excel"),
|
||||||
|
java.util.Map.entry("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),
|
||||||
|
java.util.Map.entry("ppt", "application/vnd.ms-powerpoint"),
|
||||||
|
java.util.Map.entry("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"),
|
||||||
|
java.util.Map.entry("mp4", "video/mp4")
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展名是否在上传白名单内
|
||||||
|
*/
|
||||||
|
public static boolean isAllowedExtension(String extension) {
|
||||||
|
if (extension == null || extension.isBlank()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (String allowed : DEFAULT_ALLOWED_EXTENSION) {
|
||||||
|
if (allowed.equalsIgnoreCase(extension)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按扩展名确定存储时使用的 Content-Type,不信任客户端上报值,防止以 text/html 等类型上传后在浏览器中执行脚本
|
||||||
|
*/
|
||||||
|
public static String getSafeContentType(String extension) {
|
||||||
|
if (extension == null) {
|
||||||
|
return "application/octet-stream";
|
||||||
|
}
|
||||||
|
return SAFE_CONTENT_TYPES.getOrDefault(extension.toLowerCase(), "application/octet-stream");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+1
-1
@@ -41,7 +41,7 @@ public class MybatisExceptionHandler {
|
|||||||
return R.fail(HttpStatus.HTTP_INTERNAL_ERROR, "未找到数据源,请联系管理员确认");
|
return R.fail(HttpStatus.HTTP_INTERNAL_ERROR, "未找到数据源,请联系管理员确认");
|
||||||
}
|
}
|
||||||
log.error("请求地址'{}', Mybatis系统异常", requestURI, e);
|
log.error("请求地址'{}', Mybatis系统异常", requestURI, e);
|
||||||
return R.fail(HttpStatus.HTTP_INTERNAL_ERROR, message);
|
return R.fail(HttpStatus.HTTP_INTERNAL_ERROR, "数据处理异常,请稍后重试或联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+11
@@ -3,6 +3,7 @@ package org.dromara.common.satoken.handler;
|
|||||||
import cn.dev33.satoken.exception.NotLoginException;
|
import cn.dev33.satoken.exception.NotLoginException;
|
||||||
import cn.dev33.satoken.exception.NotPermissionException;
|
import cn.dev33.satoken.exception.NotPermissionException;
|
||||||
import cn.dev33.satoken.exception.NotRoleException;
|
import cn.dev33.satoken.exception.NotRoleException;
|
||||||
|
import cn.dev33.satoken.jwt.exception.SaJwtException;
|
||||||
import cn.hutool.http.HttpStatus;
|
import cn.hutool.http.HttpStatus;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -49,4 +50,14 @@ public class SaTokenExceptionHandler {
|
|||||||
return R.fail(HttpStatus.HTTP_UNAUTHORIZED, "认证失败,无法访问系统资源");
|
return R.fail(HttpStatus.HTTP_UNAUTHORIZED, "认证失败,无法访问系统资源");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JWT 签名无效/解析失败(常见于密钥变更后残留旧 token)
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(SaJwtException.class)
|
||||||
|
public R<Void> handleSaJwtException(SaJwtException e, HttpServletRequest request) {
|
||||||
|
String requestURI = request.getRequestURI();
|
||||||
|
log.error("请求地址'{}',JWT校验失败'{}',无法访问系统资源", requestURI, e.getMessage());
|
||||||
|
return R.fail(HttpStatus.HTTP_UNAUTHORIZED, "登录状态已失效,请重新登录");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+11
-1
@@ -59,9 +59,19 @@ public class SecurityConfig implements WebMvcConfigurer {
|
|||||||
StpUtil.checkLogin();
|
StpUtil.checkLogin();
|
||||||
|
|
||||||
// 检查 header 与 param 里的 clientid 与 token 里的是否一致
|
// 检查 header 与 param 里的 clientid 与 token 里的是否一致
|
||||||
|
// jwt 密钥切换后旧 token 会在 getExtra 时抛 SaJwtException,转为未登录避免页面报“未知异常”
|
||||||
String headerCid = request.getHeader(LoginHelper.CLIENT_KEY);
|
String headerCid = request.getHeader(LoginHelper.CLIENT_KEY);
|
||||||
String paramCid = ServletUtils.getParameter(LoginHelper.CLIENT_KEY);
|
String paramCid = ServletUtils.getParameter(LoginHelper.CLIENT_KEY);
|
||||||
String clientId = StpUtil.getExtra(LoginHelper.CLIENT_KEY).toString();
|
Object clientIdExtra;
|
||||||
|
try {
|
||||||
|
clientIdExtra = StpUtil.getExtra(LoginHelper.CLIENT_KEY);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw NotLoginException.newInstance(StpUtil.getLoginType(),
|
||||||
|
NotLoginException.INVALID_TOKEN,
|
||||||
|
"token无效或已过期,请重新登录",
|
||||||
|
StpUtil.getTokenValue());
|
||||||
|
}
|
||||||
|
String clientId = clientIdExtra == null ? null : clientIdExtra.toString();
|
||||||
if (!StringUtils.equalsAny(clientId, headerCid, paramCid)) {
|
if (!StringUtils.equalsAny(clientId, headerCid, paramCid)) {
|
||||||
// token 无效
|
// token 无效
|
||||||
throw NotLoginException.newInstance(StpUtil.getLoginType(),
|
throw NotLoginException.newInstance(StpUtil.getLoginType(),
|
||||||
|
|||||||
-28
@@ -6,7 +6,6 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.common.sse.core.SseEmitterManager;
|
import org.dromara.common.sse.core.SseEmitterManager;
|
||||||
import org.dromara.common.sse.dto.SseMessageDto;
|
|
||||||
import org.springframework.beans.factory.DisposableBean;
|
import org.springframework.beans.factory.DisposableBean;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
@@ -14,7 +13,6 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SSE 控制器
|
* SSE 控制器
|
||||||
@@ -51,32 +49,6 @@ public class SseController implements DisposableBean {
|
|||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 向特定用户发送消息
|
|
||||||
*
|
|
||||||
* @param userId 目标用户的 ID
|
|
||||||
* @param msg 要发送的消息内容
|
|
||||||
*/
|
|
||||||
@GetMapping(value = "${sse.path}/send")
|
|
||||||
public R<Void> send(Long userId, String msg) {
|
|
||||||
SseMessageDto dto = new SseMessageDto();
|
|
||||||
dto.setUserIds(List.of(userId));
|
|
||||||
dto.setMessage(msg);
|
|
||||||
sseEmitterManager.publishMessage(dto);
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 向所有用户发送消息
|
|
||||||
*
|
|
||||||
* @param msg 要发送的消息内容
|
|
||||||
*/
|
|
||||||
@GetMapping(value = "${sse.path}/sendAll")
|
|
||||||
public R<Void> send(String msg) {
|
|
||||||
sseEmitterManager.publishAll(msg);
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清理资源。此方法目前不执行任何操作,但避免因未实现而导致错误
|
* 清理资源。此方法目前不执行任何操作,但避免因未实现而导致错误
|
||||||
*/
|
*/
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ public class ResourcesConfig implements WebMvcConfigurer {
|
|||||||
public CorsFilter corsFilter() {
|
public CorsFilter corsFilter() {
|
||||||
CorsConfiguration config = new CorsConfiguration();
|
CorsConfiguration config = new CorsConfiguration();
|
||||||
config.setAllowCredentials(true);
|
config.setAllowCredentials(true);
|
||||||
// 设置访问源地址
|
// 设置访问源地址(恢复为原通配,避免生产域名/IP 不匹配导致整站接口被浏览器拦截)
|
||||||
config.addAllowedOriginPattern("*");
|
config.addAllowedOriginPattern("*");
|
||||||
// 设置访问源请求头
|
// 设置访问源请求头
|
||||||
config.addAllowedHeader("*");
|
config.addAllowedHeader("*");
|
||||||
|
|||||||
+33
-8
@@ -37,6 +37,30 @@ import java.io.IOException;
|
|||||||
@RestControllerAdvice
|
@RestControllerAdvice
|
||||||
public class GlobalExceptionHandler {
|
public class GlobalExceptionHandler {
|
||||||
|
|
||||||
|
private static final String DEFAULT_ERROR_MESSAGE = "系统繁忙,请稍后重试或联系管理员";
|
||||||
|
|
||||||
|
private static final String[] TECHNICAL_MARKERS = {
|
||||||
|
"###", "sql", "jdbc", "exception", "java.", "javax.", "jakarta.", "org.", "com.", "mapper",
|
||||||
|
"select ", "insert ", "update ", "delete ", " from ", " where ", "table", "column", "syntax",
|
||||||
|
"\tat ", "nested", "cause:", "null"
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅返回业务提示类异常信息,包含 SQL、类名、堆栈等技术细节的信息统一替换为通用提示,避免泄露系统内部结构
|
||||||
|
*/
|
||||||
|
public static String safeMessage(String message) {
|
||||||
|
if (message == null || message.isBlank() || message.length() > 300) {
|
||||||
|
return DEFAULT_ERROR_MESSAGE;
|
||||||
|
}
|
||||||
|
String lower = message.toLowerCase();
|
||||||
|
for (String marker : TECHNICAL_MARKERS) {
|
||||||
|
if (lower.contains(marker)) {
|
||||||
|
return DEFAULT_ERROR_MESSAGE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求方式不支持
|
* 请求方式不支持
|
||||||
*/
|
*/
|
||||||
@@ -55,7 +79,8 @@ public class GlobalExceptionHandler {
|
|||||||
public R<Void> handleServiceException(ServiceException e, HttpServletRequest request) {
|
public R<Void> handleServiceException(ServiceException e, HttpServletRequest request) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
Integer code = e.getCode();
|
Integer code = e.getCode();
|
||||||
return ObjectUtil.isNotNull(code) ? R.fail(code, e.getMessage()) : R.fail(e.getMessage());
|
String message = safeMessage(e.getMessage());
|
||||||
|
return ObjectUtil.isNotNull(code) ? R.fail(code, message) : R.fail(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,7 +101,7 @@ public class GlobalExceptionHandler {
|
|||||||
public R<Void> handleServletException(ServletException e, HttpServletRequest request) {
|
public R<Void> handleServletException(ServletException e, HttpServletRequest request) {
|
||||||
String requestURI = request.getRequestURI();
|
String requestURI = request.getRequestURI();
|
||||||
log.error("请求地址'{}',发生未知异常.", requestURI, e);
|
log.error("请求地址'{}',发生未知异常.", requestURI, e);
|
||||||
return R.fail(e.getMessage());
|
return R.fail(DEFAULT_ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,7 +110,7 @@ public class GlobalExceptionHandler {
|
|||||||
@ExceptionHandler(BaseException.class)
|
@ExceptionHandler(BaseException.class)
|
||||||
public R<Void> handleBaseException(BaseException e, HttpServletRequest request) {
|
public R<Void> handleBaseException(BaseException e, HttpServletRequest request) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
return R.fail(e.getMessage());
|
return R.fail(safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -105,7 +130,7 @@ public class GlobalExceptionHandler {
|
|||||||
public R<Void> handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e, HttpServletRequest request) {
|
public R<Void> handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e, HttpServletRequest request) {
|
||||||
String requestURI = request.getRequestURI();
|
String requestURI = request.getRequestURI();
|
||||||
log.error("请求参数类型不匹配'{}',发生系统异常.", requestURI);
|
log.error("请求参数类型不匹配'{}',发生系统异常.", requestURI);
|
||||||
return R.fail(String.format("请求参数类型不匹配,参数[%s]要求类型为:'%s',但输入值为:'%s'", e.getName(), e.getRequiredType().getName(), e.getValue()));
|
return R.fail(String.format("请求参数类型不匹配,参数[%s]格式错误", e.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -139,7 +164,7 @@ public class GlobalExceptionHandler {
|
|||||||
public R<Void> handleRuntimeException(RuntimeException e, HttpServletRequest request) {
|
public R<Void> handleRuntimeException(RuntimeException e, HttpServletRequest request) {
|
||||||
String requestURI = request.getRequestURI();
|
String requestURI = request.getRequestURI();
|
||||||
log.error("请求地址'{}',发生未知异常.", requestURI, e);
|
log.error("请求地址'{}',发生未知异常.", requestURI, e);
|
||||||
return R.fail(e.getMessage());
|
return R.fail(safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -149,7 +174,7 @@ public class GlobalExceptionHandler {
|
|||||||
public R<Void> handleException(Exception e, HttpServletRequest request) {
|
public R<Void> handleException(Exception e, HttpServletRequest request) {
|
||||||
String requestURI = request.getRequestURI();
|
String requestURI = request.getRequestURI();
|
||||||
log.error("请求地址'{}',发生系统异常.", requestURI, e);
|
log.error("请求地址'{}',发生系统异常.", requestURI, e);
|
||||||
return R.fail(e.getMessage());
|
return R.fail(DEFAULT_ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -190,7 +215,7 @@ public class GlobalExceptionHandler {
|
|||||||
public R<Void> handleJsonParseException(JsonParseException e, HttpServletRequest request) {
|
public R<Void> handleJsonParseException(JsonParseException e, HttpServletRequest request) {
|
||||||
String requestURI = request.getRequestURI();
|
String requestURI = request.getRequestURI();
|
||||||
log.error("请求地址'{}' 发生 JSON 解析异常: {}", requestURI, e.getMessage());
|
log.error("请求地址'{}' 发生 JSON 解析异常: {}", requestURI, e.getMessage());
|
||||||
return R.fail(HttpStatus.HTTP_BAD_REQUEST, "请求数据格式错误(JSON 解析失败):" + e.getMessage());
|
return R.fail(HttpStatus.HTTP_BAD_REQUEST, "请求数据格式错误(JSON 解析失败)");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -199,7 +224,7 @@ public class GlobalExceptionHandler {
|
|||||||
@ExceptionHandler(HttpMessageNotReadableException.class)
|
@ExceptionHandler(HttpMessageNotReadableException.class)
|
||||||
public R<Void> handleHttpMessageNotReadableException(HttpMessageNotReadableException e, HttpServletRequest request) {
|
public R<Void> handleHttpMessageNotReadableException(HttpMessageNotReadableException e, HttpServletRequest request) {
|
||||||
log.error("请求地址'{}', 参数解析失败: {}", request.getRequestURI(), e.getMessage());
|
log.error("请求地址'{}', 参数解析失败: {}", request.getRequestURI(), e.getMessage());
|
||||||
return R.fail(HttpStatus.HTTP_BAD_REQUEST, "请求参数格式错误:" + e.getMostSpecificCause().getMessage());
|
return R.fail(HttpStatus.HTTP_BAD_REQUEST, "请求参数格式错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+3
-12
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.bzrkh.controller;
|
package org.dromara.bzrkh.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -79,7 +80,7 @@ public class TeacherAssessmentController extends BaseController {
|
|||||||
return toAjax(result);
|
return toAjax(result);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// 返回具体的错误信息
|
// 返回具体的错误信息
|
||||||
return R.fail(e.getMessage());
|
return R.fail(GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 记录详细的异常信息
|
// 记录详细的异常信息
|
||||||
log.error("提交考核异常", e);
|
log.error("提交考核异常", e);
|
||||||
@@ -135,7 +136,7 @@ public class TeacherAssessmentController extends BaseController {
|
|||||||
return toAjax(result);
|
return toAjax(result);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// 返回具体的错误信息
|
// 返回具体的错误信息
|
||||||
return R.fail(e.getMessage());
|
return R.fail(GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 记录详细的异常信息
|
// 记录详细的异常信息
|
||||||
log.error("提交考核评分数据异常", e);
|
log.error("提交考核评分数据异常", e);
|
||||||
@@ -143,16 +144,6 @@ public class TeacherAssessmentController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试人数系数计算(临时调试接口)
|
|
||||||
* 用于验证特定人数的系数计算是否正确
|
|
||||||
*/
|
|
||||||
@GetMapping("/testCoefficient")
|
|
||||||
public R<Object> testStudentCountCoefficient(@RequestParam("studentCount") int studentCount) {
|
|
||||||
BigDecimal coefficient = teacherAssessmentService.testStudentCountCoefficient(studentCount);
|
|
||||||
return R.ok("学生人数: " + studentCount + ", 计算系数: " + coefficient);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询班级学生违纪记录和奖励记录
|
* 查询班级学生违纪记录和奖励记录
|
||||||
*/
|
*/
|
||||||
|
|||||||
+3
-2
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.cw.controller;
|
package org.dromara.cw.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
@@ -298,7 +299,7 @@ public class CwApprovalRecordController extends BaseController {
|
|||||||
return R.ok();
|
return R.ok();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("❌ 分管领导审批失败:applicationId={}, error={}", applicationId, e.getMessage(), e);
|
log.error("❌ 分管领导审批失败:applicationId={}, error={}", applicationId, e.getMessage(), e);
|
||||||
return R.fail("审批失败:" + e.getMessage());
|
return R.fail("审批失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,7 +331,7 @@ public class CwApprovalRecordController extends BaseController {
|
|||||||
return R.ok();
|
return R.ok();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("❌ 财务审批失败:applicationId={}, error={}", applicationId, e.getMessage(), e);
|
log.error("❌ 财务审批失败:applicationId={}, error={}", applicationId, e.getMessage(), e);
|
||||||
return R.fail("审批失败:" + e.getMessage());
|
return R.fail("审批失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-5
@@ -1,5 +1,7 @@
|
|||||||
package org.dromara.hq.controller;
|
package org.dromara.hq.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.core.utils.file.FileUtils;
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
@@ -120,7 +122,7 @@ public class HqPmRepairAttachmentController extends BaseController {
|
|||||||
HqPmRepairAttachmentVo result = attachmentService.uploadFile(orderId, uploadStage, file, description);
|
HqPmRepairAttachmentVo result = attachmentService.uploadFile(orderId, uploadStage, file, description);
|
||||||
return R.ok(result);
|
return R.ok(result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("上传失败: " + e.getMessage());
|
return R.fail("上传失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +147,7 @@ public class HqPmRepairAttachmentController extends BaseController {
|
|||||||
descriptions);
|
descriptions);
|
||||||
return R.ok(results);
|
return R.ok(results);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("批量上传失败: " + e.getMessage());
|
return R.fail("批量上传失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,12 +174,16 @@ public class HqPmRepairAttachmentController extends BaseController {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// 设置响应头
|
// 设置响应头
|
||||||
|
String filePath = attachment.getFilePath();
|
||||||
|
if (filePath == null || !(filePath.startsWith("https://") || filePath.startsWith("http://"))) {
|
||||||
|
response.sendError(HttpServletResponse.SC_NOT_FOUND);
|
||||||
|
return;
|
||||||
|
}
|
||||||
response.setContentType("application/octet-stream");
|
response.setContentType("application/octet-stream");
|
||||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + attachment.getFileName() + "\"");
|
FileUtils.setAttachmentResponseHeader(response, attachment.getFileName());
|
||||||
|
|
||||||
// 这里需要根据具体的文件存储方式来实现下载逻辑
|
|
||||||
// 如果使用OSS,可以直接重定向到OSS的URL
|
// 如果使用OSS,可以直接重定向到OSS的URL
|
||||||
response.sendRedirect(attachment.getFilePath());
|
response.sendRedirect(filePath);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("下载文件失败: {}", e.getMessage(), e);
|
log.error("下载文件失败: {}", e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.hq.controller;
|
package org.dromara.hq.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -204,7 +205,7 @@ public class HqSatSurveyController extends BaseController {
|
|||||||
return R.ok(result);
|
return R.ok(result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("提交问卷答案失败", e);
|
log.error("提交问卷答案失败", e);
|
||||||
return R.fail("提交失败:" + e.getMessage());
|
return R.fail("提交失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,7 +230,7 @@ public class HqSatSurveyController extends BaseController {
|
|||||||
return R.ok(result);
|
return R.ok(result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("保存问卷答案草稿失败", e);
|
log.error("保存问卷答案草稿失败", e);
|
||||||
return R.fail("保存草稿失败:" + e.getMessage());
|
return R.fail("保存草稿失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,7 +367,7 @@ public class HqSatSurveyController extends BaseController {
|
|||||||
if (e.getMessage() != null && e.getMessage().contains("未找到有效的答题记录")) {
|
if (e.getMessage() != null && e.getMessage().contains("未找到有效的答题记录")) {
|
||||||
return R.fail(404, "未找到有效的答题记录");
|
return R.fail(404, "未找到有效的答题记录");
|
||||||
}
|
}
|
||||||
return R.fail("获取答题记录失败:" + e.getMessage());
|
return R.fail("获取答题记录失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-79
@@ -1,6 +1,8 @@
|
|||||||
package org.dromara.jcbt.controller;
|
package org.dromara.jcbt.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
import org.dromara.common.core.validate.EditGroup;
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
@@ -145,6 +147,9 @@ public class JcbtScholarshipApplicationController extends BaseController {
|
|||||||
@Operation(summary = "查询我的申请记录")
|
@Operation(summary = "查询我的申请记录")
|
||||||
public R<List<JcbtScholarshipApplicationVo>> getMyApplications(@Parameter(description = "申请人ID") @RequestParam("applicantId") Long applicantId,
|
public R<List<JcbtScholarshipApplicationVo>> getMyApplications(@Parameter(description = "申请人ID") @RequestParam("applicantId") Long applicantId,
|
||||||
@Parameter(description = "批次ID") @RequestParam(value = "batchId", required = false) Long batchId) {
|
@Parameter(description = "批次ID") @RequestParam(value = "batchId", required = false) Long batchId) {
|
||||||
|
if (!StpUtil.hasPermission("jcbt:scholarshipApplication:list")) {
|
||||||
|
applicantId = LoginHelper.getUserId();
|
||||||
|
}
|
||||||
return R.ok(applicationService.queryApplicationsByApplicant(applicantId, batchId));
|
return R.ok(applicationService.queryApplicationsByApplicant(applicantId, batchId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,83 +340,4 @@ public class JcbtScholarshipApplicationController extends BaseController {
|
|||||||
return R.ok(applicationService.confirmClassSelection(teacherId, classId));
|
return R.ok(applicationService.confirmClassSelection(teacherId, classId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试接口:获取奖学金类型数据结构
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("jcbt:scholarshipApplication:scholarshipTypes")
|
|
||||||
@GetMapping("/test/scholarshipTypesStructure")
|
|
||||||
@Operation(summary = "测试接口:获取奖学金类型数据结构")
|
|
||||||
public R<Map<String, Object>> testScholarshipTypesStructure(@Parameter(description = "批次ID") @RequestParam("batchId") Long batchId,
|
|
||||||
@Parameter(description = "班级ID") @RequestParam(value = "classId", required = false) Long classId) {
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
|
||||||
try {
|
|
||||||
if (classId != null) {
|
|
||||||
result.put("withQuota", applicationService.getScholarshipTypesWithQuota(batchId, classId));
|
|
||||||
}
|
|
||||||
result.put("withoutQuota", applicationService.getScholarshipTypesByBatch(batchId));
|
|
||||||
result.put("batchId", batchId);
|
|
||||||
result.put("classId", classId);
|
|
||||||
result.put("timestamp", System.currentTimeMillis());
|
|
||||||
} catch (Exception e) {
|
|
||||||
result.put("error", e.getMessage());
|
|
||||||
}
|
|
||||||
return R.ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 调试接口:详细SQL日志输出测试
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("jcbt:scholarshipApplication:scholarshipTypes")
|
|
||||||
@GetMapping("/debug/sqlLogs")
|
|
||||||
@Operation(summary = "调试接口:详细SQL日志输出测试")
|
|
||||||
public R<Map<String, Object>> debugSqlLogs(@Parameter(description = "批次ID") @RequestParam("batchId") Long batchId,
|
|
||||||
@Parameter(description = "班级ID") @RequestParam("classId") Long classId,
|
|
||||||
@Parameter(description = "奖学金类型ID(可选,测试单个类型)") @RequestParam(value = "scholarshipTypeId", required = false) Long scholarshipTypeId) {
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
|
||||||
|
|
||||||
try {
|
|
||||||
log.info("🚀 === SQL调试接口开始 ===");
|
|
||||||
log.info("📥 接收参数: batchId={}, classId={}, scholarshipTypeId={}", batchId, classId, scholarshipTypeId);
|
|
||||||
|
|
||||||
result.put("requestParams", Map.of(
|
|
||||||
"batchId", batchId,
|
|
||||||
"classId", classId,
|
|
||||||
"scholarshipTypeId", scholarshipTypeId
|
|
||||||
));
|
|
||||||
|
|
||||||
// 如果指定了奖学金类型ID,则只测试该类型
|
|
||||||
if (scholarshipTypeId != null) {
|
|
||||||
log.info("🎯 单个奖学金类型测试模式");
|
|
||||||
|
|
||||||
// 测试班级名额查询
|
|
||||||
log.info("📊 开始测试班级名额查询");
|
|
||||||
var classQuota = applicationService.testClassQuotaQuery(classId, scholarshipTypeId, batchId);
|
|
||||||
result.put("classQuotaTest", classQuota);
|
|
||||||
|
|
||||||
// 测试全校名额查询
|
|
||||||
log.info("🏫 开始测试全校名额查询");
|
|
||||||
var schoolQuota = applicationService.testSchoolQuotaQuery(batchId, scholarshipTypeId);
|
|
||||||
result.put("schoolQuotaTest", schoolQuota);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
log.info("📋 完整流程测试模式");
|
|
||||||
// 完整流程测试
|
|
||||||
var quotaResult = applicationService.getScholarshipTypesWithQuota(batchId, classId);
|
|
||||||
result.put("fullProcessTest", quotaResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
result.put("status", "success");
|
|
||||||
result.put("timestamp", System.currentTimeMillis());
|
|
||||||
|
|
||||||
log.info("✅ === SQL调试接口完成 ===");
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("❌ === SQL调试接口异常 ===", e);
|
|
||||||
result.put("status", "error");
|
|
||||||
result.put("error", e.getMessage());
|
|
||||||
result.put("stackTrace", e.getStackTrace());
|
|
||||||
}
|
|
||||||
|
|
||||||
return R.ok(result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
-48
@@ -269,54 +269,6 @@ public class JcbtWorkStudyApplicationCollegeReviewController extends BaseControl
|
|||||||
|
|
||||||
// ========== 工具方法 ==========
|
// ========== 工具方法 ==========
|
||||||
|
|
||||||
/**
|
|
||||||
* 调试权限信息 - 查看当前用户的学院关联情况
|
|
||||||
*/
|
|
||||||
@Operation(summary = "调试权限信息")
|
|
||||||
@SaCheckPermission("jcbt:workStudyApplication:collegeReview")
|
|
||||||
@GetMapping("/debug/permission")
|
|
||||||
public R<Map<String, Object>> debugPermission() {
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
|
||||||
|
|
||||||
try {
|
|
||||||
Long userId = LoginHelper.getUserId();
|
|
||||||
result.put("userId", userId);
|
|
||||||
result.put("username", LoginHelper.getUsername());
|
|
||||||
result.put("deptId", LoginHelper.getDeptId());
|
|
||||||
result.put("deptName", LoginHelper.getDeptName());
|
|
||||||
|
|
||||||
try {
|
|
||||||
result.put("deptCategory", LoginHelper.getDeptCategory());
|
|
||||||
} catch (Exception e) {
|
|
||||||
result.put("deptCategory", "获取失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查学生信息
|
|
||||||
try {
|
|
||||||
XgStudentMsgVo studentInfo = xgStudentMsgService.queryByUserId(userId);
|
|
||||||
if (studentInfo != null) {
|
|
||||||
result.put("isStudent", true);
|
|
||||||
result.put("studentCollegeId", studentInfo.getCollegeId());
|
|
||||||
result.put("studentCollegeName", studentInfo.getCollegeName());
|
|
||||||
} else {
|
|
||||||
result.put("isStudent", false);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
result.put("studentInfoError", e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取最终的学院ID
|
|
||||||
String collegeId = getCurrentUserCollegeId();
|
|
||||||
result.put("finalCollegeId", collegeId);
|
|
||||||
result.put("hasCollegeAccess", collegeId != null);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
result.put("error", e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return R.ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前用户的学院ID
|
* 获取当前用户的学院ID
|
||||||
* 通过查询学生信息或用户部门信息获取
|
* 通过查询学生信息或用户部门信息获取
|
||||||
|
|||||||
+2
-46
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.jcbt.controller;
|
package org.dromara.jcbt.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
@@ -120,51 +121,6 @@ public class JcbtWorkStudyApplicationController extends BaseController {
|
|||||||
ExcelUtil.exportExcel(list, "勤工俭学申请信息", JcbtWorkStudyApplicationVo.class, response);
|
ExcelUtil.exportExcel(list, "勤工俭学申请信息", JcbtWorkStudyApplicationVo.class, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 临时调试接口 - 直接查询数据库记录
|
|
||||||
*/
|
|
||||||
@GetMapping("/debug/{id}")
|
|
||||||
public R<Map<String, Object>> debugQuery(@PathVariable("id") Long id) {
|
|
||||||
log.info("调试查询接口,ID: {}", id);
|
|
||||||
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
|
||||||
|
|
||||||
try {
|
|
||||||
// 1. 查询实体类
|
|
||||||
JcbtWorkStudyApplication entity = baseMapper.selectById(id);
|
|
||||||
result.put("entity", entity);
|
|
||||||
result.put("entityExists", entity != null);
|
|
||||||
if (entity != null) {
|
|
||||||
result.put("entityDetails", "ID=" + entity.getId() + ", studentName=" + entity.getStudentName() + ", deleted=" + entity.getDeleted());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 查询VO类
|
|
||||||
JcbtWorkStudyApplicationVo vo = baseMapper.selectVoById(id);
|
|
||||||
result.put("vo", vo);
|
|
||||||
result.put("voExists", vo != null);
|
|
||||||
if (vo != null) {
|
|
||||||
result.put("voDetails", "ID=" + vo.getId() + ", studentName=" + vo.getStudentName());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. 手动构建查询条件
|
|
||||||
LambdaQueryWrapper<JcbtWorkStudyApplication> wrapper = new LambdaQueryWrapper<>();
|
|
||||||
wrapper.eq(JcbtWorkStudyApplication::getId, id);
|
|
||||||
JcbtWorkStudyApplication manualEntity = baseMapper.selectOne(wrapper);
|
|
||||||
result.put("manualEntity", manualEntity);
|
|
||||||
result.put("manualEntityExists", manualEntity != null);
|
|
||||||
|
|
||||||
// 4. 查询数据库表中所有记录数量
|
|
||||||
Long totalCount = baseMapper.selectCount(new LambdaQueryWrapper<>());
|
|
||||||
result.put("totalRecords", totalCount);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("调试查询发生异常", e);
|
|
||||||
result.put("exception", e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return R.ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========== 业务功能接口(4个) ==========
|
// ========== 业务功能接口(4个) ==========
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -342,7 +298,7 @@ public class JcbtWorkStudyApplicationController extends BaseController {
|
|||||||
return R.ok(studentInfo);
|
return R.ok(studentInfo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取当前用户学生信息失败", e);
|
log.error("获取当前用户学生信息失败", e);
|
||||||
return R.fail("获取学生信息失败:" + e.getMessage());
|
return R.fail("获取学生信息失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.rs.controller;
|
package org.dromara.rs.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -224,6 +225,7 @@ public class RsApplicationController extends BaseController {
|
|||||||
@Log(title = "提交职位申请", businessType = BusinessType.INSERT)
|
@Log(title = "提交职位申请", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/apply")
|
@PostMapping("/apply")
|
||||||
public R<Void> apply(@RequestBody RsApplication application) {
|
public R<Void> apply(@RequestBody RsApplication application) {
|
||||||
|
application.setApplicantId(LoginHelper.getUserId());
|
||||||
// 检查是否已经申请过
|
// 检查是否已经申请过
|
||||||
RsApplication existingApp = applicationService.checkApplied(application.getJobId(), application.getApplicantId());
|
RsApplication existingApp = applicationService.checkApplied(application.getJobId(), application.getApplicantId());
|
||||||
if (existingApp != null) {
|
if (existingApp != null) {
|
||||||
@@ -241,7 +243,8 @@ public class RsApplicationController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/my/{applicantId}")
|
@GetMapping("/my/{applicantId}")
|
||||||
public TableDataInfo<RsApplication> myApplications(@PathVariable("applicantId") Long applicantId, PageQuery pageQuery) {
|
public TableDataInfo<RsApplication> myApplications(@PathVariable("applicantId") Long applicantId, PageQuery pageQuery) {
|
||||||
List<RsApplication> list = applicationService.selectApplicationsByApplicant(applicantId);
|
// 路径参数仅为兼容旧前端保留,只返回当前登录人的申请
|
||||||
|
List<RsApplication> list = applicationService.selectApplicationsByApplicant(LoginHelper.getUserId());
|
||||||
return TableDataInfo.build(list);
|
return TableDataInfo.build(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,10 +301,7 @@ public class RsApplicationController extends BaseController {
|
|||||||
@PostMapping("/submit")
|
@PostMapping("/submit")
|
||||||
public R<Map<String, Object>> submitApplication(@RequestBody RsApplication application) {
|
public R<Map<String, Object>> submitApplication(@RequestBody RsApplication application) {
|
||||||
try {
|
try {
|
||||||
// 设置默认状态
|
application.setStatus("pending");
|
||||||
if (StringUtils.isEmpty(application.getStatus())) {
|
|
||||||
application.setStatus("pending");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置申请时间
|
// 设置申请时间
|
||||||
application.setApplyTime(new java.util.Date());
|
application.setApplyTime(new java.util.Date());
|
||||||
@@ -331,7 +331,7 @@ public class RsApplicationController extends BaseController {
|
|||||||
return R.fail("申请提交失败");
|
return R.fail("申请提交失败");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("申请提交失败:" + e.getMessage());
|
return R.fail("申请提交失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.rs.controller;
|
package org.dromara.rs.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
@@ -85,7 +86,7 @@ public class RsInitController extends BaseController {
|
|||||||
return R.ok("菜单初始化成功");
|
return R.ok("菜单初始化成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return R.fail("菜单初始化失败: " + e.getMessage());
|
return R.fail("菜单初始化失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +114,7 @@ public class RsInitController extends BaseController {
|
|||||||
return R.ok("菜单清除成功");
|
return R.ok("菜单清除成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return R.fail("菜单清除失败: " + e.getMessage());
|
return R.fail("菜单清除失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +158,7 @@ public class RsInitController extends BaseController {
|
|||||||
return R.ok("菜单更新成功");
|
return R.ok("菜单更新成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return R.fail("菜单更新失败: " + e.getMessage());
|
return R.fail("菜单更新失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.rs.controller;
|
package org.dromara.rs.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -76,7 +77,7 @@ public class RsOverseasApplicationAttachmentController extends BaseController {
|
|||||||
return R.ok("上传成功", vo);
|
return R.ok("上传成功", vo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("上传附件失败", e);
|
log.error("上传附件失败", e);
|
||||||
return R.fail("上传失败:" + e.getMessage());
|
return R.fail("上传失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.rs.controller;
|
package org.dromara.rs.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
@@ -392,7 +393,7 @@ public class RsOverseasApplicationController extends BaseController {
|
|||||||
int fixedCount = applicationService.fixApprovedApplicationsWithoutRecords();
|
int fixedCount = applicationService.fixApprovedApplicationsWithoutRecords();
|
||||||
return R.ok("修复完成,共修复 " + fixedCount + " 条记录");
|
return R.ok("修复完成,共修复 " + fixedCount + " 条记录");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("修复失败:" + e.getMessage());
|
return R.fail("修复失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,7 +546,7 @@ public class RsOverseasApplicationController extends BaseController {
|
|||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return R.fail("系统异常:" + e.getMessage());
|
return R.fail("系统异常:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -612,7 +613,7 @@ public class RsOverseasApplicationController extends BaseController {
|
|||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return R.fail("系统异常:" + e.getMessage());
|
return R.fail("系统异常:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-35
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.rs.controller;
|
package org.dromara.rs.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
@@ -78,40 +79,6 @@ public class RsOverseasApprovalController extends BaseController {
|
|||||||
return approvalService.queryCombinedPageList(query);
|
return approvalService.queryCombinedPageList(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 调试接口:查看当前用户的权限过滤情况
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("rs:overseas:list")
|
|
||||||
@GetMapping("/debug/permission")
|
|
||||||
public R<Map<String, Object>> debugPermission(RsOverseasApprovalQuery query) {
|
|
||||||
Map<String, Object> debugInfo = new HashMap<>();
|
|
||||||
|
|
||||||
// 当前用户信息
|
|
||||||
debugInfo.put("currentUserId", LoginHelper.getUserId());
|
|
||||||
debugInfo.put("currentUsername", LoginHelper.getUsername());
|
|
||||||
debugInfo.put("currentDeptId", LoginHelper.getDeptId());
|
|
||||||
debugInfo.put("isSuperAdmin", LoginHelper.isSuperAdmin());
|
|
||||||
|
|
||||||
// 角色信息
|
|
||||||
debugInfo.put("hasRsApplicant", StpUtil.hasRole("rs-Applicant"));
|
|
||||||
debugInfo.put("hasRsAdmin", StpUtil.hasRole("rs-admin"));
|
|
||||||
debugInfo.put("hasApprove1Permission", StpUtil.hasPermission("rs:overseas:approve1"));
|
|
||||||
debugInfo.put("hasDeptHeadRole", StpUtil.hasRole("dept_head_role"));
|
|
||||||
debugInfo.put("hasOldApprovePermission", StpUtil.hasPermission("overseas:application:dept_head:approve"));
|
|
||||||
|
|
||||||
// 查询参数(应用权限过滤前)
|
|
||||||
debugInfo.put("originalQuery", query.toString());
|
|
||||||
|
|
||||||
// 应用权限过滤
|
|
||||||
TableDataInfo<RsOverseasApprovalVo> result = approvalService.queryCombinedPageList(query);
|
|
||||||
|
|
||||||
// 查询参数(应用权限过滤后)
|
|
||||||
debugInfo.put("filteredQuery", query.toString());
|
|
||||||
debugInfo.put("resultCount", result.getTotal());
|
|
||||||
|
|
||||||
return R.ok(debugInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据申请ID查询审批记录列表
|
* 根据申请ID查询审批记录列表
|
||||||
*/
|
*/
|
||||||
@@ -187,7 +154,7 @@ public class RsOverseasApprovalController extends BaseController {
|
|||||||
return R.ok("审批记录数据修复成功!");
|
return R.ok("审批记录数据修复成功!");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("修复审批记录数据失败", e);
|
log.error("修复审批记录数据失败", e);
|
||||||
return R.fail("修复失败:" + e.getMessage());
|
return R.fail("修复失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.rs.controller;
|
package org.dromara.rs.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
@@ -254,7 +255,7 @@ public class RsOverseasRecordController extends BaseController {
|
|||||||
|
|
||||||
return R.ok("测试数据初始化成功,请刷新页面查看");
|
return R.ok("测试数据初始化成功,请刷新页面查看");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("测试数据初始化失败: " + e.getMessage());
|
return R.fail("测试数据初始化失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-5
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.rs.controller;
|
package org.dromara.rs.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
@@ -222,7 +223,7 @@ public class RsTrainingApplicationController extends BaseController {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error("添加培训申请失败: " + e.getMessage(), e);
|
log.error("添加培训申请失败: " + e.getMessage(), e);
|
||||||
return R.fail("添加培训申请失败: " + e.getMessage());
|
return R.fail("添加培训申请失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,7 +323,7 @@ public class RsTrainingApplicationController extends BaseController {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error("添加培训申请失败: " + e.getMessage(), e);
|
log.error("添加培训申请失败: " + e.getMessage(), e);
|
||||||
return R.fail("添加培训申请失败: " + e.getMessage());
|
return R.fail("添加培训申请失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,7 +411,7 @@ public class RsTrainingApplicationController extends BaseController {
|
|||||||
return result ? R.ok() : R.fail("审批失败");
|
return result ? R.ok() : R.fail("审批失败");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("审批培训申请失败: {}", e.getMessage(), e);
|
log.error("审批培训申请失败: {}", e.getMessage(), e);
|
||||||
return R.fail("审批失败: " + e.getMessage());
|
return R.fail("审批失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,7 +442,7 @@ public class RsTrainingApplicationController extends BaseController {
|
|||||||
return R.ok(result);
|
return R.ok(result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("查询待审批申请失败: {}", e.getMessage(), e);
|
log.error("查询待审批申请失败: {}", e.getMessage(), e);
|
||||||
return R.fail("查询失败: " + e.getMessage());
|
return R.fail("查询失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -487,7 +488,7 @@ public class RsTrainingApplicationController extends BaseController {
|
|||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
log.error("解析用户ID失败,原始字符串: {}, 错误: {}", userIds, e.getMessage());
|
log.error("解析用户ID失败,原始字符串: {}, 错误: {}", userIds, e.getMessage());
|
||||||
return R.fail("用户ID格式错误: " + e.getMessage());
|
return R.fail("用户ID格式错误: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollUtil.isEmpty(userIdList)) {
|
if (CollUtil.isEmpty(userIdList)) {
|
||||||
|
|||||||
-27
@@ -52,33 +52,6 @@ public class RsTrainingRecordController extends BaseController {
|
|||||||
return trainingRecordService.selectPageRsTrainingRecordList(record, pageQuery);
|
return trainingRecordService.selectPageRsTrainingRecordList(record, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试培训地点搜索功能
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("rs:trainingrecord:list")
|
|
||||||
@GetMapping("/test-location")
|
|
||||||
public R<List<RsTrainingRecord>> testLocationSearch(@RequestParam("location") String location) {
|
|
||||||
log.info("测试培训地点搜索 - location参数: {}", location);
|
|
||||||
|
|
||||||
// 创建查询对象
|
|
||||||
RsTrainingRecord record = new RsTrainingRecord();
|
|
||||||
record.setLocation(location);
|
|
||||||
|
|
||||||
log.info("创建的查询对象 - location: {}", record.getLocation());
|
|
||||||
|
|
||||||
// 直接调用Mapper方法
|
|
||||||
List<RsTrainingRecord> list = trainingRecordService.selectRsTrainingRecordList(record);
|
|
||||||
|
|
||||||
log.info("查询结果数量: {}", list.size());
|
|
||||||
if (!list.isEmpty()) {
|
|
||||||
log.info("前3条记录的location值:");
|
|
||||||
list.stream().limit(3)
|
|
||||||
.forEach(r -> log.info(" - recordId: {}, location: {}", r.getRecordId(), r.getLocation()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return R.ok(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出培训记录列表
|
* 导出培训记录列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
+5
-1
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
|
import org.dromara.common.core.utils.file.MimeTypeUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.oss.core.OssClient;
|
import org.dromara.common.oss.core.OssClient;
|
||||||
import org.dromara.common.oss.entity.UploadResult;
|
import org.dromara.common.oss.entity.UploadResult;
|
||||||
@@ -86,7 +87,10 @@ public class RsOverseasApplicationAttachmentServiceImpl implements IRsOverseasAp
|
|||||||
// 获取文件信息
|
// 获取文件信息
|
||||||
String originalFilename = file.getOriginalFilename();
|
String originalFilename = file.getOriginalFilename();
|
||||||
String fileExtension = getFileExtension(originalFilename);
|
String fileExtension = getFileExtension(originalFilename);
|
||||||
String contentType = file.getContentType();
|
if (!MimeTypeUtils.isAllowedExtension(fileExtension)) {
|
||||||
|
throw new ServiceException("不允许的文件类型: " + fileExtension);
|
||||||
|
}
|
||||||
|
String contentType = MimeTypeUtils.getSafeContentType(fileExtension);
|
||||||
|
|
||||||
// 生成文件名
|
// 生成文件名
|
||||||
String fileName = "overseas_attachment_" + applicationId + "_" + System.currentTimeMillis()
|
String fileName = "overseas_attachment_" + applicationId + "_" + System.currentTimeMillis()
|
||||||
|
|||||||
+6
@@ -6,6 +6,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
@@ -132,6 +133,11 @@ public class StglActivityAttendanceController extends BaseController {
|
|||||||
@RequestParam(value = "studentNo", required = false) String studentNo) {
|
@RequestParam(value = "studentNo", required = false) String studentNo) {
|
||||||
|
|
||||||
List<StglActivityAttendanceVo> list;
|
List<StglActivityAttendanceVo> list;
|
||||||
|
if (!StpUtil.hasPermission("stgl:activityRegister:approve")
|
||||||
|
&& !StpUtil.hasPermission("stgl:activity:edit")) {
|
||||||
|
userId = LoginHelper.getUserId();
|
||||||
|
studentNo = null;
|
||||||
|
}
|
||||||
if (userId != null) {
|
if (userId != null) {
|
||||||
list = stglActivityAttendanceService.queryAllByActivityAndUser(activityId, userId);
|
list = stglActivityAttendanceService.queryAllByActivityAndUser(activityId, userId);
|
||||||
} else if (StringUtils.isNotBlank(studentNo)) {
|
} else if (StringUtils.isNotBlank(studentNo)) {
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
package org.dromara.stgl.controller;
|
package org.dromara.stgl.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
@@ -123,7 +124,7 @@ public class StglActivityRegistrationController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/checkRegistered")
|
@GetMapping("/checkRegistered")
|
||||||
public R<Boolean> checkRegistered(@RequestParam("activityId") Long activityId, @RequestParam(value = "userId", required = false) Long userId) {
|
public R<Boolean> checkRegistered(@RequestParam("activityId") Long activityId, @RequestParam(value = "userId", required = false) Long userId) {
|
||||||
Long currentUserId = userId != null ? userId : LoginHelper.getUserId();
|
Long currentUserId = userId != null && (StpUtil.hasPermission("stgl:activityRegister:approve") || StpUtil.hasPermission("stgl:activity:edit")) ? userId : LoginHelper.getUserId();
|
||||||
return R.ok(stglActivityRegistrationService.checkUserRegistered(activityId, currentUserId));
|
return R.ok(stglActivityRegistrationService.checkUserRegistered(activityId, currentUserId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +133,7 @@ public class StglActivityRegistrationController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/getUserRegistration")
|
@GetMapping("/getUserRegistration")
|
||||||
public R<StglActivityRegistrationVo> getUserRegistration(@RequestParam("activityId") Long activityId, @RequestParam(value = "userId", required = false) Long userId) {
|
public R<StglActivityRegistrationVo> getUserRegistration(@RequestParam("activityId") Long activityId, @RequestParam(value = "userId", required = false) Long userId) {
|
||||||
Long currentUserId = userId != null ? userId : LoginHelper.getUserId();
|
Long currentUserId = userId != null && (StpUtil.hasPermission("stgl:activityRegister:approve") || StpUtil.hasPermission("stgl:activity:edit")) ? userId : LoginHelper.getUserId();
|
||||||
return R.ok(stglActivityRegistrationService.getUserRegistration(activityId, currentUserId));
|
return R.ok(stglActivityRegistrationService.getUserRegistration(activityId, currentUserId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-21
@@ -192,27 +192,6 @@ public class StglClubController extends BaseController {
|
|||||||
return toAjax(stglClubService.transferClub(id, newPresidentUserId));
|
return toAjax(stglClubService.transferClub(id, newPresidentUserId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 临时测试接口:验证副社长数据映射
|
|
||||||
*/
|
|
||||||
@Operation(summary = "测试副社长数据映射")
|
|
||||||
@SaCheckPermission("stgl:club:query")
|
|
||||||
@GetMapping("/testVicePresidentData/{id}")
|
|
||||||
public R<StglClubVo> testVicePresidentData(@PathVariable("id") Long id) {
|
|
||||||
StglClubVo club = stglClubService.queryById(id);
|
|
||||||
if (club != null) {
|
|
||||||
// 输出调试信息到日志
|
|
||||||
System.out.println("=== 副社长数据测试 ===");
|
|
||||||
System.out.println("副社长姓名: " + club.getVicePresidentName());
|
|
||||||
System.out.println("副社长院系: " + club.getVicePresidentDept());
|
|
||||||
System.out.println("副社长专业: " + club.getVicePresidentMajor());
|
|
||||||
System.out.println("副社长班级: " + club.getVicePresidentClass());
|
|
||||||
System.out.println("副社长电话: " + club.getVicePresidentPhone());
|
|
||||||
System.out.println("=====================");
|
|
||||||
}
|
|
||||||
return R.ok(club);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启用/禁用社团
|
* 启用/禁用社团
|
||||||
*/
|
*/
|
||||||
|
|||||||
+7
-6
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.stgl.controller;
|
package org.dromara.stgl.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -53,7 +54,7 @@ public class StglClubPermissionController extends BaseController {
|
|||||||
return R.ok(result);
|
return R.ok(result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("检查社团活动权限失败,clubId: {}", clubId, e);
|
log.error("检查社团活动权限失败,clubId: {}", clubId, e);
|
||||||
return R.fail("检查权限失败: " + e.getMessage());
|
return R.fail("检查权限失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +86,7 @@ public class StglClubPermissionController extends BaseController {
|
|||||||
return R.ok(results);
|
return R.ok(results);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("批量检查社团权限失败,clubIds: {}", clubIds, e);
|
log.error("批量检查社团权限失败,clubIds: {}", clubIds, e);
|
||||||
return R.fail("批量检查权限失败: " + e.getMessage());
|
return R.fail("批量检查权限失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +110,7 @@ public class StglClubPermissionController extends BaseController {
|
|||||||
return R.ok(inWindow);
|
return R.ok(inWindow);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("检查年审窗口期失败,clubId: {}", clubId, e);
|
log.error("检查年审窗口期失败,clubId: {}", clubId, e);
|
||||||
return R.fail("检查失败: " + e.getMessage());
|
return R.fail("检查失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +134,7 @@ public class StglClubPermissionController extends BaseController {
|
|||||||
return R.ok(days);
|
return R.ok(days);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取距离年审天数失败,clubId: {}", clubId, e);
|
log.error("获取距离年审天数失败,clubId: {}", clubId, e);
|
||||||
return R.fail("获取失败: " + e.getMessage());
|
return R.fail("获取失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +158,7 @@ public class StglClubPermissionController extends BaseController {
|
|||||||
return R.ok(hasSubmitted);
|
return R.ok(hasSubmitted);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("检查年审提交状态失败,clubId: {}", clubId, e);
|
log.error("检查年审提交状态失败,clubId: {}", clubId, e);
|
||||||
return R.fail("检查失败: " + e.getMessage());
|
return R.fail("检查失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +195,7 @@ public class StglClubPermissionController extends BaseController {
|
|||||||
return R.ok(details);
|
return R.ok(details);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取社团权限详情失败,clubId: {}", clubId, e);
|
log.error("获取社团权限详情失败,clubId: {}", clubId, e);
|
||||||
return R.fail("获取详情失败: " + e.getMessage());
|
return R.fail("获取详情失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.stgl.controller;
|
package org.dromara.stgl.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
@@ -257,7 +258,7 @@ public class StglVolunteerTeamController extends BaseController {
|
|||||||
Integer fixedCount = stglVolunteerTeamService.fixExistingTeamLeaderRecords();
|
Integer fixedCount = stglVolunteerTeamService.fixExistingTeamLeaderRecords();
|
||||||
return R.ok("修复完成,共补充了 " + fixedCount + " 条队长成员记录");
|
return R.ok("修复完成,共补充了 " + fixedCount + " 条队长成员记录");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("修复失败:" + e.getMessage());
|
return R.fail("修复失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+23
-89
@@ -683,54 +683,32 @@ public class StglActivityServiceImpl extends ServiceImpl<StglActivityMapper, Stg
|
|||||||
* @param bo 查询条件
|
* @param bo 查询条件
|
||||||
*/
|
*/
|
||||||
private void applyDataScope(StglActivityBo bo) {
|
private void applyDataScope(StglActivityBo bo) {
|
||||||
try {
|
if (bo.getParams() == null) {
|
||||||
// 获取当前登录用户信息
|
bo.setParams(new HashMap<>());
|
||||||
Long currentUserId = LoginHelper.getUserId();
|
}
|
||||||
if (currentUserId == null) {
|
// 数据权限参数只能由服务端写入,丢弃请求中同名参数
|
||||||
return;
|
bo.getParams().keySet().removeIf(key -> key.startsWith("ds") || "dataScope".equals(key));
|
||||||
}
|
|
||||||
|
|
||||||
Set<String> roleKeys = LoginHelper.getLoginUser().getRolePermission();
|
Long currentUserId = LoginHelper.getUserId();
|
||||||
|
if (currentUserId == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Set<String> roleKeys = LoginHelper.getLoginUser().getRolePermission();
|
||||||
|
boolean manager = roleKeys.contains("admin") || roleKeys.contains("common");
|
||||||
|
|
||||||
// 如果是stgl_president角色且不是管理员,只能查看自己创建的活动
|
// 社长:只能查看自己创建的活动
|
||||||
if (roleKeys.contains("stgl_president") &&
|
if (roleKeys.contains("stgl_president") && !manager) {
|
||||||
!roleKeys.contains("admin") &&
|
bo.getParams().put("dsCreateBy", currentUserId);
|
||||||
!roleKeys.contains("common")) {
|
log.info("应用数据权限:用户 {} 为社长角色,只能查看自己创建的活动", currentUserId);
|
||||||
|
}
|
||||||
|
|
||||||
// 设置数据权限过滤条件 - 使用params.dataScope方式,与XML中的${activity.params.dataScope}对应
|
// 指导老师:只能查看自己指导的社团/志愿者队伍/活动
|
||||||
if (bo.getParams() == null) {
|
if (roleKeys.contains("stgl_instructor") && !manager) {
|
||||||
bo.setParams(new HashMap<>());
|
bo.getParams().put("dsInstructor", Boolean.TRUE);
|
||||||
}
|
bo.getParams().put("dsClubIds", getUserAdvisorClubIds(currentUserId));
|
||||||
bo.getParams().put("dataScope", "AND sa.create_by = " + currentUserId);
|
bo.getParams().put("dsTeamIds", getUserAdvisorTeamIds(currentUserId));
|
||||||
log.info("应用数据权限:用户 {} 为社长角色,只能查看自己创建的活动", currentUserId);
|
bo.getParams().put("dsActivityIds", getUserAdvisorActivityIds(currentUserId));
|
||||||
}
|
log.info("应用数据权限:用户 {} 为指导老师角色", currentUserId);
|
||||||
|
|
||||||
// 🔥 修正:如果是stgl_instructor角色且不是管理员,只能查看自己作为指导老师的活动
|
|
||||||
if (roleKeys.contains("stgl_instructor") &&
|
|
||||||
!roleKeys.contains("admin") &&
|
|
||||||
!roleKeys.contains("common")) {
|
|
||||||
|
|
||||||
// 获取用户作为指导老师的社团ID列表
|
|
||||||
List<Long> userAdvisorClubIds = getUserAdvisorClubIds(currentUserId);
|
|
||||||
|
|
||||||
// 获取用户作为指导老师的志愿者队伍ID列表
|
|
||||||
List<Long> userAdvisorTeamIds = getUserAdvisorTeamIds(currentUserId);
|
|
||||||
|
|
||||||
// 获取用户作为指导老师的活动ID列表
|
|
||||||
List<Long> userAdvisorActivityIds = getUserAdvisorActivityIds(currentUserId);
|
|
||||||
|
|
||||||
// 构建数据权限过滤条件
|
|
||||||
String dataScope = buildInstructorDataScope(userAdvisorClubIds, userAdvisorTeamIds, userAdvisorActivityIds);
|
|
||||||
|
|
||||||
if (bo.getParams() == null) {
|
|
||||||
bo.setParams(new HashMap<>());
|
|
||||||
}
|
|
||||||
bo.getParams().put("dataScope", dataScope);
|
|
||||||
log.info("应用数据权限:用户 {} 为指导老师角色,数据权限条件: {}", currentUserId, dataScope);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("应用数据权限控制失败:{}", e.getMessage(), e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -921,50 +899,6 @@ public class StglActivityServiceImpl extends ServiceImpl<StglActivityMapper, Stg
|
|||||||
return activityIds;
|
return activityIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建指导老师数据权限过滤条件
|
|
||||||
*
|
|
||||||
* @param userAdvisorClubIds 用户作为指导老师的社团ID列表
|
|
||||||
* @param userAdvisorTeamIds 用户作为指导老师的志愿者队伍ID列表
|
|
||||||
* @param userAdvisorActivityIds 用户作为指导老师的活动ID列表
|
|
||||||
* @return 数据权限过滤条件
|
|
||||||
*/
|
|
||||||
private String buildInstructorDataScope(List<Long> userAdvisorClubIds, List<Long> userAdvisorTeamIds, List<Long> userAdvisorActivityIds) {
|
|
||||||
List<String> conditions = new ArrayList<>();
|
|
||||||
|
|
||||||
// 1. 是活动关联社团的指导老师
|
|
||||||
if (!userAdvisorClubIds.isEmpty()) {
|
|
||||||
String clubIdsStr = userAdvisorClubIds.stream()
|
|
||||||
.map(String::valueOf)
|
|
||||||
.collect(Collectors.joining(","));
|
|
||||||
conditions.add("(sa.related_type = 1 AND sa.related_club_id IN (" + clubIdsStr + "))");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 是活动关联志愿者队伍的指导老师
|
|
||||||
if (!userAdvisorTeamIds.isEmpty()) {
|
|
||||||
String teamIdsStr = userAdvisorTeamIds.stream()
|
|
||||||
.map(String::valueOf)
|
|
||||||
.collect(Collectors.joining(","));
|
|
||||||
conditions.add("(sa.related_type = 2 AND sa.related_club_id IN (" + teamIdsStr + "))");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. 是活动本身的指导老师
|
|
||||||
if (!userAdvisorActivityIds.isEmpty()) {
|
|
||||||
String activityIdsStr = userAdvisorActivityIds.stream()
|
|
||||||
.map(String::valueOf)
|
|
||||||
.collect(Collectors.joining(","));
|
|
||||||
conditions.add("sa.id IN (" + activityIdsStr + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果没有任何权限,返回一个永远为false的条件
|
|
||||||
if (conditions.isEmpty()) {
|
|
||||||
return "AND 1 = 0";
|
|
||||||
}
|
|
||||||
|
|
||||||
// 组合所有条件,使用OR连接
|
|
||||||
return "AND (" + String.join(" OR ", conditions) + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ActivityRatingVo> getActivityRatings(Long activityId) {
|
public List<ActivityRatingVo> getActivityRatings(Long activityId) {
|
||||||
if (activityId == null) {
|
if (activityId == null) {
|
||||||
|
|||||||
+42
-2
@@ -207,7 +207,27 @@
|
|||||||
AND sa.related_club_id = #{relatedClubId}
|
AND sa.related_club_id = #{relatedClubId}
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据权限:非管理员只能查看自己创建的活动 -->
|
<!-- 数据权限:非管理员只能查看自己创建的活动 -->
|
||||||
${params.dataScope}
|
<if test="params != null">
|
||||||
|
<if test="params.dsCreateBy != null">
|
||||||
|
AND sa.create_by = #{params.dsCreateBy}
|
||||||
|
</if>
|
||||||
|
<if test="params.dsInstructor != null">
|
||||||
|
AND (1 = 0
|
||||||
|
<if test="params.dsClubIds != null and params.dsClubIds.size() > 0">
|
||||||
|
OR (sa.related_type = 1 AND sa.related_club_id IN
|
||||||
|
<foreach collection="params.dsClubIds" item="dsId" open="(" separator="," close=")">#{dsId}</foreach>)
|
||||||
|
</if>
|
||||||
|
<if test="params.dsTeamIds != null and params.dsTeamIds.size() > 0">
|
||||||
|
OR (sa.related_type = 2 AND sa.related_club_id IN
|
||||||
|
<foreach collection="params.dsTeamIds" item="dsId" open="(" separator="," close=")">#{dsId}</foreach>)
|
||||||
|
</if>
|
||||||
|
<if test="params.dsActivityIds != null and params.dsActivityIds.size() > 0">
|
||||||
|
OR sa.id IN
|
||||||
|
<foreach collection="params.dsActivityIds" item="dsId" open="(" separator="," close=")">#{dsId}</foreach>
|
||||||
|
</if>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY sa.create_time DESC
|
ORDER BY sa.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
@@ -366,7 +386,27 @@
|
|||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<!-- 数据权限:非管理员只能查看自己创建的活动 -->
|
<!-- 数据权限:非管理员只能查看自己创建的活动 -->
|
||||||
${activity.params.dataScope}
|
<if test="activity.params != null">
|
||||||
|
<if test="activity.params.dsCreateBy != null">
|
||||||
|
AND sa.create_by = #{activity.params.dsCreateBy}
|
||||||
|
</if>
|
||||||
|
<if test="activity.params.dsInstructor != null">
|
||||||
|
AND (1 = 0
|
||||||
|
<if test="activity.params.dsClubIds != null and activity.params.dsClubIds.size() > 0">
|
||||||
|
OR (sa.related_type = 1 AND sa.related_club_id IN
|
||||||
|
<foreach collection="activity.params.dsClubIds" item="dsId" open="(" separator="," close=")">#{dsId}</foreach>)
|
||||||
|
</if>
|
||||||
|
<if test="activity.params.dsTeamIds != null and activity.params.dsTeamIds.size() > 0">
|
||||||
|
OR (sa.related_type = 2 AND sa.related_club_id IN
|
||||||
|
<foreach collection="activity.params.dsTeamIds" item="dsId" open="(" separator="," close=")">#{dsId}</foreach>)
|
||||||
|
</if>
|
||||||
|
<if test="activity.params.dsActivityIds != null and activity.params.dsActivityIds.size() > 0">
|
||||||
|
OR sa.id IN
|
||||||
|
<foreach collection="activity.params.dsActivityIds" item="dsId" open="(" separator="," close=")">#{dsId}</foreach>
|
||||||
|
</if>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY sa.create_time DESC
|
ORDER BY sa.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
+5
-4
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.system.controller.system;
|
package org.dromara.system.controller.system;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
@@ -46,7 +47,7 @@ public class SysBucketPasswordController extends BaseController {
|
|||||||
return R.fail("密码重置失败");
|
return R.fail("密码重置失败");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("密码重置失败:" + e.getMessage());
|
return R.fail("密码重置失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +77,7 @@ public class SysBucketPasswordController extends BaseController {
|
|||||||
return R.fail("bucket密码配置不存在");
|
return R.fail("bucket密码配置不存在");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("获取bucket密码信息失败:" + e.getMessage());
|
return R.fail("获取bucket密码信息失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +98,7 @@ public class SysBucketPasswordController extends BaseController {
|
|||||||
var records = bucketPasswordService.getBucketAccessRecords(bucketName, limit);
|
var records = bucketPasswordService.getBucketAccessRecords(bucketName, limit);
|
||||||
return R.ok(records);
|
return R.ok(records);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("获取bucket访问记录失败:" + e.getMessage());
|
return R.fail("获取bucket访问记录失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,7 +120,7 @@ public class SysBucketPasswordController extends BaseController {
|
|||||||
bucketName, password, "127.0.0.1", "API-Test");
|
bucketName, password, "127.0.0.1", "API-Test");
|
||||||
return R.ok(isValid);
|
return R.ok(isValid);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("密码验证失败:" + e.getMessage());
|
return R.fail("密码验证失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+16
@@ -1,6 +1,8 @@
|
|||||||
package org.dromara.system.controller.system;
|
package org.dromara.system.controller.system;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.dev33.satoken.exception.NotPermissionException;
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
@@ -29,6 +31,15 @@ import java.util.List;
|
|||||||
@RequestMapping("/system/config")
|
@RequestMapping("/system/config")
|
||||||
public class SysConfigController extends BaseController {
|
public class SysConfigController extends BaseController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通登录用户可读取的参数键,其余参数(如初始密码)需具备参数查询权限
|
||||||
|
*/
|
||||||
|
private static final java.util.Set<String> PUBLIC_CONFIG_KEYS = java.util.Set.of(
|
||||||
|
"sys.oss.previewListResource",
|
||||||
|
"sys.account.registerUser",
|
||||||
|
"sys.account.captchaEnabled"
|
||||||
|
);
|
||||||
|
|
||||||
private final ISysConfigService configService;
|
private final ISysConfigService configService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,6 +80,11 @@ public class SysConfigController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping(value = "/configKey/{configKey}")
|
@GetMapping(value = "/configKey/{configKey}")
|
||||||
public R<String> getConfigKey(@PathVariable("configKey") String configKey) {
|
public R<String> getConfigKey(@PathVariable("configKey") String configKey) {
|
||||||
|
if (!PUBLIC_CONFIG_KEYS.contains(configKey)
|
||||||
|
&& !StpUtil.hasPermission("system:config:query")
|
||||||
|
&& !("sys.user.initPassword".equals(configKey) && (StpUtil.hasPermission("system:user:add") || StpUtil.hasPermission("system:user:resetPwd")))) {
|
||||||
|
throw new NotPermissionException("system:config:query");
|
||||||
|
}
|
||||||
return R.ok("操作成功", configService.selectConfigByKey(configKey));
|
return R.ok("操作成功", configService.selectConfigByKey(configKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+23
-8
@@ -1,6 +1,7 @@
|
|||||||
package org.dromara.system.controller.system;
|
package org.dromara.system.controller.system;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.oss.core.OssClient;
|
import org.dromara.common.oss.core.OssClient;
|
||||||
@@ -24,10 +25,13 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/resource/file")
|
@RequestMapping("/resource/file")
|
||||||
public class SysFileAccessController extends BaseController {
|
public class SysFileAccessController extends BaseController {
|
||||||
|
|
||||||
|
private static final int MAX_EXPIRE_SECONDS = 3600;
|
||||||
|
|
||||||
private final ISysOssService ossService;
|
private final ISysOssService ossService;
|
||||||
private final ISysBucketAccessPasswordService bucketPasswordService;
|
private final ISysBucketAccessPasswordService bucketPasswordService;
|
||||||
|
|
||||||
@@ -82,7 +86,7 @@ public class SysFileAccessController extends BaseController {
|
|||||||
// 生成预签名URL
|
// 生成预签名URL
|
||||||
String presignedUrl = storage.getPrivateUrl(
|
String presignedUrl = storage.getPrivateUrl(
|
||||||
oss.getFileName(),
|
oss.getFileName(),
|
||||||
Duration.ofSeconds(expireSeconds)
|
Duration.ofSeconds(limitExpireSeconds(expireSeconds))
|
||||||
);
|
);
|
||||||
|
|
||||||
// 记录文件访问日志
|
// 记录文件访问日志
|
||||||
@@ -91,7 +95,8 @@ public class SysFileAccessController extends BaseController {
|
|||||||
|
|
||||||
return R.ok(presignedUrl);
|
return R.ok(presignedUrl);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("获取文件访问链接失败:" + e.getMessage());
|
log.error("获取文件访问链接失败", e);
|
||||||
|
return R.fail("获取文件访问链接失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +137,7 @@ public class SysFileAccessController extends BaseController {
|
|||||||
OssClient storage = OssFactory.instance(oss.getService());
|
OssClient storage = OssFactory.instance(oss.getService());
|
||||||
String presignedUrl = storage.getPrivateUrl(
|
String presignedUrl = storage.getPrivateUrl(
|
||||||
oss.getFileName(),
|
oss.getFileName(),
|
||||||
Duration.ofSeconds(expireSeconds)
|
Duration.ofSeconds(limitExpireSeconds(expireSeconds))
|
||||||
);
|
);
|
||||||
urlMap.put(ossId, presignedUrl);
|
urlMap.put(ossId, presignedUrl);
|
||||||
|
|
||||||
@@ -144,7 +149,8 @@ public class SysFileAccessController extends BaseController {
|
|||||||
|
|
||||||
return R.ok(urlMap);
|
return R.ok(urlMap);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("批量获取文件访问链接失败:" + e.getMessage());
|
log.error("批量获取文件访问链接失败", e);
|
||||||
|
return R.fail("批量获取文件访问链接失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +195,7 @@ public class SysFileAccessController extends BaseController {
|
|||||||
OssClient storage = OssFactory.instance(oss.getService());
|
OssClient storage = OssFactory.instance(oss.getService());
|
||||||
String presignedUrl = storage.getPrivateUrl(
|
String presignedUrl = storage.getPrivateUrl(
|
||||||
oss.getFileName(),
|
oss.getFileName(),
|
||||||
Duration.ofSeconds(expireSeconds)
|
Duration.ofSeconds(limitExpireSeconds(expireSeconds))
|
||||||
);
|
);
|
||||||
|
|
||||||
// 记录下载日志
|
// 记录下载日志
|
||||||
@@ -198,7 +204,8 @@ public class SysFileAccessController extends BaseController {
|
|||||||
|
|
||||||
return R.ok(presignedUrl);
|
return R.ok(presignedUrl);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("获取文件下载链接失败:" + e.getMessage());
|
log.error("获取文件下载链接失败", e);
|
||||||
|
return R.fail("获取文件下载链接失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +250,7 @@ public class SysFileAccessController extends BaseController {
|
|||||||
OssClient storage = OssFactory.instance(oss.getService());
|
OssClient storage = OssFactory.instance(oss.getService());
|
||||||
String presignedUrl = storage.getPrivateUrl(
|
String presignedUrl = storage.getPrivateUrl(
|
||||||
oss.getFileName(),
|
oss.getFileName(),
|
||||||
Duration.ofSeconds(expireSeconds)
|
Duration.ofSeconds(limitExpireSeconds(expireSeconds))
|
||||||
);
|
);
|
||||||
|
|
||||||
// 记录预览日志
|
// 记录预览日志
|
||||||
@@ -252,10 +259,18 @@ public class SysFileAccessController extends BaseController {
|
|||||||
|
|
||||||
return R.ok(presignedUrl);
|
return R.ok(presignedUrl);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("获取文件预览链接失败:" + e.getMessage());
|
log.error("获取文件预览链接失败", e);
|
||||||
|
return R.fail("获取文件预览链接失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int limitExpireSeconds(Integer expireSeconds) {
|
||||||
|
if (expireSeconds == null || expireSeconds <= 0) {
|
||||||
|
return 300;
|
||||||
|
}
|
||||||
|
return Math.min(expireSeconds, MAX_EXPIRE_SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证bucket访问密码
|
* 验证bucket访问密码
|
||||||
*
|
*
|
||||||
|
|||||||
+8
-7
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.system.controller.wechat;
|
package org.dromara.system.controller.wechat;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -46,7 +47,7 @@ public class SysWeChatController extends BaseController {
|
|||||||
return R.ok("获取配置成功", config);
|
return R.ok("获取配置成功", config);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取微信JS-SDK配置失败", e);
|
log.error("获取微信JS-SDK配置失败", e);
|
||||||
return R.fail("获取配置失败: " + e.getMessage());
|
return R.fail("获取配置失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@ public class SysWeChatController extends BaseController {
|
|||||||
return R.ok("上传成功", result);
|
return R.ok("上传成功", result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("上传微信媒体文件失败", e);
|
log.error("上传微信媒体文件失败", e);
|
||||||
return R.fail("上传失败: " + e.getMessage());
|
return R.fail("上传失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +89,7 @@ public class SysWeChatController extends BaseController {
|
|||||||
return R.ok("下载成功", result);
|
return R.ok("下载成功", result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("下载微信媒体文件失败", e);
|
log.error("下载微信媒体文件失败", e);
|
||||||
return R.fail("下载失败: " + e.getMessage());
|
return R.fail("下载失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +110,7 @@ public class SysWeChatController extends BaseController {
|
|||||||
return R.ok("获取用户信息成功", result);
|
return R.ok("获取用户信息成功", result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取微信用户信息失败", e);
|
log.error("获取微信用户信息失败", e);
|
||||||
return R.fail("获取用户信息失败: " + e.getMessage());
|
return R.fail("获取用户信息失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +131,7 @@ public class SysWeChatController extends BaseController {
|
|||||||
return R.ok("创建支付订单成功", result);
|
return R.ok("创建支付订单成功", result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("创建微信支付订单失败", e);
|
log.error("创建微信支付订单失败", e);
|
||||||
return R.fail("创建支付订单失败: " + e.getMessage());
|
return R.fail("创建支付订单失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +152,7 @@ public class SysWeChatController extends BaseController {
|
|||||||
return R.ok("查询支付状态成功", result);
|
return R.ok("查询支付状态成功", result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("查询微信支付状态失败", e);
|
log.error("查询微信支付状态失败", e);
|
||||||
return R.fail("查询支付状态失败: " + e.getMessage());
|
return R.fail("查询支付状态失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +173,7 @@ public class SysWeChatController extends BaseController {
|
|||||||
return R.ok("下载文件到OSS成功", result);
|
return R.ok("下载文件到OSS成功", result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("下载微信媒体文件到OSS失败", e);
|
log.error("下载微信媒体文件到OSS失败", e);
|
||||||
return R.fail("下载文件到OSS失败: " + e.getMessage());
|
return R.fail("下载文件到OSS失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+21
-4
@@ -27,7 +27,10 @@ import org.dromara.common.oss.factory.OssFactory;
|
|||||||
import org.dromara.system.domain.SysOss;
|
import org.dromara.system.domain.SysOss;
|
||||||
import org.dromara.system.domain.bo.SysOssBo;
|
import org.dromara.system.domain.bo.SysOssBo;
|
||||||
import org.dromara.system.domain.vo.SysOssVo;
|
import org.dromara.system.domain.vo.SysOssVo;
|
||||||
|
import org.dromara.common.mybatis.helper.DataPermissionHelper;
|
||||||
|
import org.dromara.system.domain.SysUser;
|
||||||
import org.dromara.system.mapper.SysOssMapper;
|
import org.dromara.system.mapper.SysOssMapper;
|
||||||
|
import org.dromara.system.mapper.SysUserMapper;
|
||||||
import org.dromara.system.config.FileCacheConfig;
|
import org.dromara.system.config.FileCacheConfig;
|
||||||
import org.dromara.system.service.ISysOssService;
|
import org.dromara.system.service.ISysOssService;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -66,7 +69,10 @@ import java.util.zip.ZipOutputStream;
|
|||||||
@Service
|
@Service
|
||||||
public class SysOssServiceImpl implements ISysOssService, OssService {
|
public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||||
|
|
||||||
|
private static final String STUDENT_ACCOUNT_TYPE = "2";
|
||||||
|
|
||||||
private final SysOssMapper baseMapper;
|
private final SysOssMapper baseMapper;
|
||||||
|
private final SysUserMapper sysUserMapper;
|
||||||
private final FileCacheConfig fileCacheConfig;
|
private final FileCacheConfig fileCacheConfig;
|
||||||
|
|
||||||
// 🚀 LRU缓存实现
|
// 🚀 LRU缓存实现
|
||||||
@@ -292,7 +298,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||||||
OssClient storage = OssFactory.instance();
|
OssClient storage = OssFactory.instance();
|
||||||
UploadResult uploadResult;
|
UploadResult uploadResult;
|
||||||
try {
|
try {
|
||||||
uploadResult = storage.uploadSuffix(file.getBytes(), suffix, file.getContentType());
|
uploadResult = storage.uploadSuffix(file.getBytes(), suffix, MimeTypeUtils.getSafeContentType(ext));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ServiceException(e.getMessage());
|
throw new ServiceException(e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -907,6 +913,11 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 学生账号:不能访问其他学生上传的文件(身份证、贫困证明等),教职工上传的文件可访问
|
||||||
|
if (isStudentAccount(userId)) {
|
||||||
|
return ObjectUtil.isNotNull(oss.getCreateBy()) && !isStudentAccount(oss.getCreateBy());
|
||||||
|
}
|
||||||
|
|
||||||
// 5. 具备 OSS 管理/下载类权限的用户
|
// 5. 具备 OSS 管理/下载类权限的用户
|
||||||
if (StpUtil.hasPermission("system:oss:download")
|
if (StpUtil.hasPermission("system:oss:download")
|
||||||
|| StpUtil.hasPermission("system:oss:list")
|
|| StpUtil.hasPermission("system:oss:list")
|
||||||
@@ -915,12 +926,18 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6. 业务场景(请假/宿检等):审批人需查看申请人附件。
|
// 6. 业务场景(请假/宿检等):教职工审批人需查看申请人附件
|
||||||
// 全量列表已由 system:oss:list 约束;此处允许任意已登录用户按 ossId 访问单个文件。
|
|
||||||
// 后续应按业务单据做归属校验以消除枚举 IDOR。
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isStudentAccount(Long userId) {
|
||||||
|
SysUser user = DataPermissionHelper.ignore(() -> sysUserMapper.selectOne(
|
||||||
|
Wrappers.lambdaQuery(SysUser.class)
|
||||||
|
.select(SysUser::getUserId, SysUser::getAccountType)
|
||||||
|
.eq(SysUser::getUserId, userId)));
|
||||||
|
return user != null && STUDENT_ACCOUNT_TYPE.equals(user.getAccountType());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记录文件访问日志
|
* 记录文件访问日志
|
||||||
*
|
*
|
||||||
|
|||||||
+2
-2
@@ -136,7 +136,7 @@ public class SysWeChatServiceImpl implements ISysWeChatService {
|
|||||||
"https://api.weixin.qq.com/cgi-bin/media/get?access_token=%s&media_id=%s",
|
"https://api.weixin.qq.com/cgi-bin/media/get?access_token=%s&media_id=%s",
|
||||||
accessToken, mediaId);
|
accessToken, mediaId);
|
||||||
|
|
||||||
log.info("微信多媒体下载URL: {}", downloadUrl);
|
log.info("微信多媒体下载,mediaId: {}", mediaId);
|
||||||
|
|
||||||
// 4. 发起HTTP请求下载文件
|
// 4. 发起HTTP请求下载文件
|
||||||
HttpResponse response = HttpRequest.get(downloadUrl).execute();
|
HttpResponse response = HttpRequest.get(downloadUrl).execute();
|
||||||
@@ -314,7 +314,7 @@ public class SysWeChatServiceImpl implements ISysWeChatService {
|
|||||||
"https://api.weixin.qq.com/cgi-bin/media/get?access_token=%s&media_id=%s",
|
"https://api.weixin.qq.com/cgi-bin/media/get?access_token=%s&media_id=%s",
|
||||||
accessToken, mediaId);
|
accessToken, mediaId);
|
||||||
|
|
||||||
log.info("微信多媒体下载URL: {}", downloadUrl);
|
log.info("微信多媒体下载,mediaId: {}", mediaId);
|
||||||
|
|
||||||
// 4. 发起HTTP请求下载文件
|
// 4. 发起HTTP请求下载文件
|
||||||
HttpResponse response = HttpRequest.get(downloadUrl).execute();
|
HttpResponse response = HttpRequest.get(downloadUrl).execute();
|
||||||
|
|||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
package org.dromara.workflow.common.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作流管理类接口权限标识(菜单见 script/sql/update/update_20261026_workflow_permission.sql)
|
||||||
|
*/
|
||||||
|
public interface FlowPermissionConstant {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程定义查看(含设计器读取)
|
||||||
|
*/
|
||||||
|
String DEFINITION_LIST = "workflow:definition:list";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程定义新增/修改/发布/导入/删除(含设计器保存)
|
||||||
|
*/
|
||||||
|
String DEFINITION_EDIT = "workflow:definition:edit";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程实例管理:全部实例查询、作废、激活挂起、变量查看、删除他人实例
|
||||||
|
*/
|
||||||
|
String INSTANCE_MANAGE = "workflow:instance:manage";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全部待办/已办查询与转派办理人
|
||||||
|
*/
|
||||||
|
String TASK_MANAGE = "workflow:task:manage";
|
||||||
|
|
||||||
|
}
|
||||||
+56
-2
@@ -1,16 +1,70 @@
|
|||||||
package org.dromara.workflow.config;
|
package org.dromara.workflow.config;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||||
|
import cn.dev33.satoken.router.SaRouter;
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.warm.flow.core.condition.ConditionStrategy;
|
||||||
|
import org.dromara.warm.flow.core.listener.ListenerStrategy;
|
||||||
|
import org.dromara.warm.flow.core.strategy.ExpressionStrategy;
|
||||||
|
import org.dromara.warm.flow.core.utils.ExpressionUtil;
|
||||||
|
import org.dromara.warm.flow.core.variable.VariableStrategy;
|
||||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||||
|
import org.dromara.workflow.common.constant.FlowPermissionConstant;
|
||||||
|
import org.dromara.workflow.config.expression.SafeExpressionStrategies;
|
||||||
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.event.EventListener;
|
||||||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* warmFlow配置
|
* warmFlow配置
|
||||||
*
|
*
|
||||||
* @author may
|
* @author may
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@ConditionalOnEnable
|
@ConditionalOnEnable
|
||||||
@Configuration
|
@Configuration
|
||||||
public class WarmFlowConfig {
|
public class WarmFlowConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
private static final String WARM_FLOW_SPEL_PACKAGE = "org.dromara.warm.plugin.modes.sb.expression.";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* warm-flow 自带 SpEL 策略使用无限制的 StandardEvaluationContext,存在表达式注入执行系统命令的风险,
|
||||||
|
* 启动完成后移除并替换为受限实现
|
||||||
|
*/
|
||||||
|
@EventListener(ApplicationReadyEvent.class)
|
||||||
|
public void replaceSpelStrategies() {
|
||||||
|
removeBuiltinSpel(ConditionStrategy.expressionStrategyList);
|
||||||
|
removeBuiltinSpel(ListenerStrategy.expressionStrategyList);
|
||||||
|
removeBuiltinSpel(VariableStrategy.expressionStrategyList);
|
||||||
|
ExpressionUtil.setExpression(new SafeExpressionStrategies.ConditionDefault());
|
||||||
|
ExpressionUtil.setExpression(new SafeExpressionStrategies.ConditionSpel());
|
||||||
|
ExpressionUtil.setExpression(new SafeExpressionStrategies.ListenerSpel());
|
||||||
|
ExpressionUtil.setExpression(new SafeExpressionStrategies.VariableSpel());
|
||||||
|
log.info("warm-flow SpEL 表达式策略已替换为受限实现");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> void removeBuiltinSpel(List<ExpressionStrategy<T>> strategies) {
|
||||||
|
strategies.removeIf(s -> s.getClass().getName().startsWith(WARM_FLOW_SPEL_PACKAGE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* warm-flow 设计器接口(/warm-flow/**)只做了登录校验,此处按权限收紧;流程图查看接口保持登录即可访问
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
|
registry.addInterceptor(new SaInterceptor(handler -> {
|
||||||
|
SaRouter.match("/warm-flow/save-json", "/warm-flow/form-content")
|
||||||
|
.check(() -> StpUtil.checkPermission(FlowPermissionConstant.DEFINITION_EDIT));
|
||||||
|
SaRouter.match("/warm-flow/query-def/**", "/warm-flow/handler-*", "/warm-flow/published-form",
|
||||||
|
"/warm-flow/form-content/**")
|
||||||
|
.check(() -> StpUtil.checkPermission(FlowPermissionConstant.DEFINITION_LIST));
|
||||||
|
}).isAnnotation(false))
|
||||||
|
.addPathPatterns("/warm-flow/**");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+83
@@ -0,0 +1,83 @@
|
|||||||
|
package org.dromara.workflow.config.expression;
|
||||||
|
|
||||||
|
import org.dromara.warm.flow.core.condition.ConditionStrategy;
|
||||||
|
import org.dromara.warm.flow.core.listener.ListenerStrategy;
|
||||||
|
import org.dromara.warm.flow.core.variable.VariableStrategy;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 与 warm-flow-plugin-modes-sb 中 SpEL 策略行为一致,仅将解析器替换为 {@link SafeSpelHelper}
|
||||||
|
*/
|
||||||
|
public final class SafeExpressionStrategies {
|
||||||
|
|
||||||
|
private SafeExpressionStrategies() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条件表达式:default@@${flag} == 1
|
||||||
|
*/
|
||||||
|
public static class ConditionDefault implements ConditionStrategy {
|
||||||
|
@Override
|
||||||
|
public String getType() {
|
||||||
|
return "default";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean eval(String expression, Map<String, Object> variable) {
|
||||||
|
expression = expression.replace("$", "#");
|
||||||
|
for (Map.Entry<String, Object> entry : variable.entrySet()) {
|
||||||
|
if (expression.contains(entry.getKey())) {
|
||||||
|
expression = expression.replace(entry.getKey(), "#" + entry.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Boolean.TRUE.equals(SafeSpelHelper.parseExpression(expression, variable));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条件表达式:spel@@#{...}
|
||||||
|
*/
|
||||||
|
public static class ConditionSpel implements ConditionStrategy {
|
||||||
|
@Override
|
||||||
|
public String getType() {
|
||||||
|
return "spel";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean eval(String expression, Map<String, Object> variable) {
|
||||||
|
return Boolean.TRUE.equals(SafeSpelHelper.parseExpression(expression, variable));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监听器表达式:#{...}
|
||||||
|
*/
|
||||||
|
public static class ListenerSpel implements ListenerStrategy {
|
||||||
|
@Override
|
||||||
|
public String getType() {
|
||||||
|
return "#";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean eval(String expression, Map<String, Object> variable) {
|
||||||
|
SafeSpelHelper.parseExpression(expression, variable);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 办理人表达式:#{...}
|
||||||
|
*/
|
||||||
|
public static class VariableSpel implements VariableStrategy {
|
||||||
|
@Override
|
||||||
|
public String getType() {
|
||||||
|
return "#";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object preEval(String expression, Map<String, Object> variable) {
|
||||||
|
return SafeSpelHelper.parseExpression(expression, variable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+98
@@ -0,0 +1,98 @@
|
|||||||
|
package org.dromara.workflow.config.expression;
|
||||||
|
|
||||||
|
import org.dromara.common.core.utils.SpringUtils;
|
||||||
|
import org.springframework.aop.support.AopUtils;
|
||||||
|
import org.springframework.core.convert.TypeDescriptor;
|
||||||
|
import org.springframework.expression.AccessException;
|
||||||
|
import org.springframework.expression.BeanResolver;
|
||||||
|
import org.springframework.expression.EvaluationContext;
|
||||||
|
import org.springframework.expression.EvaluationException;
|
||||||
|
import org.springframework.expression.ExpressionParser;
|
||||||
|
import org.springframework.expression.MethodExecutor;
|
||||||
|
import org.springframework.expression.ParserContext;
|
||||||
|
import org.springframework.expression.common.TemplateParserContext;
|
||||||
|
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||||
|
import org.springframework.expression.spel.support.ReflectiveMethodResolver;
|
||||||
|
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||||
|
|
||||||
|
import java.time.temporal.Temporal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 受限的流程表达式解析器
|
||||||
|
* <p>
|
||||||
|
* 替代 warm-flow 自带 SpelHelper(StandardEvaluationContext 无任何限制,可通过 T(java.lang.Runtime) 执行系统命令)。
|
||||||
|
* 仅允许:变量引用、运算符、org.dromara 业务 Bean(排除 org.dromara.common)以及基础值类型上的方法调用。
|
||||||
|
*/
|
||||||
|
public final class SafeSpelHelper {
|
||||||
|
|
||||||
|
private static final ExpressionParser PARSER = new SpelExpressionParser();
|
||||||
|
private static final ParserContext PARSER_CONTEXT = new TemplateParserContext();
|
||||||
|
|
||||||
|
private static final String ALLOWED_PACKAGE = "org.dromara.";
|
||||||
|
private static final String DENIED_PACKAGE = "org.dromara.common.";
|
||||||
|
|
||||||
|
private static final Set<String> DENIED_METHODS = Set.of(
|
||||||
|
"getClass", "getClassLoader", "forName", "newInstance", "invoke", "exec", "start",
|
||||||
|
"getRuntime", "getMethod", "getMethods", "getDeclaredMethod", "getDeclaredMethods",
|
||||||
|
"getField", "getDeclaredField", "getConstructor", "getDeclaredConstructor",
|
||||||
|
"getBean", "getBeansOfType", "getApplicationContext", "getBeanFactory",
|
||||||
|
"wait", "notify", "notifyAll"
|
||||||
|
);
|
||||||
|
|
||||||
|
private SafeSpelHelper() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Object parseExpression(String expression, Map<String, Object> variables) {
|
||||||
|
StandardEvaluationContext context = new StandardEvaluationContext();
|
||||||
|
context.setTypeLocator(typeName -> {
|
||||||
|
throw new EvaluationException("流程表达式禁止引用类型: " + typeName);
|
||||||
|
});
|
||||||
|
context.setConstructorResolvers(new ArrayList<>());
|
||||||
|
context.setMethodResolvers(List.of(new SafeMethodResolver()));
|
||||||
|
context.setBeanResolver(new SafeBeanResolver());
|
||||||
|
context.setVariables(variables);
|
||||||
|
return PARSER.parseExpression(expression, PARSER_CONTEXT).getValue(context, Object.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isBusinessClass(Class<?> clazz) {
|
||||||
|
String name = clazz.getName();
|
||||||
|
return name.startsWith(ALLOWED_PACKAGE) && !name.startsWith(DENIED_PACKAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isValueObject(Object target) {
|
||||||
|
return target instanceof CharSequence || target instanceof Number || target instanceof Boolean
|
||||||
|
|| target instanceof Character || target instanceof Date || target instanceof Temporal
|
||||||
|
|| target instanceof Collection || target instanceof Map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SafeMethodResolver extends ReflectiveMethodResolver {
|
||||||
|
@Override
|
||||||
|
public MethodExecutor resolve(EvaluationContext context, Object targetObject, String name,
|
||||||
|
List<TypeDescriptor> argumentTypes) throws AccessException {
|
||||||
|
if (targetObject == null || targetObject instanceof Class || DENIED_METHODS.contains(name)) {
|
||||||
|
throw new AccessException("流程表达式禁止调用方法: " + name);
|
||||||
|
}
|
||||||
|
if (!isValueObject(targetObject) && !isBusinessClass(AopUtils.getTargetClass(targetObject))) {
|
||||||
|
throw new AccessException("流程表达式禁止调用该对象的方法: " + name);
|
||||||
|
}
|
||||||
|
return super.resolve(context, targetObject, name, argumentTypes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SafeBeanResolver implements BeanResolver {
|
||||||
|
@Override
|
||||||
|
public Object resolve(EvaluationContext context, String beanName) throws AccessException {
|
||||||
|
Object bean = SpringUtils.getBean(beanName);
|
||||||
|
if (!isBusinessClass(AopUtils.getTargetClass(bean))) {
|
||||||
|
throw new AccessException("流程表达式禁止引用该 Bean: " + beanName);
|
||||||
|
}
|
||||||
|
return bean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+15
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.workflow.controller;
|
package org.dromara.workflow.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
@@ -13,6 +14,7 @@ import org.dromara.warm.flow.core.entity.Definition;
|
|||||||
import org.dromara.warm.flow.core.service.DefService;
|
import org.dromara.warm.flow.core.service.DefService;
|
||||||
import org.dromara.warm.flow.orm.entity.FlowDefinition;
|
import org.dromara.warm.flow.orm.entity.FlowDefinition;
|
||||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||||
|
import org.dromara.workflow.common.constant.FlowPermissionConstant;
|
||||||
import org.dromara.workflow.domain.vo.FlowDefinitionVo;
|
import org.dromara.workflow.domain.vo.FlowDefinitionVo;
|
||||||
import org.dromara.workflow.service.IFlwDefinitionService;
|
import org.dromara.workflow.service.IFlwDefinitionService;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -44,6 +46,7 @@ public class FlwDefinitionController extends BaseController {
|
|||||||
* @param flowDefinition 参数
|
* @param flowDefinition 参数
|
||||||
* @param pageQuery 分页
|
* @param pageQuery 分页
|
||||||
*/
|
*/
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.DEFINITION_LIST)
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<FlowDefinitionVo> list(FlowDefinition flowDefinition, PageQuery pageQuery) {
|
public TableDataInfo<FlowDefinitionVo> list(FlowDefinition flowDefinition, PageQuery pageQuery) {
|
||||||
return flwDefinitionService.queryList(flowDefinition, pageQuery);
|
return flwDefinitionService.queryList(flowDefinition, pageQuery);
|
||||||
@@ -55,6 +58,7 @@ public class FlwDefinitionController extends BaseController {
|
|||||||
* @param flowDefinition 参数
|
* @param flowDefinition 参数
|
||||||
* @param pageQuery 分页
|
* @param pageQuery 分页
|
||||||
*/
|
*/
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.DEFINITION_LIST)
|
||||||
@GetMapping("/unPublishList")
|
@GetMapping("/unPublishList")
|
||||||
public TableDataInfo<FlowDefinitionVo> unPublishList(FlowDefinition flowDefinition, PageQuery pageQuery) {
|
public TableDataInfo<FlowDefinitionVo> unPublishList(FlowDefinition flowDefinition, PageQuery pageQuery) {
|
||||||
return flwDefinitionService.unPublishList(flowDefinition, pageQuery);
|
return flwDefinitionService.unPublishList(flowDefinition, pageQuery);
|
||||||
@@ -65,6 +69,7 @@ public class FlwDefinitionController extends BaseController {
|
|||||||
*
|
*
|
||||||
* @param id 流程定义id
|
* @param id 流程定义id
|
||||||
*/
|
*/
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.DEFINITION_LIST)
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public R<Definition> getInfo(@PathVariable("id") Long id) {
|
public R<Definition> getInfo(@PathVariable("id") Long id) {
|
||||||
return R.ok(defService.getById(id));
|
return R.ok(defService.getById(id));
|
||||||
@@ -76,6 +81,7 @@ public class FlwDefinitionController extends BaseController {
|
|||||||
* @param flowDefinition 参数
|
* @param flowDefinition 参数
|
||||||
*/
|
*/
|
||||||
@Log(title = "流程定义", businessType = BusinessType.INSERT)
|
@Log(title = "流程定义", businessType = BusinessType.INSERT)
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -89,6 +95,7 @@ public class FlwDefinitionController extends BaseController {
|
|||||||
* @param flowDefinition 参数
|
* @param flowDefinition 参数
|
||||||
*/
|
*/
|
||||||
@Log(title = "流程定义", businessType = BusinessType.UPDATE)
|
@Log(title = "流程定义", businessType = BusinessType.UPDATE)
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -102,6 +109,7 @@ public class FlwDefinitionController extends BaseController {
|
|||||||
* @param id 流程定义id
|
* @param id 流程定义id
|
||||||
*/
|
*/
|
||||||
@Log(title = "流程定义", businessType = BusinessType.INSERT)
|
@Log(title = "流程定义", businessType = BusinessType.INSERT)
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
||||||
@PutMapping("/publish/{id}")
|
@PutMapping("/publish/{id}")
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
public R<Boolean> publish(@PathVariable("id") Long id) {
|
public R<Boolean> publish(@PathVariable("id") Long id) {
|
||||||
@@ -114,6 +122,7 @@ public class FlwDefinitionController extends BaseController {
|
|||||||
* @param id 流程定义id
|
* @param id 流程定义id
|
||||||
*/
|
*/
|
||||||
@Log(title = "流程定义", businessType = BusinessType.INSERT)
|
@Log(title = "流程定义", businessType = BusinessType.INSERT)
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
||||||
@PutMapping("/unPublish/{id}")
|
@PutMapping("/unPublish/{id}")
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -125,6 +134,7 @@ public class FlwDefinitionController extends BaseController {
|
|||||||
* 删除流程定义
|
* 删除流程定义
|
||||||
*/
|
*/
|
||||||
@Log(title = "流程定义", businessType = BusinessType.DELETE)
|
@Log(title = "流程定义", businessType = BusinessType.DELETE)
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public R<Void> remove(@PathVariable("ids") List<Long> ids) {
|
public R<Void> remove(@PathVariable("ids") List<Long> ids) {
|
||||||
return toAjax(flwDefinitionService.removeDef(ids));
|
return toAjax(flwDefinitionService.removeDef(ids));
|
||||||
@@ -136,6 +146,7 @@ public class FlwDefinitionController extends BaseController {
|
|||||||
* @param id 流程定义id
|
* @param id 流程定义id
|
||||||
*/
|
*/
|
||||||
@Log(title = "流程定义", businessType = BusinessType.INSERT)
|
@Log(title = "流程定义", businessType = BusinessType.INSERT)
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
||||||
@PostMapping("/copy/{id}")
|
@PostMapping("/copy/{id}")
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -150,6 +161,7 @@ public class FlwDefinitionController extends BaseController {
|
|||||||
* @param category 分类
|
* @param category 分类
|
||||||
*/
|
*/
|
||||||
@Log(title = "流程定义", businessType = BusinessType.IMPORT)
|
@Log(title = "流程定义", businessType = BusinessType.IMPORT)
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
||||||
@PostMapping("/importDef")
|
@PostMapping("/importDef")
|
||||||
public R<Boolean> importDef(MultipartFile file, String category) {
|
public R<Boolean> importDef(MultipartFile file, String category) {
|
||||||
return R.ok(flwDefinitionService.importJson(file, category));
|
return R.ok(flwDefinitionService.importJson(file, category));
|
||||||
@@ -163,6 +175,7 @@ public class FlwDefinitionController extends BaseController {
|
|||||||
* @throws IOException 异常
|
* @throws IOException 异常
|
||||||
*/
|
*/
|
||||||
@Log(title = "流程定义", businessType = BusinessType.EXPORT)
|
@Log(title = "流程定义", businessType = BusinessType.EXPORT)
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
||||||
@PostMapping("/exportDef/{id}")
|
@PostMapping("/exportDef/{id}")
|
||||||
public void exportDef(@PathVariable("id") Long id, HttpServletResponse response) throws IOException {
|
public void exportDef(@PathVariable("id") Long id, HttpServletResponse response) throws IOException {
|
||||||
flwDefinitionService.exportDef(id, response);
|
flwDefinitionService.exportDef(id, response);
|
||||||
@@ -173,6 +186,7 @@ public class FlwDefinitionController extends BaseController {
|
|||||||
*
|
*
|
||||||
* @param id 流程定义id
|
* @param id 流程定义id
|
||||||
*/
|
*/
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.DEFINITION_LIST)
|
||||||
@GetMapping("/xmlString/{id}")
|
@GetMapping("/xmlString/{id}")
|
||||||
public R<String> xmlString(@PathVariable("id") Long id) {
|
public R<String> xmlString(@PathVariable("id") Long id) {
|
||||||
return R.ok("操作成功", defService.exportJson(id));
|
return R.ok("操作成功", defService.exportJson(id));
|
||||||
@@ -185,6 +199,7 @@ public class FlwDefinitionController extends BaseController {
|
|||||||
* @param active 激活/挂起
|
* @param active 激活/挂起
|
||||||
*/
|
*/
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.DEFINITION_EDIT)
|
||||||
@PutMapping("/active/{id}")
|
@PutMapping("/active/{id}")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public R<Boolean> active(@PathVariable("id") Long id, @RequestParam("active") boolean active) {
|
public R<Boolean> active(@PathVariable("id") Long id, @RequestParam("active") boolean active) {
|
||||||
|
|||||||
+8
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.workflow.controller;
|
package org.dromara.workflow.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
@@ -10,6 +11,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
import org.dromara.warm.flow.core.service.InsService;
|
import org.dromara.warm.flow.core.service.InsService;
|
||||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||||
|
import org.dromara.workflow.common.constant.FlowPermissionConstant;
|
||||||
import org.dromara.workflow.domain.bo.FlowCancelBo;
|
import org.dromara.workflow.domain.bo.FlowCancelBo;
|
||||||
import org.dromara.workflow.domain.bo.FlowInstanceBo;
|
import org.dromara.workflow.domain.bo.FlowInstanceBo;
|
||||||
import org.dromara.workflow.domain.bo.FlowInvalidBo;
|
import org.dromara.workflow.domain.bo.FlowInvalidBo;
|
||||||
@@ -43,6 +45,7 @@ public class FlwInstanceController extends BaseController {
|
|||||||
* @param flowInstanceBo 流程实例
|
* @param flowInstanceBo 流程实例
|
||||||
* @param pageQuery 分页
|
* @param pageQuery 分页
|
||||||
*/
|
*/
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.INSTANCE_MANAGE)
|
||||||
@GetMapping("/pageByRunning")
|
@GetMapping("/pageByRunning")
|
||||||
public TableDataInfo<FlowInstanceVo> selectRunningInstanceList(FlowInstanceBo flowInstanceBo, PageQuery pageQuery) {
|
public TableDataInfo<FlowInstanceVo> selectRunningInstanceList(FlowInstanceBo flowInstanceBo, PageQuery pageQuery) {
|
||||||
return flwInstanceService.selectRunningInstanceList(flowInstanceBo, pageQuery);
|
return flwInstanceService.selectRunningInstanceList(flowInstanceBo, pageQuery);
|
||||||
@@ -54,6 +57,7 @@ public class FlwInstanceController extends BaseController {
|
|||||||
* @param flowInstanceBo 流程实例
|
* @param flowInstanceBo 流程实例
|
||||||
* @param pageQuery 分页
|
* @param pageQuery 分页
|
||||||
*/
|
*/
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.INSTANCE_MANAGE)
|
||||||
@GetMapping("/pageByFinish")
|
@GetMapping("/pageByFinish")
|
||||||
public TableDataInfo<FlowInstanceVo> selectFinishInstanceList(FlowInstanceBo flowInstanceBo, PageQuery pageQuery) {
|
public TableDataInfo<FlowInstanceVo> selectFinishInstanceList(FlowInstanceBo flowInstanceBo, PageQuery pageQuery) {
|
||||||
return flwInstanceService.selectFinishInstanceList(flowInstanceBo, pageQuery);
|
return flwInstanceService.selectFinishInstanceList(flowInstanceBo, pageQuery);
|
||||||
@@ -74,6 +78,7 @@ public class FlwInstanceController extends BaseController {
|
|||||||
*
|
*
|
||||||
* @param businessIds 业务id
|
* @param businessIds 业务id
|
||||||
*/
|
*/
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.INSTANCE_MANAGE)
|
||||||
@DeleteMapping("/deleteByBusinessIds/{businessIds}")
|
@DeleteMapping("/deleteByBusinessIds/{businessIds}")
|
||||||
public R<Void> deleteByBusinessIds(@PathVariable("businessIds") List<Long> businessIds) {
|
public R<Void> deleteByBusinessIds(@PathVariable("businessIds") List<Long> businessIds) {
|
||||||
return toAjax(flwInstanceService.deleteByBusinessIds(businessIds));
|
return toAjax(flwInstanceService.deleteByBusinessIds(businessIds));
|
||||||
@@ -107,6 +112,7 @@ public class FlwInstanceController extends BaseController {
|
|||||||
* @param active 激活/挂起
|
* @param active 激活/挂起
|
||||||
*/
|
*/
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.INSTANCE_MANAGE)
|
||||||
@PutMapping("/active/{id}")
|
@PutMapping("/active/{id}")
|
||||||
public R<Boolean> active(@PathVariable("id") Long id, @RequestParam("active") boolean active) {
|
public R<Boolean> active(@PathVariable("id") Long id, @RequestParam("active") boolean active) {
|
||||||
return R.ok(active ? insService.active(id) : insService.unActive(id));
|
return R.ok(active ? insService.active(id) : insService.unActive(id));
|
||||||
@@ -146,6 +152,7 @@ public class FlwInstanceController extends BaseController {
|
|||||||
*
|
*
|
||||||
* @param instanceId 流程实例id
|
* @param instanceId 流程实例id
|
||||||
*/
|
*/
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.INSTANCE_MANAGE)
|
||||||
@GetMapping("/instanceVariable/{instanceId}")
|
@GetMapping("/instanceVariable/{instanceId}")
|
||||||
public R<Map<String, Object>> instanceVariable(@PathVariable("instanceId") Long instanceId) {
|
public R<Map<String, Object>> instanceVariable(@PathVariable("instanceId") Long instanceId) {
|
||||||
return R.ok(flwInstanceService.instanceVariable(instanceId));
|
return R.ok(flwInstanceService.instanceVariable(instanceId));
|
||||||
@@ -158,6 +165,7 @@ public class FlwInstanceController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@Log(title = "流程实例管理", businessType = BusinessType.INSERT)
|
@Log(title = "流程实例管理", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.INSTANCE_MANAGE)
|
||||||
@PostMapping("/invalid")
|
@PostMapping("/invalid")
|
||||||
public R<Boolean> invalid(@Validated @RequestBody FlowInvalidBo bo) {
|
public R<Boolean> invalid(@Validated @RequestBody FlowInvalidBo bo) {
|
||||||
return R.ok(flwInstanceService.processInvalid(bo));
|
return R.ok(flwInstanceService.processInvalid(bo));
|
||||||
|
|||||||
+5
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.workflow.controller;
|
package org.dromara.workflow.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.domain.dto.StartProcessReturnDTO;
|
import org.dromara.common.core.domain.dto.StartProcessReturnDTO;
|
||||||
@@ -14,6 +15,7 @@ import org.dromara.common.web.core.BaseController;
|
|||||||
import org.dromara.warm.flow.core.entity.Node;
|
import org.dromara.warm.flow.core.entity.Node;
|
||||||
import org.dromara.warm.flow.orm.entity.FlowNode;
|
import org.dromara.warm.flow.orm.entity.FlowNode;
|
||||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||||
|
import org.dromara.workflow.common.constant.FlowPermissionConstant;
|
||||||
import org.dromara.workflow.domain.bo.*;
|
import org.dromara.workflow.domain.bo.*;
|
||||||
import org.dromara.workflow.domain.vo.FlowHisTaskVo;
|
import org.dromara.workflow.domain.vo.FlowHisTaskVo;
|
||||||
import org.dromara.workflow.domain.vo.FlowTaskVo;
|
import org.dromara.workflow.domain.vo.FlowTaskVo;
|
||||||
@@ -91,6 +93,7 @@ public class FlwTaskController extends BaseController {
|
|||||||
* @param flowTaskBo 参数
|
* @param flowTaskBo 参数
|
||||||
* @param pageQuery 分页
|
* @param pageQuery 分页
|
||||||
*/
|
*/
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.TASK_MANAGE)
|
||||||
@GetMapping("/pageByAllTaskWait")
|
@GetMapping("/pageByAllTaskWait")
|
||||||
public TableDataInfo<FlowTaskVo> pageByAllTaskWait(FlowTaskBo flowTaskBo, PageQuery pageQuery) {
|
public TableDataInfo<FlowTaskVo> pageByAllTaskWait(FlowTaskBo flowTaskBo, PageQuery pageQuery) {
|
||||||
return flwTaskService.pageByAllTaskWait(flowTaskBo, pageQuery);
|
return flwTaskService.pageByAllTaskWait(flowTaskBo, pageQuery);
|
||||||
@@ -102,6 +105,7 @@ public class FlwTaskController extends BaseController {
|
|||||||
* @param flowTaskBo 参数
|
* @param flowTaskBo 参数
|
||||||
* @param pageQuery 分页
|
* @param pageQuery 分页
|
||||||
*/
|
*/
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.TASK_MANAGE)
|
||||||
@GetMapping("/pageByAllTaskFinish")
|
@GetMapping("/pageByAllTaskFinish")
|
||||||
public TableDataInfo<FlowHisTaskVo> pageByAllTaskFinish(FlowTaskBo flowTaskBo, PageQuery pageQuery) {
|
public TableDataInfo<FlowHisTaskVo> pageByAllTaskFinish(FlowTaskBo flowTaskBo, PageQuery pageQuery) {
|
||||||
return flwTaskService.pageByAllTaskFinish(flowTaskBo, pageQuery);
|
return flwTaskService.pageByAllTaskFinish(flowTaskBo, pageQuery);
|
||||||
@@ -171,6 +175,7 @@ public class FlwTaskController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@Log(title = "任务管理", businessType = BusinessType.UPDATE)
|
@Log(title = "任务管理", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
|
@SaCheckPermission(FlowPermissionConstant.TASK_MANAGE)
|
||||||
@PutMapping("/updateAssignee/{userId}")
|
@PutMapping("/updateAssignee/{userId}")
|
||||||
public R<Void> updateAssignee(@RequestBody List<Long> taskIdList, @PathVariable("userId") String userId) {
|
public R<Void> updateAssignee(@RequestBody List<Long> taskIdList, @PathVariable("userId") String userId) {
|
||||||
return toAjax(flwTaskService.updateAssignee(taskIdList, userId));
|
return toAjax(flwTaskService.updateAssignee(taskIdList, userId));
|
||||||
|
|||||||
+5
@@ -174,6 +174,11 @@ public class FlowTaskVo implements Serializable {
|
|||||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "createBy")
|
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "createBy")
|
||||||
private String createByName;
|
private String createByName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 班级名称。仅请假、销假等待办由业务模块回填,其他流程保持 null。
|
||||||
|
*/
|
||||||
|
private String className;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为申请人节点
|
* 是否为申请人节点
|
||||||
*/
|
*/
|
||||||
|
|||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package org.dromara.workflow.service;
|
||||||
|
|
||||||
|
import org.dromara.workflow.domain.vo.FlowTaskVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运行中待办的业务字段回填。工作流模块只定义扩展点,具体业务在各自模块实现。
|
||||||
|
*/
|
||||||
|
public interface FlowTaskEnricher {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 为一页待办补业务展示字段。未识别的任务保持原值。
|
||||||
|
*
|
||||||
|
* @param tasks 当前页待办
|
||||||
|
*/
|
||||||
|
void enrich(List<FlowTaskVo> tasks);
|
||||||
|
|
||||||
|
}
|
||||||
+16
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.workflow.service.impl;
|
package org.dromara.workflow.service.impl;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
@@ -34,6 +35,7 @@ import org.dromara.warm.flow.orm.entity.FlowTask;
|
|||||||
import org.dromara.warm.flow.orm.mapper.FlowHisTaskMapper;
|
import org.dromara.warm.flow.orm.mapper.FlowHisTaskMapper;
|
||||||
import org.dromara.warm.flow.orm.mapper.FlowInstanceMapper;
|
import org.dromara.warm.flow.orm.mapper.FlowInstanceMapper;
|
||||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||||
|
import org.dromara.workflow.common.constant.FlowPermissionConstant;
|
||||||
import org.dromara.workflow.common.enums.TaskStatusEnum;
|
import org.dromara.workflow.common.enums.TaskStatusEnum;
|
||||||
import org.dromara.workflow.domain.bo.FlowCancelBo;
|
import org.dromara.workflow.domain.bo.FlowCancelBo;
|
||||||
import org.dromara.workflow.domain.bo.FlowInstanceBo;
|
import org.dromara.workflow.domain.bo.FlowInstanceBo;
|
||||||
@@ -214,6 +216,7 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
|
|||||||
log.warn("未找到对应的流程实例信息,无法执行删除操作。");
|
log.warn("未找到对应的流程实例信息,无法执行删除操作。");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
instances.forEach(this::checkInstanceOwner);
|
||||||
// 获取定义信息
|
// 获取定义信息
|
||||||
Map<Long, Definition> definitionMap = defService.getByIds(
|
Map<Long, Definition> definitionMap = defService.getByIds(
|
||||||
StreamUtils.toList(instances, Instance::getDefinitionId)).stream()
|
StreamUtils.toList(instances, Instance::getDefinitionId)).stream()
|
||||||
@@ -246,6 +249,7 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
|
|||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
throw new ServiceException(ExceptionCons.NOT_FOUNT_INSTANCE);
|
throw new ServiceException(ExceptionCons.NOT_FOUNT_INSTANCE);
|
||||||
}
|
}
|
||||||
|
checkInstanceOwner(instance);
|
||||||
Definition definition = defService.getById(instance.getDefinitionId());
|
Definition definition = defService.getById(instance.getDefinitionId());
|
||||||
if (definition == null) {
|
if (definition == null) {
|
||||||
throw new ServiceException(ExceptionCons.NOT_FOUNT_DEF);
|
throw new ServiceException(ExceptionCons.NOT_FOUNT_DEF);
|
||||||
@@ -267,6 +271,18 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅流程发起人或具备流程实例管理权限的用户可操作该实例
|
||||||
|
*/
|
||||||
|
private void checkInstanceOwner(Instance instance) {
|
||||||
|
if (LoginHelper.isSuperAdmin() || StpUtil.hasPermission(FlowPermissionConstant.INSTANCE_MANAGE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!StringUtils.equals(instance.getCreateBy(), LoginHelper.getUserIdStr())) {
|
||||||
|
throw new ServiceException("无权操作他人发起的流程");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前登陆人发起的流程实例
|
* 获取当前登陆人发起的流程实例
|
||||||
*
|
*
|
||||||
|
|||||||
+14
-1
@@ -47,6 +47,7 @@ import org.dromara.workflow.domain.vo.FlowHisTaskVo;
|
|||||||
import org.dromara.workflow.domain.vo.FlowTaskVo;
|
import org.dromara.workflow.domain.vo.FlowTaskVo;
|
||||||
import org.dromara.workflow.mapper.FlwCategoryMapper;
|
import org.dromara.workflow.mapper.FlwCategoryMapper;
|
||||||
import org.dromara.workflow.mapper.FlwTaskMapper;
|
import org.dromara.workflow.mapper.FlwTaskMapper;
|
||||||
|
import org.dromara.workflow.service.FlowTaskEnricher;
|
||||||
import org.dromara.workflow.service.IFlwCommonService;
|
import org.dromara.workflow.service.IFlwCommonService;
|
||||||
import org.dromara.workflow.service.IFlwNodeExtService;
|
import org.dromara.workflow.service.IFlwNodeExtService;
|
||||||
import org.dromara.workflow.service.IFlwTaskAssigneeService;
|
import org.dromara.workflow.service.IFlwTaskAssigneeService;
|
||||||
@@ -88,6 +89,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
|||||||
private final IFlwCommonService flwCommonService;
|
private final IFlwCommonService flwCommonService;
|
||||||
private final IFlwNodeExtService flwNodeExtService;
|
private final IFlwNodeExtService flwNodeExtService;
|
||||||
private final FlwHisTaskExtMapper flwHisTaskExtMapper;
|
private final FlwHisTaskExtMapper flwHisTaskExtMapper;
|
||||||
|
private final List<FlowTaskEnricher> flowTaskEnrichers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动任务
|
* 启动任务
|
||||||
@@ -345,6 +347,9 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
|||||||
t.setAssigneeNames(StreamUtils.join(userList, UserDTO::getNickName));
|
t.setAssigneeNames(StreamUtils.join(userList, UserDTO::getNickName));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (CollUtil.isNotEmpty(flowTaskEnrichers)) {
|
||||||
|
flowTaskEnrichers.forEach(enricher -> enricher.enrich(records));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
@@ -381,7 +386,15 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
|||||||
private QueryWrapper<FlowTaskBo> buildQueryWrapper(FlowTaskBo flowTaskBo) {
|
private QueryWrapper<FlowTaskBo> buildQueryWrapper(FlowTaskBo flowTaskBo) {
|
||||||
QueryWrapper<FlowTaskBo> wrapper = Wrappers.query();
|
QueryWrapper<FlowTaskBo> wrapper = Wrappers.query();
|
||||||
wrapper.like(StringUtils.isNotBlank(flowTaskBo.getNodeName()), "t.node_name", flowTaskBo.getNodeName());
|
wrapper.like(StringUtils.isNotBlank(flowTaskBo.getNodeName()), "t.node_name", flowTaskBo.getNodeName());
|
||||||
wrapper.like(StringUtils.isNotBlank(flowTaskBo.getFlowName()), "t.flow_name", flowTaskBo.getFlowName());
|
if (StringUtils.isNotBlank(flowTaskBo.getFlowName())) {
|
||||||
|
String keyword = flowTaskBo.getFlowName().trim();
|
||||||
|
String likeKeyword = "%" + keyword + "%";
|
||||||
|
wrapper.and(w -> w.like("t.flow_name", keyword)
|
||||||
|
.or()
|
||||||
|
.apply("exists (select 1 from xg_student_leave l where cast(l.id as char) = t.business_id and ifnull(l.deleted, 0) = 0 and (l.student_name like {0} or l.student_no like {0}))", likeKeyword)
|
||||||
|
.or()
|
||||||
|
.apply("exists (select 1 from xg_student_cancel_leave c where cast(c.id as char) = t.business_id and ifnull(c.deleted, 0) = 0 and (c.student_name like {0} or c.student_no like {0}))", likeKeyword));
|
||||||
|
}
|
||||||
wrapper.like(StringUtils.isNotBlank(flowTaskBo.getFlowCode()), "t.flow_code", flowTaskBo.getFlowCode());
|
wrapper.like(StringUtils.isNotBlank(flowTaskBo.getFlowCode()), "t.flow_code", flowTaskBo.getFlowCode());
|
||||||
wrapper.in(CollUtil.isNotEmpty(flowTaskBo.getCreateByIds()), "t.create_by", flowTaskBo.getCreateByIds());
|
wrapper.in(CollUtil.isNotEmpty(flowTaskBo.getCreateByIds()), "t.create_by", flowTaskBo.getCreateByIds());
|
||||||
if (StringUtils.isNotBlank(flowTaskBo.getCategory())) {
|
if (StringUtils.isNotBlank(flowTaskBo.getCategory())) {
|
||||||
|
|||||||
+3
-3
@@ -59,9 +59,9 @@ public class XgConductScoreController extends BaseController {
|
|||||||
@SaCheckPermission("xg:conductScore:classStudents")
|
@SaCheckPermission("xg:conductScore:classStudents")
|
||||||
@GetMapping("/class-students")
|
@GetMapping("/class-students")
|
||||||
public R<XgConductScoreClassSummaryVo> classStudents(
|
public R<XgConductScoreClassSummaryVo> classStudents(
|
||||||
@NotNull(message = "学年不能为空") Integer academicYear,
|
@RequestParam("academicYear") @NotNull(message = "学年不能为空") Integer academicYear,
|
||||||
@NotNull(message = "学期不能为空") Integer semester,
|
@RequestParam("semester") @NotNull(message = "学期不能为空") Integer semester,
|
||||||
@NotNull(message = "月份不能为空") Integer month,
|
@RequestParam("month") @NotNull(message = "月份不能为空") Integer month,
|
||||||
@RequestParam(value = "studentStatus", required = false) List<String> studentStatus,
|
@RequestParam(value = "studentStatus", required = false) List<String> studentStatus,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) {
|
||||||
// 兼容前端参数序列化 studentStatus[0]=1&studentStatus[1]=3 的情况
|
// 兼容前端参数序列化 studentStatus[0]=1&studentStatus[1]=3 的情况
|
||||||
|
|||||||
+7
-5
@@ -41,19 +41,21 @@ public class XgDormRollCallController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 当天点名人数汇总(总人数/已点名人数 + 请假/留宿/异常明细)
|
* 当天点名人数汇总(总人数/已点名人数 + 请假/留宿/异常明细)
|
||||||
*
|
*
|
||||||
* @param buildingId 可选;空=全校,有值=指定楼栋
|
* @param buildingId 可选,指定楼栋
|
||||||
|
* @param campusId 可选,指定校区。校区和楼栋都为空时不汇总,避免两个校区混在一起
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("dormRollCall:dormRollCall:list1")
|
@SaCheckPermission("dormRollCall:dormRollCall:list1")
|
||||||
@GetMapping("/todaySummary")
|
@GetMapping("/todaySummary")
|
||||||
public R<DormRollCallTodaySummaryVo> todaySummary(
|
public R<DormRollCallTodaySummaryVo> todaySummary(
|
||||||
@RequestParam(value = "buildingId", required = false) Long buildingId) {
|
@RequestParam(value = "buildingId", required = false) Long buildingId,
|
||||||
return R.ok(xgDormRollCallService.queryTodaySummary(buildingId));
|
@RequestParam(value = "campusId", required = false) Long campusId) {
|
||||||
|
return R.ok(xgDormRollCallService.queryTodaySummary(buildingId, campusId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SaCheckPermission("dormRollCall:dormRollCall:add")
|
@SaCheckPermission("dormRollCall:dormRollCall:add")
|
||||||
@GetMapping("/generateBatchNo")
|
@GetMapping("/generateBatchNo")
|
||||||
public R<String> generateBatchNo() {
|
public R<String> generateBatchNo(@RequestParam(value = "campusId", required = false) Long campusId) {
|
||||||
return R.ok(xgDormRollCallService.generateBatchNo());
|
return R.ok(xgDormRollCallService.generateBatchNo(campusId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SaCheckPermission("dormRollCall:dormRollCall:list1")
|
@SaCheckPermission("dormRollCall:dormRollCall:list1")
|
||||||
|
|||||||
+7
-6
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.xg.controller;
|
package org.dromara.xg.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -126,7 +127,7 @@ public class XgStuColBatchClassController extends BaseController {
|
|||||||
List<Long> classIds = xgStuColBatchClassMapper.selectClassIdsByBatchId(batchId);
|
List<Long> classIds = xgStuColBatchClassMapper.selectClassIdsByBatchId(batchId);
|
||||||
return R.ok(classIds);
|
return R.ok(classIds);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("获取收集范围失败:" + e.getMessage());
|
return R.fail("获取收集范围失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +143,7 @@ public class XgStuColBatchClassController extends BaseController {
|
|||||||
List<XgStuColBatchClassVo> scopeDetail = xgStuColBatchClassMapper.selectScopeDetailByBatchId(batchId);
|
List<XgStuColBatchClassVo> scopeDetail = xgStuColBatchClassMapper.selectScopeDetailByBatchId(batchId);
|
||||||
return R.ok(scopeDetail);
|
return R.ok(scopeDetail);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("获取权限范围详情失败:" + e.getMessage());
|
return R.fail("获取权限范围详情失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +202,7 @@ public class XgStuColBatchClassController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("权限设置异常:" + e.getMessage());
|
return R.fail("权限设置异常:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +226,7 @@ public class XgStuColBatchClassController extends BaseController {
|
|||||||
batchName);
|
batchName);
|
||||||
return R.ok(batchList);
|
return R.ok(batchList);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("查询学生可参与批次信息失败:" + e.getMessage());
|
return R.fail("查询学生可参与批次信息失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +257,7 @@ public class XgStuColBatchClassController extends BaseController {
|
|||||||
|
|
||||||
return R.ok(batchList);
|
return R.ok(batchList);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("查询老师关联批次信息失败:" + e.getMessage());
|
return R.fail("查询老师关联批次信息失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,7 +288,7 @@ public class XgStuColBatchClassController extends BaseController {
|
|||||||
|
|
||||||
return R.ok(filteredTree);
|
return R.ok(filteredTree);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("获取批次组织权限范围失败:" + e.getMessage());
|
return R.fail("获取批次组织权限范围失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+41
-2
@@ -1,5 +1,7 @@
|
|||||||
package org.dromara.xg.controller;
|
package org.dromara.xg.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -8,6 +10,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.dev33.satoken.annotation.SaMode;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
@@ -110,7 +113,14 @@ public class XgStudentLeaveController extends BaseController {
|
|||||||
* @param studentIds 学生ID列表(逗号分隔)
|
* @param studentIds 学生ID列表(逗号分隔)
|
||||||
* @param checkDate 检查日期
|
* @param checkDate 检查日期
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("studentLeave:studentLeave:query")
|
@SaCheckPermission(value = {
|
||||||
|
"studentLeave:studentLeave:query",
|
||||||
|
"dormHygieneCheck:dormHygieneCheck:list",
|
||||||
|
"dormHygieneCheck:dormHygieneCheck:query",
|
||||||
|
"dormHygieneCheck:dormHygieneCheck:add",
|
||||||
|
"dormRollCall:dormRollCall:list1",
|
||||||
|
"dormRollCall:dormRollCall:query"
|
||||||
|
}, mode = SaMode.OR)
|
||||||
@GetMapping("/queryByCheckDate")
|
@GetMapping("/queryByCheckDate")
|
||||||
public R<Map<Long, XgStudentLeaveVo>> queryByCheckDate(
|
public R<Map<Long, XgStudentLeaveVo>> queryByCheckDate(
|
||||||
@RequestParam("studentIds") String studentIds,
|
@RequestParam("studentIds") String studentIds,
|
||||||
@@ -126,7 +136,36 @@ public class XgStudentLeaveController extends BaseController {
|
|||||||
checkDateTime);
|
checkDateTime);
|
||||||
return R.ok(result);
|
return R.ok(result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("参数格式错误:" + e.getMessage());
|
return R.fail("参数格式错误:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询某一天内的有效请假(含白天临时请假、晚上晚归),供检查和点名只读查看。
|
||||||
|
*/
|
||||||
|
@SaCheckPermission(value = {
|
||||||
|
"studentLeave:studentLeave:query",
|
||||||
|
"dormHygieneCheck:dormHygieneCheck:list",
|
||||||
|
"dormHygieneCheck:dormHygieneCheck:query",
|
||||||
|
"dormHygieneCheck:dormHygieneCheck:add",
|
||||||
|
"dormRollCall:dormRollCall:list1",
|
||||||
|
"dormRollCall:dormRollCall:query"
|
||||||
|
}, mode = SaMode.OR)
|
||||||
|
@GetMapping("/queryByCheckDay")
|
||||||
|
public R<Map<Long, List<XgStudentLeaveVo>>> queryByCheckDay(
|
||||||
|
@RequestParam("studentIds") String studentIds,
|
||||||
|
@RequestParam("checkDate") String checkDate) {
|
||||||
|
try {
|
||||||
|
List<Long> studentIdList = List.of(studentIds.split(","))
|
||||||
|
.stream()
|
||||||
|
.map(String::trim)
|
||||||
|
.filter(text -> !text.isEmpty())
|
||||||
|
.map(Long::valueOf)
|
||||||
|
.toList();
|
||||||
|
LocalDate day = LocalDateTime.parse(checkDate.replace(" ", "T")).toLocalDate();
|
||||||
|
return R.ok(xgStudentLeaveService.queryStudentLeavesOverlappingDay(studentIdList, day));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return R.fail("参数格式错误:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+24
@@ -44,6 +44,7 @@ import org.dromara.common.core.utils.SpringUtils;
|
|||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.xg.domain.vo.XgStudentMsgVo;
|
import org.dromara.xg.domain.vo.XgStudentMsgVo;
|
||||||
|
import org.dromara.xg.domain.vo.StudentPwdResetVo;
|
||||||
import org.dromara.xg.domain.bo.XgStudentMsgBo;
|
import org.dromara.xg.domain.bo.XgStudentMsgBo;
|
||||||
import org.dromara.xg.domain.bo.XgStudentMsgAdvancedSearchBo;
|
import org.dromara.xg.domain.bo.XgStudentMsgAdvancedSearchBo;
|
||||||
import org.dromara.xg.service.IXgStudentMsgService;
|
import org.dromara.xg.service.IXgStudentMsgService;
|
||||||
@@ -660,6 +661,29 @@ public class XgStudentMsgController extends BaseController {
|
|||||||
return R.ok(studentInfo);
|
return R.ok(studentInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按学号查询学生基本信息(重置密码页)
|
||||||
|
* 须声明在 /{id} 之前,避免被路径变量吞掉
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("studentMsg:studentPwdReset:query")
|
||||||
|
@GetMapping("/queryByStudentNo/{studentNo}")
|
||||||
|
public R<StudentPwdResetVo> queryByStudentNo(
|
||||||
|
@NotBlank(message = "学号不能为空") @PathVariable("studentNo") String studentNo) {
|
||||||
|
return R.ok(xgStudentMsgService.queryForPwdResetByStudentNo(studentNo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按学号重置学生登录密码为随机临时密码,返回临时密码
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("studentMsg:studentPwdReset:reset")
|
||||||
|
@Log(title = "重置学生密码", businessType = BusinessType.UPDATE, isSaveResponseData = false)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping("/resetStudentPassword/{studentNo}")
|
||||||
|
public R<String> resetStudentPassword(
|
||||||
|
@NotBlank(message = "学号不能为空") @PathVariable("studentNo") String studentNo) {
|
||||||
|
return R.ok("操作成功", xgStudentMsgService.resetStudentPasswordByStudentNo(studentNo));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取学生信息详细信息
|
* 获取学生信息详细信息
|
||||||
*
|
*
|
||||||
|
|||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
package org.dromara.xg.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置学生密码:按学号查询展示信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StudentPwdResetVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 学生ID(与 sys_user.user_id 相同) */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 学号 */
|
||||||
|
private String studentNo;
|
||||||
|
|
||||||
|
/** 姓名 */
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 班级名称 */
|
||||||
|
private String className;
|
||||||
|
|
||||||
|
/** 班主任姓名 */
|
||||||
|
private String classTeacherName;
|
||||||
|
}
|
||||||
+7
-2
@@ -26,6 +26,11 @@ public interface IXgDormRollCallService {
|
|||||||
|
|
||||||
String generateBatchNo();
|
String generateBatchNo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每个校区每个自然日一个批次,该校区所有寝室老师共用。
|
||||||
|
*/
|
||||||
|
String generateBatchNo(Long campusId);
|
||||||
|
|
||||||
List<RoomRollCallStatusVo> getBuildingRoomsStatus(Long buildingId, String batchNo);
|
List<RoomRollCallStatusVo> getBuildingRoomsStatus(Long buildingId, String batchNo);
|
||||||
|
|
||||||
XgDormRollCallVo submitRollCall(XgDormRollCallBo bo);
|
XgDormRollCallVo submitRollCall(XgDormRollCallBo bo);
|
||||||
@@ -36,7 +41,7 @@ public interface IXgDormRollCallService {
|
|||||||
* 当天点名人数汇总(总人数 / 已点名人数 + 请假/留宿/异常明细)。
|
* 当天点名人数汇总(总人数 / 已点名人数 + 请假/留宿/异常明细)。
|
||||||
* <p>
|
* <p>
|
||||||
* 总人数 = 有床位且在住学生数;已点名人数 = 本日点名明细有记录的去重学生数。
|
* 总人数 = 有床位且在住学生数;已点名人数 = 本日点名明细有记录的去重学生数。
|
||||||
* buildingId 为空时统计全校;有值时仅统计该楼。
|
* 必须指定校区或楼栋,避免临安、西溪混在一起。
|
||||||
*/
|
*/
|
||||||
DormRollCallTodaySummaryVo queryTodaySummary(Long buildingId);
|
DormRollCallTodaySummaryVo queryTodaySummary(Long buildingId, Long campusId);
|
||||||
}
|
}
|
||||||
+1
-1
@@ -119,7 +119,7 @@ public interface IXgHolidayStayService {
|
|||||||
Boolean revoke(XgHolidayStayAuditBo auditBo);
|
Boolean revoke(XgHolidayStayAuditBo auditBo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按检查时刻查询学生当前有效的假期留宿(已通过,且日期落在留宿起止日内,结束日当天整天有效)
|
* 按检查时刻查询学生当前有效的假期留宿(已通过,且检查时刻落在留宿起止 datetime 内,含边界)
|
||||||
*
|
*
|
||||||
* @param studentIds 学生ID列表
|
* @param studentIds 学生ID列表
|
||||||
* @param checkDate 检查时刻
|
* @param checkDate 检查时刻
|
||||||
|
|||||||
+6
@@ -5,6 +5,7 @@ import org.dromara.xg.domain.bo.XgStudentLeaveBo;
|
|||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -77,4 +78,9 @@ public interface IXgStudentLeaveService {
|
|||||||
* @return 学生ID -> 请假信息的映射
|
* @return 学生ID -> 请假信息的映射
|
||||||
*/
|
*/
|
||||||
Map<Long, XgStudentLeaveVo> queryStudentLeavesByCheckDate(List<Long> studentIds, LocalDateTime checkDate);
|
Map<Long, XgStudentLeaveVo> queryStudentLeavesByCheckDate(List<Long> studentIds, LocalDateTime checkDate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询与某一天有交集、且审批已结束的请假。用于教官查看白天临时请假和晚上晚归。
|
||||||
|
*/
|
||||||
|
Map<Long, List<XgStudentLeaveVo>> queryStudentLeavesOverlappingDay(List<Long> studentIds, LocalDate day);
|
||||||
}
|
}
|
||||||
+17
@@ -3,6 +3,7 @@ package org.dromara.xg.service;
|
|||||||
import org.dromara.xg.domain.vo.XgStudentMsgExportVo;
|
import org.dromara.xg.domain.vo.XgStudentMsgExportVo;
|
||||||
import org.dromara.xg.domain.vo.XgStudentMsgVo;
|
import org.dromara.xg.domain.vo.XgStudentMsgVo;
|
||||||
import org.dromara.xg.domain.vo.XgStudentTreeVo;
|
import org.dromara.xg.domain.vo.XgStudentTreeVo;
|
||||||
|
import org.dromara.xg.domain.vo.StudentPwdResetVo;
|
||||||
import org.dromara.xg.domain.bo.XgStudentMsgBo;
|
import org.dromara.xg.domain.bo.XgStudentMsgBo;
|
||||||
import org.dromara.xg.domain.bo.XgStudentMsgAdvancedSearchBo;
|
import org.dromara.xg.domain.bo.XgStudentMsgAdvancedSearchBo;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
@@ -176,4 +177,20 @@ public interface IXgStudentMsgService {
|
|||||||
* @return 学生信息树
|
* @return 学生信息树
|
||||||
*/
|
*/
|
||||||
List<XgStudentTreeVo> getCurrentUserStudentTree();
|
List<XgStudentTreeVo> getCurrentUserStudentTree();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按学号查询学生基本信息(重置密码页展示)
|
||||||
|
*
|
||||||
|
* @param studentNo 学号
|
||||||
|
* @return 姓名/学号/班级/班主任
|
||||||
|
*/
|
||||||
|
StudentPwdResetVo queryForPwdResetByStudentNo(String studentNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按学号重置学生登录密码为随机临时密码,并踢出该学生已登录会话
|
||||||
|
*
|
||||||
|
* @param studentNo 学号
|
||||||
|
* @return 临时密码
|
||||||
|
*/
|
||||||
|
String resetStudentPasswordByStudentNo(String studentNo);
|
||||||
}
|
}
|
||||||
+17
-2
@@ -2524,9 +2524,11 @@ public class XgDormBedStudentServiceImpl implements IXgDormBedStudentService {
|
|||||||
|
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
Map<Long, XgStudentLeaveVo> leaveMap = Map.of();
|
Map<Long, XgStudentLeaveVo> leaveMap = Map.of();
|
||||||
|
Map<Long, List<XgStudentLeaveVo>> todayLeaveMap = Map.of();
|
||||||
Map<Long, XgHolidayStayVo> holidayStayMap = Map.of();
|
Map<Long, XgHolidayStayVo> holidayStayMap = Map.of();
|
||||||
if (!studentIds.isEmpty()) {
|
if (!studentIds.isEmpty()) {
|
||||||
leaveMap = xgStudentLeaveService.queryStudentLeavesByCheckDate(studentIds, now);
|
leaveMap = xgStudentLeaveService.queryStudentLeavesByCheckDate(studentIds, now);
|
||||||
|
todayLeaveMap = xgStudentLeaveService.queryStudentLeavesOverlappingDay(studentIds, now.toLocalDate());
|
||||||
IXgHolidayStayService holidayStayService = xgHolidayStayServiceProvider.getIfAvailable();
|
IXgHolidayStayService holidayStayService = xgHolidayStayServiceProvider.getIfAvailable();
|
||||||
if (holidayStayService != null) {
|
if (holidayStayService != null) {
|
||||||
holidayStayMap = holidayStayService.queryStudentHolidayStaysByCheckDate(studentIds, now);
|
holidayStayMap = holidayStayService.queryStudentHolidayStaysByCheckDate(studentIds, now);
|
||||||
@@ -2579,9 +2581,22 @@ public class XgDormBedStudentServiceImpl implements IXgDormBedStudentService {
|
|||||||
leaveInfoMap.put("leaveEndTime", leaveInfo.getEndTime());
|
leaveInfoMap.put("leaveEndTime", leaveInfo.getEndTime());
|
||||||
studentInfo.put("leaveInfo", leaveInfoMap);
|
studentInfo.put("leaveInfo", leaveInfoMap);
|
||||||
}
|
}
|
||||||
// 请假优先;无请假时再挂假期留宿
|
List<XgStudentLeaveVo> todayLeaves = todayLeaveMap.get(studentIdValue);
|
||||||
|
if (todayLeaves != null && !todayLeaves.isEmpty()) {
|
||||||
|
List<Map<String, Object>> todayLeaveList = new ArrayList<>();
|
||||||
|
for (XgStudentLeaveVo todayLeave : todayLeaves) {
|
||||||
|
Map<String, Object> item = new LinkedHashMap<>();
|
||||||
|
item.put("leaveId", todayLeave.getId());
|
||||||
|
item.put("leaveTypeName", todayLeave.getLeaveTypeName());
|
||||||
|
item.put("leaveStartTime", todayLeave.getStartTime());
|
||||||
|
item.put("leaveEndTime", todayLeave.getEndTime());
|
||||||
|
todayLeaveList.add(item);
|
||||||
|
}
|
||||||
|
studentInfo.put("todayLeaveList", todayLeaveList);
|
||||||
|
}
|
||||||
|
// 请假与假期留宿可同时生效,一并返回供点名双状态展示
|
||||||
XgHolidayStayVo holidayStay = holidayStayMap.get(studentIdValue);
|
XgHolidayStayVo holidayStay = holidayStayMap.get(studentIdValue);
|
||||||
if (leaveInfo == null && holidayStay != null) {
|
if (holidayStay != null) {
|
||||||
Map<String, Object> holidayStayInfoMap = new LinkedHashMap<>();
|
Map<String, Object> holidayStayInfoMap = new LinkedHashMap<>();
|
||||||
holidayStayInfoMap.put("holidayStayId", holidayStay.getId());
|
holidayStayInfoMap.put("holidayStayId", holidayStay.getId());
|
||||||
holidayStayInfoMap.put("holidayType", holidayStay.getHolidayType());
|
holidayStayInfoMap.put("holidayType", holidayStay.getHolidayType());
|
||||||
|
|||||||
+28
-7
@@ -36,6 +36,7 @@ import org.dromara.xg.service.IXgDormRollCallService;
|
|||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -126,6 +127,15 @@ public class XgDormRollCallServiceImpl implements IXgDormRollCallService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String generateBatchNo() {
|
public String generateBatchNo() {
|
||||||
|
return generateBatchNo(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String generateBatchNo(Long campusId) {
|
||||||
|
if (campusId != null) {
|
||||||
|
String day = LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE);
|
||||||
|
return "RC" + day + "C" + campusId;
|
||||||
|
}
|
||||||
String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||||
String random = String.format("%04x", ThreadLocalRandom.current().nextInt(0x10000));
|
String random = String.format("%04x", ThreadLocalRandom.current().nextInt(0x10000));
|
||||||
return "RC" + timestamp + random;
|
return "RC" + timestamp + random;
|
||||||
@@ -276,15 +286,19 @@ public class XgDormRollCallServiceImpl implements IXgDormRollCallService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DormRollCallTodaySummaryVo queryTodaySummary(Long buildingId) {
|
public DormRollCallTodaySummaryVo queryTodaySummary(Long buildingId, Long campusId) {
|
||||||
DormRollCallTodaySummaryVo summary = new DormRollCallTodaySummaryVo();
|
DormRollCallTodaySummaryVo summary = new DormRollCallTodaySummaryVo();
|
||||||
|
if (buildingId == null && campusId == null) {
|
||||||
|
return summary;
|
||||||
|
}
|
||||||
|
|
||||||
// 总人数:有床位且在住(status=0)
|
// 总人数:有床位且在住(status=0),按校区或楼栋分开统计
|
||||||
LambdaQueryWrapper<XgDormBedStudent> totalLqw = Wrappers.<XgDormBedStudent>lambdaQuery()
|
LambdaQueryWrapper<XgDormBedStudent> totalLqw = Wrappers.<XgDormBedStudent>lambdaQuery()
|
||||||
.eq(XgDormBedStudent::getStatus, "0")
|
.eq(XgDormBedStudent::getStatus, "0")
|
||||||
.eq(XgDormBedStudent::getDeleted, "0")
|
.eq(XgDormBedStudent::getDeleted, "0")
|
||||||
.isNotNull(XgDormBedStudent::getStudentId)
|
.isNotNull(XgDormBedStudent::getStudentId)
|
||||||
.isNotNull(XgDormBedStudent::getBedId)
|
.isNotNull(XgDormBedStudent::getBedId)
|
||||||
|
.eq(campusId != null, XgDormBedStudent::getCampusId, campusId)
|
||||||
.eq(buildingId != null, XgDormBedStudent::getBuildingId, buildingId);
|
.eq(buildingId != null, XgDormBedStudent::getBuildingId, buildingId);
|
||||||
Long totalStudents = bedStudentMapper.selectCount(totalLqw);
|
Long totalStudents = bedStudentMapper.selectCount(totalLqw);
|
||||||
summary.setTotalStudentCount(totalStudents == null ? 0 : totalStudents.intValue());
|
summary.setTotalStudentCount(totalStudents == null ? 0 : totalStudents.intValue());
|
||||||
@@ -292,11 +306,11 @@ public class XgDormRollCallServiceImpl implements IXgDormRollCallService {
|
|||||||
Date dayBegin = DateUtil.beginOfDay(new Date());
|
Date dayBegin = DateUtil.beginOfDay(new Date());
|
||||||
Date dayEnd = DateUtil.endOfDay(new Date());
|
Date dayEnd = DateUtil.endOfDay(new Date());
|
||||||
|
|
||||||
// 全校或指定楼栋的当天点名主表
|
|
||||||
LambdaQueryWrapper<XgDormRollCall> rollLqw = Wrappers.<XgDormRollCall>lambdaQuery()
|
LambdaQueryWrapper<XgDormRollCall> rollLqw = Wrappers.<XgDormRollCall>lambdaQuery()
|
||||||
.eq(XgDormRollCall::getStatus, "0")
|
.eq(XgDormRollCall::getStatus, "0")
|
||||||
.ge(XgDormRollCall::getCheckDate, dayBegin)
|
.ge(XgDormRollCall::getCheckDate, dayBegin)
|
||||||
.le(XgDormRollCall::getCheckDate, dayEnd)
|
.le(XgDormRollCall::getCheckDate, dayEnd)
|
||||||
|
.eq(campusId != null, XgDormRollCall::getCampusId, campusId)
|
||||||
.eq(buildingId != null, XgDormRollCall::getBuildingId, buildingId)
|
.eq(buildingId != null, XgDormRollCall::getBuildingId, buildingId)
|
||||||
.orderByDesc(XgDormRollCall::getCheckDate);
|
.orderByDesc(XgDormRollCall::getCheckDate);
|
||||||
List<XgDormRollCall> todayRecords = baseMapper.selectList(rollLqw);
|
List<XgDormRollCall> todayRecords = baseMapper.selectList(rollLqw);
|
||||||
@@ -343,15 +357,21 @@ public class XgDormRollCallServiceImpl implements IXgDormRollCallService {
|
|||||||
|
|
||||||
for (XgDormRollCallDetail detail : allStudentDetails) {
|
for (XgDormRollCallDetail detail : allStudentDetails) {
|
||||||
String status = detail.getRollCallStatus();
|
String status = detail.getRollCallStatus();
|
||||||
if (!"1".equals(status) && !"2".equals(status) && !"4".equals(status)) {
|
boolean isLeave = "1".equals(status) || detail.getLeaveId() != null;
|
||||||
|
boolean isHolidayStay = "4".equals(status) || detail.getHolidayStayId() != null;
|
||||||
|
boolean isAbsent = "2".equals(status);
|
||||||
|
if (!isLeave && !isHolidayStay && !isAbsent) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DormRollCallTodayDetailItemVo item = toTodayDetailItem(detail, rollCallMap.get(detail.getRollCallId()));
|
DormRollCallTodayDetailItemVo item = toTodayDetailItem(detail, rollCallMap.get(detail.getRollCallId()));
|
||||||
if ("1".equals(status)) {
|
// 请假与假期留宿可同时存在,分别计入两类明细
|
||||||
|
if (isLeave) {
|
||||||
leaveDetails.add(item);
|
leaveDetails.add(item);
|
||||||
} else if ("4".equals(status)) {
|
}
|
||||||
|
if (isHolidayStay) {
|
||||||
holidayStayDetails.add(item);
|
holidayStayDetails.add(item);
|
||||||
} else {
|
}
|
||||||
|
if (isAbsent && !isLeave && !isHolidayStay) {
|
||||||
absentDetails.add(item);
|
absentDetails.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -391,6 +411,7 @@ public class XgDormRollCallServiceImpl implements IXgDormRollCallService {
|
|||||||
private LambdaQueryWrapper<XgDormRollCall> buildQueryWrapper(XgDormRollCallBo bo) {
|
private LambdaQueryWrapper<XgDormRollCall> buildQueryWrapper(XgDormRollCallBo bo) {
|
||||||
LambdaQueryWrapper<XgDormRollCall> lqw = Wrappers.<XgDormRollCall>lambdaQuery();
|
LambdaQueryWrapper<XgDormRollCall> lqw = Wrappers.<XgDormRollCall>lambdaQuery();
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getBatchNo()), XgDormRollCall::getBatchNo, bo.getBatchNo());
|
lqw.like(StringUtils.isNotBlank(bo.getBatchNo()), XgDormRollCall::getBatchNo, bo.getBatchNo());
|
||||||
|
lqw.eq(bo.getCampusId() != null, XgDormRollCall::getCampusId, bo.getCampusId());
|
||||||
lqw.eq(bo.getBuildingId() != null, XgDormRollCall::getBuildingId, bo.getBuildingId());
|
lqw.eq(bo.getBuildingId() != null, XgDormRollCall::getBuildingId, bo.getBuildingId());
|
||||||
lqw.eq(bo.getRoomId() != null, XgDormRollCall::getRoomId, bo.getRoomId());
|
lqw.eq(bo.getRoomId() != null, XgDormRollCall::getRoomId, bo.getRoomId());
|
||||||
lqw.eq(bo.getCheckerId() != null, XgDormRollCall::getCheckerId, bo.getCheckerId());
|
lqw.eq(bo.getCheckerId() != null, XgDormRollCall::getCheckerId, bo.getCheckerId());
|
||||||
|
|||||||
+51
-14
@@ -39,10 +39,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,7 +98,7 @@ public class XgHolidayStayServiceImpl implements IXgHolidayStayService {
|
|||||||
private LambdaQueryWrapper<XgHolidayStay> buildQueryWrapper(XgHolidayStayBo bo) {
|
private LambdaQueryWrapper<XgHolidayStay> buildQueryWrapper(XgHolidayStayBo bo) {
|
||||||
Map<String, Object> params = bo.getParams();
|
Map<String, Object> params = bo.getParams();
|
||||||
LambdaQueryWrapper<XgHolidayStay> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<XgHolidayStay> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.orderByAsc(XgHolidayStay::getId);
|
lqw.orderByAsc(XgHolidayStay::getApplyStartDate).orderByAsc(XgHolidayStay::getId);
|
||||||
lqw.eq(bo.getDeleted() != null, XgHolidayStay::getDeleted, bo.getDeleted());
|
lqw.eq(bo.getDeleted() != null, XgHolidayStay::getDeleted, bo.getDeleted());
|
||||||
lqw.eq(bo.getStudentId() != null, XgHolidayStay::getStudentId, bo.getStudentId());
|
lqw.eq(bo.getStudentId() != null, XgHolidayStay::getStudentId, bo.getStudentId());
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getStudentName()), XgHolidayStay::getStudentName, bo.getStudentName());
|
lqw.like(StringUtils.isNotBlank(bo.getStudentName()), XgHolidayStay::getStudentName, bo.getStudentName());
|
||||||
@@ -259,6 +256,51 @@ public class XgHolidayStayServiceImpl implements IXgHolidayStayService {
|
|||||||
if (StringUtils.isBlank(entity.getEmergencyPhone())) {
|
if (StringUtils.isBlank(entity.getEmergencyPhone())) {
|
||||||
throw new ServiceException("紧急联系电话不能为空");
|
throw new ServiceException("紧急联系电话不能为空");
|
||||||
}
|
}
|
||||||
|
normalizeStayWindow(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生只选日期。开始日 08:00,结束日的次日 08:00。
|
||||||
|
* 结束时间已经是 08:00 且晚于开始日时视为已规范化,避免编辑时再加一天。
|
||||||
|
*/
|
||||||
|
private void normalizeStayWindow(XgHolidayStay entity) {
|
||||||
|
if (entity.getApplyStartDate() == null || entity.getApplyEndDate() == null) {
|
||||||
|
throw new ServiceException("请选择留宿开始和结束日期");
|
||||||
|
}
|
||||||
|
Calendar start = Calendar.getInstance();
|
||||||
|
start.setTime(entity.getApplyStartDate());
|
||||||
|
Calendar end = Calendar.getInstance();
|
||||||
|
end.setTime(entity.getApplyEndDate());
|
||||||
|
|
||||||
|
Calendar startDay = (Calendar) start.clone();
|
||||||
|
startDay.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
startDay.set(Calendar.MINUTE, 0);
|
||||||
|
startDay.set(Calendar.SECOND, 0);
|
||||||
|
startDay.set(Calendar.MILLISECOND, 0);
|
||||||
|
|
||||||
|
boolean endAlreadyMorning = end.get(Calendar.HOUR_OF_DAY) == 8
|
||||||
|
&& end.get(Calendar.MINUTE) == 0
|
||||||
|
&& end.get(Calendar.SECOND) == 0
|
||||||
|
&& end.after(startDay);
|
||||||
|
|
||||||
|
start.set(Calendar.HOUR_OF_DAY, 8);
|
||||||
|
start.set(Calendar.MINUTE, 0);
|
||||||
|
start.set(Calendar.SECOND, 0);
|
||||||
|
start.set(Calendar.MILLISECOND, 0);
|
||||||
|
|
||||||
|
if (!endAlreadyMorning) {
|
||||||
|
end.add(Calendar.DAY_OF_MONTH, 1);
|
||||||
|
}
|
||||||
|
end.set(Calendar.HOUR_OF_DAY, 8);
|
||||||
|
end.set(Calendar.MINUTE, 0);
|
||||||
|
end.set(Calendar.SECOND, 0);
|
||||||
|
end.set(Calendar.MILLISECOND, 0);
|
||||||
|
|
||||||
|
if (!end.after(start)) {
|
||||||
|
throw new ServiceException("留宿结束日期不能早于开始日期");
|
||||||
|
}
|
||||||
|
entity.setApplyStartDate(start.getTime());
|
||||||
|
entity.setApplyEndDate(end.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -854,7 +896,6 @@ public class XgHolidayStayServiceImpl implements IXgHolidayStayService {
|
|||||||
if (bo.getClassId() == null) {
|
if (bo.getClassId() == null) {
|
||||||
lqw.in(XgHolidayStay::getClassId, classIds);
|
lqw.in(XgHolidayStay::getClassId, classIds);
|
||||||
}
|
}
|
||||||
lqw.orderByDesc(XgHolidayStay::getApplyTime).orderByDesc(XgHolidayStay::getId);
|
|
||||||
Page<XgHolidayStayVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<XgHolidayStayVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
@@ -1006,7 +1047,8 @@ public class XgHolidayStayServiceImpl implements IXgHolidayStayService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 按检查时刻查询学生当前有效的假期留宿。
|
* 按检查时刻查询学生当前有效的假期留宿。
|
||||||
* 条件:已通过;检查日落在 [applyStartDate, applyEndDate](按日期比较,结束日当天整天有效)。
|
* 条件:已通过;检查时刻落在 [applyStartDate, applyEndDate](按 datetime 比较,与请假判定一致)。
|
||||||
|
* 例:结束为 10-25 08:00,则 25 日 21 点点名不再显示假期留宿。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<Long, XgHolidayStayVo> queryStudentHolidayStaysByCheckDate(List<Long> studentIds, LocalDateTime checkDate) {
|
public Map<Long, XgHolidayStayVo> queryStudentHolidayStaysByCheckDate(List<Long> studentIds, LocalDateTime checkDate) {
|
||||||
@@ -1014,18 +1056,13 @@ public class XgHolidayStayServiceImpl implements IXgHolidayStayService {
|
|||||||
return Map.of();
|
return Map.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
ZoneId zone = ZoneId.systemDefault();
|
|
||||||
LocalDate checkDay = checkDate.toLocalDate();
|
|
||||||
Date dayStart = Date.from(checkDay.atStartOfDay(zone).toInstant());
|
|
||||||
Date dayEnd = Date.from(LocalDateTime.of(checkDay, LocalTime.MAX).atZone(zone).toInstant());
|
|
||||||
|
|
||||||
LambdaQueryWrapper<XgHolidayStay> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<XgHolidayStay> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.in(XgHolidayStay::getStudentId, studentIds);
|
lqw.in(XgHolidayStay::getStudentId, studentIds);
|
||||||
// 仅已通过
|
// 仅已通过
|
||||||
lqw.eq(XgHolidayStay::getApplyStatus, "2");
|
lqw.eq(XgHolidayStay::getApplyStatus, "2");
|
||||||
// 开始日 <= 检查日末,结束日 >= 检查日初(结束日当天整天有效)
|
// 与请假一致:按时刻落在起止区间内(含边界)
|
||||||
lqw.le(XgHolidayStay::getApplyStartDate, dayEnd);
|
lqw.le(XgHolidayStay::getApplyStartDate, checkDate);
|
||||||
lqw.ge(XgHolidayStay::getApplyEndDate, dayStart);
|
lqw.ge(XgHolidayStay::getApplyEndDate, checkDate);
|
||||||
lqw.isNotNull(XgHolidayStay::getApplyStartDate);
|
lqw.isNotNull(XgHolidayStay::getApplyStartDate);
|
||||||
lqw.isNotNull(XgHolidayStay::getApplyEndDate);
|
lqw.isNotNull(XgHolidayStay::getApplyEndDate);
|
||||||
lqw.orderByDesc(XgHolidayStay::getCreateTime);
|
lqw.orderByDesc(XgHolidayStay::getCreateTime);
|
||||||
|
|||||||
+27
@@ -52,12 +52,14 @@ import org.dromara.xg.domain.XgStudentManager;
|
|||||||
import org.dromara.xg.domain.XgStudentManagerSource;
|
import org.dromara.xg.domain.XgStudentManagerSource;
|
||||||
import org.dromara.xg.domain.XgClassMsg;
|
import org.dromara.xg.domain.XgClassMsg;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -712,4 +714,29 @@ public class XgStudentLeaveServiceImpl implements IXgStudentLeaveService {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, List<XgStudentLeaveVo>> queryStudentLeavesOverlappingDay(List<Long> studentIds, LocalDate day) {
|
||||||
|
if (studentIds == null || studentIds.isEmpty() || day == null) {
|
||||||
|
return Map.of();
|
||||||
|
}
|
||||||
|
LocalDateTime dayStart = day.atStartOfDay();
|
||||||
|
LocalDateTime dayEnd = day.atTime(23, 59, 59);
|
||||||
|
LambdaQueryWrapper<XgStudentLeave> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.in(XgStudentLeave::getStudentId, studentIds);
|
||||||
|
lqw.eq(XgStudentLeave::getApprovalStatus, BusinessStatusEnum.FINISH.getStatus());
|
||||||
|
lqw.le(XgStudentLeave::getStartTime, dayEnd);
|
||||||
|
lqw.ge(XgStudentLeave::getEndTime, dayStart);
|
||||||
|
lqw.orderByAsc(XgStudentLeave::getStartTime);
|
||||||
|
List<XgStudentLeave> leaveList = baseMapper.selectList(lqw);
|
||||||
|
Map<Long, List<XgStudentLeaveVo>> grouped = new HashMap<>();
|
||||||
|
for (XgStudentLeave leave : leaveList) {
|
||||||
|
if (leave.getStudentId() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
grouped.computeIfAbsent(leave.getStudentId(), key -> new ArrayList<>())
|
||||||
|
.add(MapstructUtils.convert(leave, XgStudentLeaveVo.class));
|
||||||
|
}
|
||||||
|
return grouped;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+9
-9
@@ -834,16 +834,16 @@ public class XgStudentMsgBatchServiceImpl implements IXgStudentMsgBatchService {
|
|||||||
// 使用前台传递的id
|
// 使用前台传递的id
|
||||||
if (bo.getId() != null) {
|
if (bo.getId() != null) {
|
||||||
add.setId(bo.getId());
|
add.setId(bo.getId());
|
||||||
add.setDeleted(0L);
|
|
||||||
add.setCreateBy(currentUserId);
|
|
||||||
add.setCreateTime(new Date());
|
|
||||||
add.setUpdateBy(currentUserId);
|
|
||||||
add.setUpdateTime(new Date());
|
|
||||||
add.setCreateDept(LoginHelper.getDeptId());
|
|
||||||
add.setBatchId(bo.getBatchId());
|
|
||||||
add.setInfoStatus("3");
|
|
||||||
add.setDataSource("manual");
|
|
||||||
}
|
}
|
||||||
|
add.setDeleted(0L);
|
||||||
|
add.setCreateBy(currentUserId);
|
||||||
|
add.setCreateTime(new Date());
|
||||||
|
add.setUpdateBy(currentUserId);
|
||||||
|
add.setUpdateTime(new Date());
|
||||||
|
add.setCreateDept(LoginHelper.getDeptId());
|
||||||
|
add.setBatchId(bo.getBatchId());
|
||||||
|
add.setInfoStatus("3");
|
||||||
|
add.setDataSource("manual");
|
||||||
|
|
||||||
boolean insertResult = baseMapper.insert(add) > 0;
|
boolean insertResult = baseMapper.insert(add) > 0;
|
||||||
|
|
||||||
|
|||||||
+122
@@ -1,10 +1,12 @@
|
|||||||
package org.dromara.xg.service.impl;
|
package org.dromara.xg.service.impl;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.mybatis.helper.DataPermissionHelper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
@@ -25,6 +27,8 @@ import org.dromara.system.mapper.SysDeptMapper;
|
|||||||
import org.dromara.system.domain.bo.SysUserBo;
|
import org.dromara.system.domain.bo.SysUserBo;
|
||||||
import org.dromara.system.domain.SysDept;
|
import org.dromara.system.domain.SysDept;
|
||||||
import org.dromara.system.domain.vo.SysDeptVo;
|
import org.dromara.system.domain.vo.SysDeptVo;
|
||||||
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
|
import org.dromara.xg.domain.vo.StudentPwdResetVo;
|
||||||
import cn.hutool.crypto.digest.BCrypt;
|
import cn.hutool.crypto.digest.BCrypt;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -1557,4 +1561,122 @@ public class XgStudentMsgServiceImpl implements IXgStudentMsgService {
|
|||||||
private Long getCurrentUserCollegeId() {
|
private Long getCurrentUserCollegeId() {
|
||||||
return currentUserCollegeHelper.resolveCurrentUserCollegeId();
|
return currentUserCollegeHelper.resolveCurrentUserCollegeId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学院级账号只能操作本学院学生(一年级代理学院可操作全部学生);未归属学院的校级账号不受限
|
||||||
|
*/
|
||||||
|
private void checkStudentInCurrentUserCollege(XgStudentMsg student) {
|
||||||
|
if (LoginHelper.isSuperAdmin()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Long collegeId = getCurrentUserCollegeId();
|
||||||
|
if (collegeId == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Long proxyCollegeId = freshmanCollegeProxyHelper.resolveProxyCollegeIdOrNull();
|
||||||
|
if (collegeId.equals(proxyCollegeId) || String.valueOf(collegeId).equals(student.getCollegeId())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new ServiceException("只能操作本学院的学生");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String generateTempPassword() {
|
||||||
|
String upper = "ABCDEFGHJKLMNPQRSTUVWXYZ";
|
||||||
|
String lower = "abcdefghijkmnpqrstuvwxyz";
|
||||||
|
String digit = "23456789";
|
||||||
|
String special = "@#$%";
|
||||||
|
java.security.SecureRandom random = new java.security.SecureRandom();
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(upper.charAt(random.nextInt(upper.length())));
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
sb.append(lower.charAt(random.nextInt(lower.length())));
|
||||||
|
}
|
||||||
|
sb.append(special.charAt(random.nextInt(special.length())));
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
sb.append(digit.charAt(random.nextInt(digit.length())));
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StudentPwdResetVo queryForPwdResetByStudentNo(String studentNo) {
|
||||||
|
if (StringUtils.isBlank(studentNo)) {
|
||||||
|
throw new ServiceException("学号不能为空");
|
||||||
|
}
|
||||||
|
XgStudentMsg student = baseMapper.selectOne(
|
||||||
|
Wrappers.<XgStudentMsg>lambdaQuery()
|
||||||
|
.eq(XgStudentMsg::getStudentNo, studentNo.trim())
|
||||||
|
.last("LIMIT 1")
|
||||||
|
);
|
||||||
|
if (student == null) {
|
||||||
|
throw new ServiceException("未找到学号对应的学生信息");
|
||||||
|
}
|
||||||
|
checkStudentInCurrentUserCollege(student);
|
||||||
|
StudentPwdResetVo vo = new StudentPwdResetVo();
|
||||||
|
vo.setId(student.getId());
|
||||||
|
vo.setStudentNo(student.getStudentNo());
|
||||||
|
vo.setName(student.getName());
|
||||||
|
vo.setClassName(student.getClassName());
|
||||||
|
vo.setClassTeacherName(student.getClassTeacherName());
|
||||||
|
// 学生档案班主任为空时,回退班级表
|
||||||
|
if (StringUtils.isBlank(vo.getClassTeacherName()) && StringUtils.isNotBlank(student.getClassId())) {
|
||||||
|
try {
|
||||||
|
XgClassMsg classMsg = xgClassMsgMapper.selectById(Long.valueOf(student.getClassId()));
|
||||||
|
if (classMsg != null && StringUtils.isNotBlank(classMsg.getClassTeacherName())) {
|
||||||
|
vo.setClassTeacherName(classMsg.getClassTeacherName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(vo.getClassName()) && classMsg != null) {
|
||||||
|
vo.setClassName(classMsg.getClassName());
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException ignored) {
|
||||||
|
// classId 非数字时忽略回退
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String resetStudentPasswordByStudentNo(String studentNo) {
|
||||||
|
if (StringUtils.isBlank(studentNo)) {
|
||||||
|
throw new ServiceException("学号不能为空");
|
||||||
|
}
|
||||||
|
String no = studentNo.trim();
|
||||||
|
XgStudentMsg student = baseMapper.selectOne(
|
||||||
|
Wrappers.<XgStudentMsg>lambdaQuery()
|
||||||
|
.eq(XgStudentMsg::getStudentNo, no)
|
||||||
|
.last("LIMIT 1")
|
||||||
|
);
|
||||||
|
if (student == null) {
|
||||||
|
throw new ServiceException("未找到学号对应的学生信息");
|
||||||
|
}
|
||||||
|
if (student.getId() == null) {
|
||||||
|
throw new ServiceException("学生数据异常,缺少主键");
|
||||||
|
}
|
||||||
|
checkStudentInCurrentUserCollege(student);
|
||||||
|
SysUserVo user = DataPermissionHelper.ignore(() -> sysUserService.selectUserById(student.getId()));
|
||||||
|
if (user == null) {
|
||||||
|
throw new ServiceException("该学生没有登录账号,无法重置密码");
|
||||||
|
}
|
||||||
|
if (!"2".equals(user.getAccountType())) {
|
||||||
|
throw new ServiceException("该账号不是学生账号,禁止重置");
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(user.getUserName()) && !no.equals(user.getUserName())) {
|
||||||
|
throw new ServiceException("学号与登录账号不一致,请联系管理员");
|
||||||
|
}
|
||||||
|
String tempPassword = generateTempPassword();
|
||||||
|
// 学院范围已校验;sys_user.update 自带部门数据权限,学生挂在班级部门,班主任在学院部门,不忽略会更新 0 行
|
||||||
|
int rows = DataPermissionHelper.ignore(
|
||||||
|
() -> sysUserService.resetUserPwd(student.getId(), BCrypt.hashpw(tempPassword)));
|
||||||
|
if (rows <= 0) {
|
||||||
|
throw new ServiceException("重置密码失败,请稍后重试");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
StpUtil.logout(user.getUserType() + ":" + user.getUserId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("学生密码已重置但踢下线失败, studentNo={}, userId={}", no, user.getUserId(), e);
|
||||||
|
}
|
||||||
|
log.info("学生密码已重置, studentNo={}, studentId={}, operator={}",
|
||||||
|
no, student.getId(), LoginHelper.getUserId());
|
||||||
|
return tempPassword;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+106
@@ -0,0 +1,106 @@
|
|||||||
|
package org.dromara.xg.workflow;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||||
|
import org.dromara.workflow.domain.vo.FlowTaskVo;
|
||||||
|
import org.dromara.workflow.service.FlowTaskEnricher;
|
||||||
|
import org.dromara.xg.domain.XgStudentCancelLeave;
|
||||||
|
import org.dromara.xg.domain.XgStudentLeave;
|
||||||
|
import org.dromara.xg.mapper.XgStudentCancelLeaveMapper;
|
||||||
|
import org.dromara.xg.mapper.XgStudentLeaveMapper;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 为请假、销假待办回填班级名称。
|
||||||
|
*/
|
||||||
|
@ConditionalOnEnable
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class XgLeaveFlowTaskEnricher implements FlowTaskEnricher {
|
||||||
|
|
||||||
|
private static final String LEAVE_FLOW_PREFIX = "hzdyjs-qj";
|
||||||
|
private static final String CANCEL_FLOW_PREFIX = "hzdyjs-xj";
|
||||||
|
|
||||||
|
private final XgStudentLeaveMapper leaveMapper;
|
||||||
|
private final XgStudentCancelLeaveMapper cancelLeaveMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enrich(List<FlowTaskVo> tasks) {
|
||||||
|
if (CollUtil.isEmpty(tasks)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<Long> leaveIds = distinctBusinessIds(tasks, LEAVE_FLOW_PREFIX);
|
||||||
|
List<Long> cancelIds = distinctBusinessIds(tasks, CANCEL_FLOW_PREFIX);
|
||||||
|
Map<Long, String> leaveClassNames = loadLeaveClassNames(leaveIds);
|
||||||
|
Map<Long, String> cancelClassNames = loadCancelClassNames(cancelIds);
|
||||||
|
for (FlowTaskVo task : tasks) {
|
||||||
|
String flowCode = task.getFlowCode();
|
||||||
|
Long businessId = parseBusinessId(task.getBusinessId());
|
||||||
|
if (businessId == null || StringUtils.isBlank(flowCode)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (flowCode.startsWith(LEAVE_FLOW_PREFIX) && leaveClassNames.containsKey(businessId)) {
|
||||||
|
task.setClassName(leaveClassNames.get(businessId));
|
||||||
|
} else if (flowCode.startsWith(CANCEL_FLOW_PREFIX) && cancelClassNames.containsKey(businessId)) {
|
||||||
|
task.setClassName(cancelClassNames.get(businessId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Long> distinctBusinessIds(List<FlowTaskVo> tasks, String flowPrefix) {
|
||||||
|
return tasks.stream()
|
||||||
|
.filter(task -> StringUtils.isNotBlank(task.getFlowCode()) && task.getFlowCode().startsWith(flowPrefix))
|
||||||
|
.map(task -> parseBusinessId(task.getBusinessId()))
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<Long, String> loadLeaveClassNames(List<Long> ids) {
|
||||||
|
if (CollUtil.isEmpty(ids)) {
|
||||||
|
return Map.of();
|
||||||
|
}
|
||||||
|
List<XgStudentLeave> rows = leaveMapper.selectList(Wrappers.<XgStudentLeave>lambdaQuery()
|
||||||
|
.select(XgStudentLeave::getId, XgStudentLeave::getClassName)
|
||||||
|
.in(XgStudentLeave::getId, ids));
|
||||||
|
Map<Long, String> classNames = new HashMap<>();
|
||||||
|
for (XgStudentLeave row : rows) {
|
||||||
|
classNames.put(row.getId(), StringUtils.blankToDefault(row.getClassName(), ""));
|
||||||
|
}
|
||||||
|
return classNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<Long, String> loadCancelClassNames(List<Long> ids) {
|
||||||
|
if (CollUtil.isEmpty(ids)) {
|
||||||
|
return Map.of();
|
||||||
|
}
|
||||||
|
List<XgStudentCancelLeave> rows = cancelLeaveMapper.selectList(Wrappers.<XgStudentCancelLeave>lambdaQuery()
|
||||||
|
.select(XgStudentCancelLeave::getId, XgStudentCancelLeave::getClassName)
|
||||||
|
.in(XgStudentCancelLeave::getId, ids));
|
||||||
|
Map<Long, String> classNames = new HashMap<>();
|
||||||
|
for (XgStudentCancelLeave row : rows) {
|
||||||
|
classNames.put(row.getId(), StringUtils.blankToDefault(row.getClassName(), ""));
|
||||||
|
}
|
||||||
|
return classNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Long parseBusinessId(String businessId) {
|
||||||
|
if (StringUtils.isBlank(businessId)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return Long.valueOf(businessId.trim());
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+4
@@ -138,6 +138,10 @@ public class XljkConsultationAppointmentController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/submit")
|
@PostMapping("/submit")
|
||||||
public R<Boolean> submitAppointment(@RequestBody XljkConsultationAppointmentBo bo) {
|
public R<Boolean> submitAppointment(@RequestBody XljkConsultationAppointmentBo bo) {
|
||||||
|
if (!StpUtil.hasPermission("xljk:consultationappointment:add")
|
||||||
|
&& !StpUtil.hasPermission("xljk:consultationappointment:edit")) {
|
||||||
|
bo.setStudentId(LoginHelper.getUserId());
|
||||||
|
}
|
||||||
boolean result = service.submitAppointment(bo);
|
boolean result = service.submitAppointment(bo);
|
||||||
if (result) {
|
if (result) {
|
||||||
return R.ok(true);
|
return R.ok(true);
|
||||||
|
|||||||
+5
@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -64,6 +65,10 @@ public class XljkConsultationNoShowController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/check-limitation")
|
@GetMapping("/check-limitation")
|
||||||
public R<Map<String, Object>> checkLimitation(@RequestParam("studentId") Long studentId) {
|
public R<Map<String, Object>> checkLimitation(@RequestParam("studentId") Long studentId) {
|
||||||
|
if (!StpUtil.hasPermission("xljk:consultationnoshow:list")
|
||||||
|
&& !StpUtil.hasPermission("xljk:consultationappointment:list")) {
|
||||||
|
studentId = LoginHelper.getUserId();
|
||||||
|
}
|
||||||
return R.ok(service.checkLimitation(studentId));
|
return R.ok(service.checkLimitation(studentId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+60
@@ -19,6 +19,8 @@ import org.dromara.common.core.validate.EditGroup;
|
|||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
import org.dromara.xskh.domain.vo.XskhDisciplineRecordVo;
|
import org.dromara.xskh.domain.vo.XskhDisciplineRecordVo;
|
||||||
|
import org.dromara.xskh.domain.vo.XskhPunishmentExportVo;
|
||||||
|
import org.dromara.xskh.domain.vo.XskhPunishmentSummaryVo;
|
||||||
import org.dromara.xskh.domain.bo.XskhDisciplineRecordBo;
|
import org.dromara.xskh.domain.bo.XskhDisciplineRecordBo;
|
||||||
import org.dromara.xskh.domain.vo.XskhStudentOptionVo;
|
import org.dromara.xskh.domain.vo.XskhStudentOptionVo;
|
||||||
import org.dromara.xskh.service.IXskhDisciplineRecordService;
|
import org.dromara.xskh.service.IXskhDisciplineRecordService;
|
||||||
@@ -188,4 +190,62 @@ public class XskhDisciplineRecordController extends BaseController {
|
|||||||
PageQuery pageQuery) {
|
PageQuery pageQuery) {
|
||||||
return xskhDisciplineRecordService.queryMyCreatedPageList(bo, pageQuery);
|
return xskhDisciplineRecordService.queryMyCreatedPageList(bo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生处分种类
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("disciplineRecord:disciplineRecord:query")
|
||||||
|
@GetMapping("/punishment/options")
|
||||||
|
public R<List<Map<String, Object>>> punishmentOptions() {
|
||||||
|
return R.ok(xskhDisciplineRecordService.punishmentOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 录入学生处分,分值计入班级月扣分。开除学籍不计分。
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("disciplineRecord:disciplineRecord:add")
|
||||||
|
@Log(title = "学生处分", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/punishment")
|
||||||
|
public R<Void> addPunishment(@RequestBody XskhDisciplineRecordBo bo) {
|
||||||
|
return toAjax(xskhDisciplineRecordService.insertPunishment(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生处分汇总:按种类、按班级
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("disciplineRecord:disciplineRecord:list")
|
||||||
|
@GetMapping("/punishment/summary")
|
||||||
|
public R<XskhPunishmentSummaryVo> punishmentSummary(XskhDisciplineRecordBo bo) {
|
||||||
|
return R.ok(xskhDisciplineRecordService.summarizePunishment(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出学生处分登记表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("disciplineRecord:disciplineRecord:export")
|
||||||
|
@Log(title = "学生处分登记表", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/punishment/export")
|
||||||
|
public void exportPunishment(XskhDisciplineRecordBo bo, HttpServletResponse response) {
|
||||||
|
List<XskhPunishmentExportVo> list = xskhDisciplineRecordService.listPunishmentExport(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "学生处分登记表", XskhPunishmentExportVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出学生处分汇总表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("disciplineRecord:disciplineRecord:export")
|
||||||
|
@Log(title = "学生处分汇总表", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/punishment/exportSummary")
|
||||||
|
public void exportPunishmentSummary(XskhDisciplineRecordBo bo, HttpServletResponse response) {
|
||||||
|
XskhPunishmentSummaryVo summary = xskhDisciplineRecordService.summarizePunishment(bo);
|
||||||
|
List<XskhPunishmentSummaryVo.Row> rows = new java.util.ArrayList<>();
|
||||||
|
if (summary.getByType() != null) {
|
||||||
|
rows.addAll(summary.getByType());
|
||||||
|
}
|
||||||
|
if (summary.getByClass() != null) {
|
||||||
|
rows.addAll(summary.getByClass());
|
||||||
|
}
|
||||||
|
ExcelUtil.exportExcel(rows, "学生处分汇总表", XskhPunishmentSummaryVo.Row.class, response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -111,7 +111,7 @@ public class XskhDisciplineRecord extends TenantEntity {
|
|||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 违纪来源(1-宿舍卫生检查 2-教学区违纪)
|
* 违纪来源(1-宿舍卫生检查 2-教学区违纪 3-学生处分)
|
||||||
*/
|
*/
|
||||||
private String violationSource;
|
private String violationSource;
|
||||||
|
|
||||||
|
|||||||
+18
-1
@@ -129,10 +129,27 @@ public class XskhDisciplineRecordBo extends BaseEntity {
|
|||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 违纪来源(1-宿舍卫生检查 2-教学区违纪)
|
* 违纪来源(1-宿舍卫生检查 2-教学区违纪 3-学生处分)
|
||||||
*/
|
*/
|
||||||
private String violationSource;
|
private String violationSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处分编码(cf_warning 等),仅学生处分录入使用
|
||||||
|
*/
|
||||||
|
private String punishmentCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询开始日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate beginDisciplineDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询结束日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate endDisciplineDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 附件OSS ID列表,逗号分隔
|
* 附件OSS ID列表,逗号分隔
|
||||||
*/
|
*/
|
||||||
|
|||||||
+46
@@ -0,0 +1,46 @@
|
|||||||
|
package org.dromara.xskh.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生处分登记表导出行
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class XskhPunishmentExportVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ExcelProperty("学号")
|
||||||
|
private String studentNo;
|
||||||
|
|
||||||
|
@ExcelProperty("姓名")
|
||||||
|
private String studentName;
|
||||||
|
|
||||||
|
@ExcelProperty("学院")
|
||||||
|
private String collegeName;
|
||||||
|
|
||||||
|
@ExcelProperty("班级")
|
||||||
|
private String className;
|
||||||
|
|
||||||
|
@ExcelProperty("处分种类")
|
||||||
|
private String disciplineTypeName;
|
||||||
|
|
||||||
|
@ExcelProperty("班级扣分")
|
||||||
|
private BigDecimal scoreDeduction;
|
||||||
|
|
||||||
|
@ExcelProperty("处分日期")
|
||||||
|
private LocalDate disciplineDate;
|
||||||
|
|
||||||
|
@ExcelProperty("原因")
|
||||||
|
private String disciplineReason;
|
||||||
|
|
||||||
|
@ExcelProperty("备注")
|
||||||
|
private String disciplineContent;
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
package org.dromara.xskh.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生处分汇总
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class XskhPunishmentSummaryVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private List<Row> byType = new ArrayList<>();
|
||||||
|
|
||||||
|
private List<Row> byClass = new ArrayList<>();
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Row implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ExcelProperty("维度")
|
||||||
|
private String dimension;
|
||||||
|
|
||||||
|
@ExcelProperty("名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ExcelProperty("人次")
|
||||||
|
private Integer count;
|
||||||
|
|
||||||
|
@ExcelProperty("班级扣分")
|
||||||
|
private BigDecimal score;
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
@@ -1,5 +1,7 @@
|
|||||||
package org.dromara.xskh.mapper;
|
package org.dromara.xskh.mapper;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
import org.dromara.xskh.domain.XskhAssessmentApplicationApproval;
|
import org.dromara.xskh.domain.XskhAssessmentApplicationApproval;
|
||||||
import org.dromara.xskh.domain.vo.XskhAssessmentApplicationApprovalVo;
|
import org.dromara.xskh.domain.vo.XskhAssessmentApplicationApprovalVo;
|
||||||
@@ -26,4 +28,16 @@ public interface XskhAssessmentApplicationApprovalMapper
|
|||||||
List<org.dromara.xskh.domain.vo.XskhAssessmentSelfScoreVo> selectSelfScoresWithIndicatorInfo(
|
List<org.dromara.xskh.domain.vo.XskhAssessmentSelfScoreVo> selectSelfScoresWithIndicatorInfo(
|
||||||
Long applicationId);
|
Long applicationId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据学生信息ID查询学号
|
||||||
|
*/
|
||||||
|
@Select("SELECT student_no FROM xg_student_msg WHERE id = #{studentId} AND deleted = 0 LIMIT 1")
|
||||||
|
String selectStudentNoByStudentId(@Param("studentId") Long studentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按学号统计学生信息条数(用于判断当前登录账号是否为学生)
|
||||||
|
*/
|
||||||
|
@Select("SELECT COUNT(1) FROM xg_student_msg WHERE student_no = #{studentNo} AND deleted = 0")
|
||||||
|
long countStudentByStudentNo(@Param("studentNo") String studentNo);
|
||||||
|
|
||||||
}
|
}
|
||||||
+2
@@ -31,6 +31,8 @@ public interface XskhDisciplineRecordMapper extends BaseMapperPlus<XskhDisciplin
|
|||||||
@Param("offset") Integer offset,
|
@Param("offset") Integer offset,
|
||||||
@Param("pageSize") Integer pageSize);
|
@Param("pageSize") Integer pageSize);
|
||||||
|
|
||||||
|
XskhStudentOptionVo selectStudentById(@Param("id") Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询班主任班级的违纪处分记录列表(班主任专用)
|
* 查询班主任班级的违纪处分记录列表(班主任专用)
|
||||||
*
|
*
|
||||||
|
|||||||
+10
@@ -4,6 +4,8 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
|||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.xskh.domain.bo.XskhDisciplineRecordBo;
|
import org.dromara.xskh.domain.bo.XskhDisciplineRecordBo;
|
||||||
import org.dromara.xskh.domain.vo.XskhDisciplineRecordVo;
|
import org.dromara.xskh.domain.vo.XskhDisciplineRecordVo;
|
||||||
|
import org.dromara.xskh.domain.vo.XskhPunishmentExportVo;
|
||||||
|
import org.dromara.xskh.domain.vo.XskhPunishmentSummaryVo;
|
||||||
import org.dromara.xskh.domain.vo.XskhStudentOptionVo;
|
import org.dromara.xskh.domain.vo.XskhStudentOptionVo;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -123,4 +125,12 @@ public interface IXskhDisciplineRecordService {
|
|||||||
* @return 违纪记录分页列表
|
* @return 违纪记录分页列表
|
||||||
*/
|
*/
|
||||||
TableDataInfo<XskhDisciplineRecordVo> queryMyCreatedPageList(XskhDisciplineRecordBo bo, PageQuery pageQuery);
|
TableDataInfo<XskhDisciplineRecordVo> queryMyCreatedPageList(XskhDisciplineRecordBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
List<Map<String, Object>> punishmentOptions();
|
||||||
|
|
||||||
|
Boolean insertPunishment(XskhDisciplineRecordBo bo);
|
||||||
|
|
||||||
|
XskhPunishmentSummaryVo summarizePunishment(XskhDisciplineRecordBo bo);
|
||||||
|
|
||||||
|
List<XskhPunishmentExportVo> listPunishmentExport(XskhDisciplineRecordBo bo);
|
||||||
}
|
}
|
||||||
+62
@@ -1,7 +1,9 @@
|
|||||||
package org.dromara.xskh.service.impl;
|
package org.dromara.xskh.service.impl;
|
||||||
|
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -55,6 +57,9 @@ public class XskhAssessmentApplicationApprovalServiceImpl implements IXskhAssess
|
|||||||
@Override
|
@Override
|
||||||
public XskhAssessmentApplicationApprovalVo queryById(Long id) {
|
public XskhAssessmentApplicationApprovalVo queryById(Long id) {
|
||||||
XskhAssessmentApplicationApprovalVo vo = baseMapper.selectVoById(id);
|
XskhAssessmentApplicationApprovalVo vo = baseMapper.selectVoById(id);
|
||||||
|
if (vo != null && isCurrentUserStudent() && !StringUtils.equals(vo.getStudentNo(), LoginHelper.getUsername())) {
|
||||||
|
throw new ServiceException("无权查看他人的考核申请");
|
||||||
|
}
|
||||||
if (vo != null) {
|
if (vo != null) {
|
||||||
// 查询完整的自评得分列表(包含指标表关联数据)
|
// 查询完整的自评得分列表(包含指标表关联数据)
|
||||||
List<XskhAssessmentSelfScoreVo> selfScoreVos = baseMapper.selectSelfScoresWithIndicatorInfo(id);
|
List<XskhAssessmentSelfScoreVo> selfScoreVos = baseMapper.selectSelfScoresWithIndicatorInfo(id);
|
||||||
@@ -110,6 +115,14 @@ public class XskhAssessmentApplicationApprovalServiceImpl implements IXskhAssess
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long insertByBo(XskhAssessmentApplicationApprovalBo bo) {
|
public Long insertByBo(XskhAssessmentApplicationApprovalBo bo) {
|
||||||
XskhAssessmentApplicationApproval add = MapstructUtils.convert(bo, XskhAssessmentApplicationApproval.class);
|
XskhAssessmentApplicationApproval add = MapstructUtils.convert(bo, XskhAssessmentApplicationApproval.class);
|
||||||
|
if (isCurrentUserStudent()) {
|
||||||
|
String username = LoginHelper.getUsername();
|
||||||
|
if (!StringUtils.equals(username, baseMapper.selectStudentNoByStudentId(add.getStudentId()))) {
|
||||||
|
throw new ServiceException("只能提交本人的考核申请");
|
||||||
|
}
|
||||||
|
add.setStudentNo(username);
|
||||||
|
}
|
||||||
|
clearApprovalFields(add);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
// 新增时默认状态为草稿
|
// 新增时默认状态为草稿
|
||||||
add.setStatus("1");
|
add.setStatus("1");
|
||||||
@@ -130,7 +143,23 @@ public class XskhAssessmentApplicationApprovalServiceImpl implements IXskhAssess
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean updateByBo(XskhAssessmentApplicationApprovalBo bo) {
|
public Boolean updateByBo(XskhAssessmentApplicationApprovalBo bo) {
|
||||||
|
XskhAssessmentApplicationApproval existing = baseMapper.selectById(bo.getId());
|
||||||
|
if (existing == null) {
|
||||||
|
throw new ServiceException("考核申请不存在");
|
||||||
|
}
|
||||||
|
checkOwner(existing);
|
||||||
|
if (!"1".equals(existing.getStatus()) && !"2".equals(existing.getStatus())
|
||||||
|
&& !"3".equals(existing.getStatus())) {
|
||||||
|
throw new ServiceException("只有草稿、已提交、班主任审核状态的考核申请可以修改");
|
||||||
|
}
|
||||||
XskhAssessmentApplicationApproval update = MapstructUtils.convert(bo, XskhAssessmentApplicationApproval.class);
|
XskhAssessmentApplicationApproval update = MapstructUtils.convert(bo, XskhAssessmentApplicationApproval.class);
|
||||||
|
// 学生本人与学号归属不允许通过修改接口变更
|
||||||
|
update.setStudentId(null);
|
||||||
|
update.setStudentNo(null);
|
||||||
|
if (!"1".equals(update.getStatus())) {
|
||||||
|
update.setStatus(null);
|
||||||
|
}
|
||||||
|
clearApprovalFields(update);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
boolean flag = baseMapper.updateById(update) > 0;
|
boolean flag = baseMapper.updateById(update) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
@@ -149,6 +178,32 @@ public class XskhAssessmentApplicationApprovalServiceImpl implements IXskhAssess
|
|||||||
// TODO 做一些数据校验,如唯一约束
|
// TODO 做一些数据校验,如唯一约束
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 班主任评分与审核字段只能由审核接口写入
|
||||||
|
*/
|
||||||
|
private void clearApprovalFields(XskhAssessmentApplicationApproval entity) {
|
||||||
|
entity.setTeacherScore(null);
|
||||||
|
entity.setTotalScore(null);
|
||||||
|
entity.setTeacherApprovalBy(null);
|
||||||
|
entity.setTeacherApprovalTime(null);
|
||||||
|
entity.setTeacherApprovalRemark(null);
|
||||||
|
entity.setSubmitTime(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isCurrentUserStudent() {
|
||||||
|
String username = LoginHelper.getUsername();
|
||||||
|
return StringUtils.isNotBlank(username) && baseMapper.countStudentByStudentNo(username) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生账号只能操作本人的考核申请
|
||||||
|
*/
|
||||||
|
private void checkOwner(XskhAssessmentApplicationApproval application) {
|
||||||
|
if (isCurrentUserStudent() && !StringUtils.equals(application.getStudentNo(), LoginHelper.getUsername())) {
|
||||||
|
throw new ServiceException("无权操作他人的考核申请");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除学生考核申请、班主任审核
|
* 批量删除学生考核申请、班主任审核
|
||||||
*/
|
*/
|
||||||
@@ -158,6 +213,9 @@ public class XskhAssessmentApplicationApprovalServiceImpl implements IXskhAssess
|
|||||||
// 校验是否可以删除:只有草稿状态的申请可以删除
|
// 校验是否可以删除:只有草稿状态的申请可以删除
|
||||||
for (Long id : ids) {
|
for (Long id : ids) {
|
||||||
XskhAssessmentApplicationApproval application = baseMapper.selectById(id);
|
XskhAssessmentApplicationApproval application = baseMapper.selectById(id);
|
||||||
|
if (application != null) {
|
||||||
|
checkOwner(application);
|
||||||
|
}
|
||||||
if (application != null && !"1".equals(application.getStatus())) {
|
if (application != null && !"1".equals(application.getStatus())) {
|
||||||
throw new RuntimeException("只有草稿状态的考核申请可以删除");
|
throw new RuntimeException("只有草稿状态的考核申请可以删除");
|
||||||
}
|
}
|
||||||
@@ -181,6 +239,7 @@ public class XskhAssessmentApplicationApprovalServiceImpl implements IXskhAssess
|
|||||||
if (existing == null) {
|
if (existing == null) {
|
||||||
throw new RuntimeException("考核申请不存在");
|
throw new RuntimeException("考核申请不存在");
|
||||||
}
|
}
|
||||||
|
checkOwner(existing);
|
||||||
if (!"1".equals(existing.getStatus()) && !"2".equals(existing.getStatus())
|
if (!"1".equals(existing.getStatus()) && !"2".equals(existing.getStatus())
|
||||||
&& !"3".equals(existing.getStatus())) {
|
&& !"3".equals(existing.getStatus())) {
|
||||||
throw new RuntimeException("只有草稿、已提交、班主任审核状态的考核申请可以保存");
|
throw new RuntimeException("只有草稿、已提交、班主任审核状态的考核申请可以保存");
|
||||||
@@ -201,6 +260,7 @@ public class XskhAssessmentApplicationApprovalServiceImpl implements IXskhAssess
|
|||||||
if (application == null) {
|
if (application == null) {
|
||||||
throw new RuntimeException("考核申请不存在");
|
throw new RuntimeException("考核申请不存在");
|
||||||
}
|
}
|
||||||
|
checkOwner(application);
|
||||||
if (!"1".equals(application.getStatus()) && !"2".equals(application.getStatus())
|
if (!"1".equals(application.getStatus()) && !"2".equals(application.getStatus())
|
||||||
&& !"3".equals(application.getStatus())) {
|
&& !"3".equals(application.getStatus())) {
|
||||||
throw new RuntimeException("只有草稿、已提交、班主任审核状态的考核申请可以提交");
|
throw new RuntimeException("只有草稿、已提交、班主任审核状态的考核申请可以提交");
|
||||||
@@ -221,6 +281,7 @@ public class XskhAssessmentApplicationApprovalServiceImpl implements IXskhAssess
|
|||||||
if (application == null) {
|
if (application == null) {
|
||||||
throw new RuntimeException("考核申请不存在");
|
throw new RuntimeException("考核申请不存在");
|
||||||
}
|
}
|
||||||
|
checkOwner(application);
|
||||||
if (!"1".equals(application.getStatus())) {
|
if (!"1".equals(application.getStatus())) {
|
||||||
throw new RuntimeException("只有草稿状态的考核申请可以删除");
|
throw new RuntimeException("只有草稿状态的考核申请可以删除");
|
||||||
}
|
}
|
||||||
@@ -283,6 +344,7 @@ public class XskhAssessmentApplicationApprovalServiceImpl implements IXskhAssess
|
|||||||
wrapper.eq(XskhAssessmentApplicationApproval::getScheduleId, scheduleId);
|
wrapper.eq(XskhAssessmentApplicationApproval::getScheduleId, scheduleId);
|
||||||
XskhAssessmentApplicationApproval application = baseMapper.selectOne(wrapper);
|
XskhAssessmentApplicationApproval application = baseMapper.selectOne(wrapper);
|
||||||
if (application != null) {
|
if (application != null) {
|
||||||
|
checkOwner(application);
|
||||||
return queryById(application.getId());
|
return queryById(application.getId());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
+181
-1
@@ -5,22 +5,31 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.xskh.domain.XskhDisciplineRecord;
|
import org.dromara.xskh.domain.XskhDisciplineRecord;
|
||||||
|
import org.dromara.xskh.domain.XskhDisciplineType;
|
||||||
import org.dromara.xskh.domain.bo.XskhDisciplineRecordBo;
|
import org.dromara.xskh.domain.bo.XskhDisciplineRecordBo;
|
||||||
import org.dromara.xskh.domain.vo.XskhDisciplineRecordVo;
|
import org.dromara.xskh.domain.vo.XskhDisciplineRecordVo;
|
||||||
|
import org.dromara.xskh.domain.vo.XskhPunishmentExportVo;
|
||||||
|
import org.dromara.xskh.domain.vo.XskhPunishmentSummaryVo;
|
||||||
import org.dromara.xskh.domain.vo.XskhStudentOptionVo;
|
import org.dromara.xskh.domain.vo.XskhStudentOptionVo;
|
||||||
import org.dromara.xskh.mapper.XskhDisciplineRecordMapper;
|
import org.dromara.xskh.mapper.XskhDisciplineRecordMapper;
|
||||||
|
import org.dromara.xskh.mapper.XskhDisciplineTypeMapper;
|
||||||
import org.dromara.xskh.service.IXskhDisciplineRecordService;
|
import org.dromara.xskh.service.IXskhDisciplineRecordService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -37,7 +46,18 @@ import java.util.stream.Collectors;
|
|||||||
@Service
|
@Service
|
||||||
public class XskhDisciplineRecordServiceImpl implements IXskhDisciplineRecordService {
|
public class XskhDisciplineRecordServiceImpl implements IXskhDisciplineRecordService {
|
||||||
|
|
||||||
|
private static final String PUNISHMENT_SOURCE = "3";
|
||||||
|
|
||||||
|
private static final List<PunishmentLevel> PUNISHMENT_LEVELS = List.of(
|
||||||
|
new PunishmentLevel("cf_warning", "警告", new BigDecimal("4")),
|
||||||
|
new PunishmentLevel("cf_serious_warning", "严重警告", new BigDecimal("5")),
|
||||||
|
new PunishmentLevel("cf_demerit", "记过", new BigDecimal("8")),
|
||||||
|
new PunishmentLevel("cf_probation", "留校察看", new BigDecimal("10")),
|
||||||
|
new PunishmentLevel("cf_expulsion", "开除学籍", BigDecimal.ZERO)
|
||||||
|
);
|
||||||
|
|
||||||
private final XskhDisciplineRecordMapper baseMapper;
|
private final XskhDisciplineRecordMapper baseMapper;
|
||||||
|
private final XskhDisciplineTypeMapper disciplineTypeMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询学生违纪处分记录
|
* 查询学生违纪处分记录
|
||||||
@@ -81,8 +101,13 @@ public class XskhDisciplineRecordServiceImpl implements IXskhDisciplineRecordSer
|
|||||||
lqw.eq(bo.getClassId() != null, XskhDisciplineRecord::getClassId, bo.getClassId());
|
lqw.eq(bo.getClassId() != null, XskhDisciplineRecord::getClassId, bo.getClassId());
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getClassName()), XskhDisciplineRecord::getClassName, bo.getClassName());
|
lqw.like(StringUtils.isNotBlank(bo.getClassName()), XskhDisciplineRecord::getClassName, bo.getClassName());
|
||||||
lqw.eq(bo.getDisciplineTypeId() != null, XskhDisciplineRecord::getDisciplineTypeId, bo.getDisciplineTypeId());
|
lqw.eq(bo.getDisciplineTypeId() != null, XskhDisciplineRecord::getDisciplineTypeId, bo.getDisciplineTypeId());
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getDisciplineTypeName()), XskhDisciplineRecord::getDisciplineTypeName,
|
if (PUNISHMENT_SOURCE.equals(bo.getViolationSource())) {
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getDisciplineTypeName()), XskhDisciplineRecord::getDisciplineTypeName,
|
||||||
bo.getDisciplineTypeName());
|
bo.getDisciplineTypeName());
|
||||||
|
} else {
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getDisciplineTypeName()), XskhDisciplineRecord::getDisciplineTypeName,
|
||||||
|
bo.getDisciplineTypeName());
|
||||||
|
}
|
||||||
lqw.eq(bo.getDisciplineDate() != null, XskhDisciplineRecord::getDisciplineDate, bo.getDisciplineDate());
|
lqw.eq(bo.getDisciplineDate() != null, XskhDisciplineRecord::getDisciplineDate, bo.getDisciplineDate());
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getDisciplineReason()), XskhDisciplineRecord::getDisciplineReason,
|
lqw.like(StringUtils.isNotBlank(bo.getDisciplineReason()), XskhDisciplineRecord::getDisciplineReason,
|
||||||
bo.getDisciplineReason());
|
bo.getDisciplineReason());
|
||||||
@@ -90,6 +115,9 @@ public class XskhDisciplineRecordServiceImpl implements IXskhDisciplineRecordSer
|
|||||||
bo.getDisciplineContent());
|
bo.getDisciplineContent());
|
||||||
lqw.eq(bo.getScoreDeduction() != null, XskhDisciplineRecord::getScoreDeduction, bo.getScoreDeduction());
|
lqw.eq(bo.getScoreDeduction() != null, XskhDisciplineRecord::getScoreDeduction, bo.getScoreDeduction());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), XskhDisciplineRecord::getStatus, bo.getStatus());
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), XskhDisciplineRecord::getStatus, bo.getStatus());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getViolationSource()), XskhDisciplineRecord::getViolationSource, bo.getViolationSource());
|
||||||
|
lqw.ge(bo.getBeginDisciplineDate() != null, XskhDisciplineRecord::getDisciplineDate, bo.getBeginDisciplineDate());
|
||||||
|
lqw.le(bo.getEndDisciplineDate() != null, XskhDisciplineRecord::getDisciplineDate, bo.getEndDisciplineDate());
|
||||||
lqw.orderByDesc(XskhDisciplineRecord::getCreateTime);
|
lqw.orderByDesc(XskhDisciplineRecord::getCreateTime);
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
@@ -339,4 +367,156 @@ public class XskhDisciplineRecordServiceImpl implements IXskhDisciplineRecordSer
|
|||||||
log.info("查询到 {} 条记录", result.getTotal());
|
log.info("查询到 {} 条记录", result.getTotal());
|
||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> punishmentOptions() {
|
||||||
|
List<Map<String, Object>> options = new ArrayList<>();
|
||||||
|
for (PunishmentLevel level : PUNISHMENT_LEVELS) {
|
||||||
|
Map<String, Object> item = new LinkedHashMap<>();
|
||||||
|
item.put("code", level.code);
|
||||||
|
item.put("name", level.name);
|
||||||
|
item.put("score", level.score);
|
||||||
|
item.put("countInClass", level.score.compareTo(BigDecimal.ZERO) > 0);
|
||||||
|
options.add(item);
|
||||||
|
}
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean insertPunishment(XskhDisciplineRecordBo bo) {
|
||||||
|
if (bo == null || bo.getStudentId() == null) {
|
||||||
|
throw new ServiceException("请选择学生");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(bo.getDisciplineReason())) {
|
||||||
|
throw new ServiceException("请填写处分原因");
|
||||||
|
}
|
||||||
|
PunishmentLevel level = findPunishmentLevel(bo.getPunishmentCode());
|
||||||
|
XskhStudentOptionVo student = baseMapper.selectStudentById(bo.getStudentId());
|
||||||
|
if (student == null) {
|
||||||
|
throw new ServiceException("未找到学生信息");
|
||||||
|
}
|
||||||
|
if (student.getClassId() == null) {
|
||||||
|
throw new ServiceException("该学生未分配班级,无法把处分计入班级");
|
||||||
|
}
|
||||||
|
XskhDisciplineType type = ensurePunishmentType(level);
|
||||||
|
XskhDisciplineRecord record = new XskhDisciplineRecord();
|
||||||
|
record.setStudentId(student.getId());
|
||||||
|
record.setStudentNo(student.getStudentNo());
|
||||||
|
record.setStudentName(student.getName());
|
||||||
|
record.setCollegeId(student.getCollegeId());
|
||||||
|
record.setCollegeName(student.getCollegeName());
|
||||||
|
record.setMajorId(student.getMajorId());
|
||||||
|
record.setMajorName(student.getMajorName());
|
||||||
|
record.setClassId(student.getClassId());
|
||||||
|
record.setClassName(student.getClassName());
|
||||||
|
record.setDisciplineTypeId(type.getId());
|
||||||
|
record.setDisciplineTypeName(level.name);
|
||||||
|
record.setDisciplineDate(bo.getDisciplineDate() == null ? LocalDate.now() : bo.getDisciplineDate());
|
||||||
|
record.setDisciplineReason(bo.getDisciplineReason().trim());
|
||||||
|
record.setDisciplineContent(bo.getDisciplineContent());
|
||||||
|
record.setScoreDeduction(level.score);
|
||||||
|
record.setStatus("1");
|
||||||
|
record.setViolationSource(PUNISHMENT_SOURCE);
|
||||||
|
return baseMapper.insert(record) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public XskhPunishmentSummaryVo summarizePunishment(XskhDisciplineRecordBo bo) {
|
||||||
|
List<XskhDisciplineRecordVo> records = listPunishmentRecords(bo);
|
||||||
|
Map<String, XskhPunishmentSummaryVo.Row> typeMap = new LinkedHashMap<>();
|
||||||
|
for (PunishmentLevel level : PUNISHMENT_LEVELS) {
|
||||||
|
typeMap.put(level.name, summaryRow("处分种类", level.name));
|
||||||
|
}
|
||||||
|
Map<String, XskhPunishmentSummaryVo.Row> classMap = new LinkedHashMap<>();
|
||||||
|
for (XskhDisciplineRecordVo record : records) {
|
||||||
|
String typeName = StringUtils.blankToDefault(record.getDisciplineTypeName(), "未分类");
|
||||||
|
XskhPunishmentSummaryVo.Row typeRow = typeMap.computeIfAbsent(typeName, name -> summaryRow("处分种类", name));
|
||||||
|
addSummary(typeRow, record.getScoreDeduction());
|
||||||
|
String classKey = StringUtils.blankToDefault(record.getCollegeName(), "") + "/"
|
||||||
|
+ StringUtils.blankToDefault(record.getClassName(), "未分班");
|
||||||
|
XskhPunishmentSummaryVo.Row classRow = classMap.computeIfAbsent(classKey,
|
||||||
|
key -> summaryRow("班级", classKey));
|
||||||
|
addSummary(classRow, record.getScoreDeduction());
|
||||||
|
}
|
||||||
|
XskhPunishmentSummaryVo summary = new XskhPunishmentSummaryVo();
|
||||||
|
summary.setByType(new ArrayList<>(typeMap.values()));
|
||||||
|
summary.setByClass(new ArrayList<>(classMap.values()));
|
||||||
|
return summary;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<XskhPunishmentExportVo> listPunishmentExport(XskhDisciplineRecordBo bo) {
|
||||||
|
return listPunishmentRecords(bo).stream().map(record -> {
|
||||||
|
XskhPunishmentExportVo row = new XskhPunishmentExportVo();
|
||||||
|
row.setStudentNo(record.getStudentNo());
|
||||||
|
row.setStudentName(record.getStudentName());
|
||||||
|
row.setCollegeName(record.getCollegeName());
|
||||||
|
row.setClassName(record.getClassName());
|
||||||
|
row.setDisciplineTypeName(record.getDisciplineTypeName());
|
||||||
|
row.setScoreDeduction(record.getScoreDeduction());
|
||||||
|
row.setDisciplineDate(record.getDisciplineDate());
|
||||||
|
row.setDisciplineReason(record.getDisciplineReason());
|
||||||
|
row.setDisciplineContent(record.getDisciplineContent());
|
||||||
|
return row;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<XskhDisciplineRecordVo> listPunishmentRecords(XskhDisciplineRecordBo bo) {
|
||||||
|
if (bo == null) {
|
||||||
|
bo = new XskhDisciplineRecordBo();
|
||||||
|
}
|
||||||
|
bo.setViolationSource(PUNISHMENT_SOURCE);
|
||||||
|
return queryList(bo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PunishmentLevel findPunishmentLevel(String code) {
|
||||||
|
if (StringUtils.isBlank(code)) {
|
||||||
|
throw new ServiceException("请选择处分种类");
|
||||||
|
}
|
||||||
|
return PUNISHMENT_LEVELS.stream()
|
||||||
|
.filter(level -> level.code.equals(code))
|
||||||
|
.findFirst()
|
||||||
|
.orElseThrow(() -> new ServiceException("处分种类不正确"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private XskhDisciplineType ensurePunishmentType(PunishmentLevel level) {
|
||||||
|
XskhDisciplineType existing = disciplineTypeMapper.selectOne(Wrappers.<XskhDisciplineType>lambdaQuery()
|
||||||
|
.eq(XskhDisciplineType::getTypeCode, level.code)
|
||||||
|
.last("limit 1"));
|
||||||
|
if (existing != null) {
|
||||||
|
return existing;
|
||||||
|
}
|
||||||
|
XskhDisciplineType type = new XskhDisciplineType();
|
||||||
|
type.setTypeCode(level.code);
|
||||||
|
type.setTypeName(level.name);
|
||||||
|
type.setTypeCategory("2");
|
||||||
|
type.setAreaType("0");
|
||||||
|
type.setMinScore(level.score);
|
||||||
|
type.setMaxScore(level.score);
|
||||||
|
type.setStatus("0");
|
||||||
|
type.setIsEqualized("0");
|
||||||
|
type.setSortOrder((long) (PUNISHMENT_LEVELS.indexOf(level) + 1));
|
||||||
|
type.setRemark(level.score.compareTo(BigDecimal.ZERO) > 0
|
||||||
|
? "学生处分,计入班级月扣分"
|
||||||
|
: "开除学籍不计班级扣分");
|
||||||
|
disciplineTypeMapper.insert(type);
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
private XskhPunishmentSummaryVo.Row summaryRow(String dimension, String name) {
|
||||||
|
XskhPunishmentSummaryVo.Row row = new XskhPunishmentSummaryVo.Row();
|
||||||
|
row.setDimension(dimension);
|
||||||
|
row.setName(name);
|
||||||
|
row.setCount(0);
|
||||||
|
row.setScore(BigDecimal.ZERO);
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addSummary(XskhPunishmentSummaryVo.Row row, BigDecimal score) {
|
||||||
|
row.setCount(row.getCount() + 1);
|
||||||
|
row.setScore(row.getScore().add(score == null ? BigDecimal.ZERO : score));
|
||||||
|
}
|
||||||
|
|
||||||
|
private record PunishmentLevel(String code, String name, BigDecimal score) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+10
@@ -49,6 +49,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
select id, student_id, student_no, student_name, college_id, college_name, major_id, major_name, class_id, class_name, discipline_type_id, discipline_type_name, discipline_date, discipline_reason, discipline_content, score_deduction, status, violation_source, attachment_oss_ids, create_by, create_time, create_dept, update_by, update_time, deleted, tenant_id from xskh_discipline_record
|
select id, student_id, student_no, student_name, college_id, college_name, major_id, major_name, class_id, class_name, discipline_type_id, discipline_type_name, discipline_date, discipline_reason, discipline_content, score_deduction, status, violation_source, attachment_oss_ids, create_by, create_time, create_dept, update_by, update_time, deleted, tenant_id from xskh_discipline_record
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectStudentById" resultMap="StudentOptionResult">
|
||||||
|
select
|
||||||
|
id, student_no, name, college_id, college_name,
|
||||||
|
major_id, major_name, class_id, class_name
|
||||||
|
from xg_student_msg
|
||||||
|
where deleted = 0
|
||||||
|
and id = #{id}
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectStudentOptions" resultMap="StudentOptionResult">
|
<select id="selectStudentOptions" resultMap="StudentOptionResult">
|
||||||
select
|
select
|
||||||
id, student_no, name, college_id, college_name,
|
id, student_no, name, college_id, college_name,
|
||||||
|
|||||||
+7
-6
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.zsjy.controller;
|
package org.dromara.zsjy.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
@@ -130,7 +131,7 @@ public class InternshipInfoController extends BaseController {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取学生实习信息异常,用户ID: {},错误信息: {}", LoginHelper.getUserId(), e.getMessage(), e);
|
log.error("获取学生实习信息异常,用户ID: {},错误信息: {}", LoginHelper.getUserId(), e.getMessage(), e);
|
||||||
return R.fail("获取实习信息失败:" + e.getMessage());
|
return R.fail("获取实习信息失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +154,7 @@ public class InternshipInfoController extends BaseController {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("新增实习信息异常,学生ID:{},错误信息:{}", addBO.getStudentId(), e.getMessage(), e);
|
log.error("新增实习信息异常,学生ID:{},错误信息:{}", addBO.getStudentId(), e.getMessage(), e);
|
||||||
return R.fail("新增实习信息失败:" + e.getMessage());
|
return R.fail("新增实习信息失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +177,7 @@ public class InternshipInfoController extends BaseController {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("修改实习信息异常,实习信息ID:{},错误信息:{}", editBO.getInternshipId(), e.getMessage(), e);
|
log.error("修改实习信息异常,实习信息ID:{},错误信息:{}", editBO.getInternshipId(), e.getMessage(), e);
|
||||||
return R.fail("修改实习信息失败:" + e.getMessage());
|
return R.fail("修改实习信息失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +201,7 @@ public class InternshipInfoController extends BaseController {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("删除实习信息异常,IDs:{},错误信息:{}", internshipIds, e.getMessage(), e);
|
log.error("删除实习信息异常,IDs:{},错误信息:{}", internshipIds, e.getMessage(), e);
|
||||||
return R.fail("删除实习信息失败:" + e.getMessage());
|
return R.fail("删除实习信息失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,7 +224,7 @@ public class InternshipInfoController extends BaseController {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取当前学生实习信息失败:{}", e.getMessage(), e);
|
log.error("获取当前学生实习信息失败:{}", e.getMessage(), e);
|
||||||
return R.fail("获取实习信息失败:" + e.getMessage());
|
return R.fail("获取实习信息失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,7 +249,7 @@ public class InternshipInfoController extends BaseController {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("实习信息变更异常,原实习ID:{},错误信息:{}",
|
log.error("实习信息变更异常,原实习ID:{},错误信息:{}",
|
||||||
changeBO.getInternshipId(), e.getMessage(), e);
|
changeBO.getInternshipId(), e.getMessage(), e);
|
||||||
return R.fail("实习信息变更失败:" + e.getMessage());
|
return R.fail("实习信息变更失败:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-2
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.zsjy.controller;
|
package org.dromara.zsjy.controller;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -179,7 +180,7 @@ public class ZsjyEnrollmentInfoController extends BaseController {
|
|||||||
List<ZsjyEnrollmentDeptVo> colleges = enrollmentMajorService.selectOpenColleges();
|
List<ZsjyEnrollmentDeptVo> colleges = enrollmentMajorService.selectOpenColleges();
|
||||||
return R.ok(colleges);
|
return R.ok(colleges);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("获取学院列表异常: " + e.getMessage());
|
return R.fail("获取学院列表异常: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,7 +193,7 @@ public class ZsjyEnrollmentInfoController extends BaseController {
|
|||||||
List<ZsjyEnrollmentDeptVo> majors = enrollmentMajorService.selectOpenMajorsByCollegeId(collegeId);
|
List<ZsjyEnrollmentDeptVo> majors = enrollmentMajorService.selectOpenMajorsByCollegeId(collegeId);
|
||||||
return R.ok(majors);
|
return R.ok(majors);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.fail("获取专业列表异常: " + e.getMessage());
|
return R.fail("获取专业列表异常: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.dev33.satoken.annotation.SaMode;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
@@ -63,6 +64,7 @@ public class ZsjyEnrollmentProcessController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 导出新生录取名册(与纸质录取名册字段一致)
|
* 导出新生录取名册(与纸质录取名册字段一致)
|
||||||
*/
|
*/
|
||||||
|
@SaCheckPermission(value = {"zsjy:enrollment:process:export", "zsjy:enrollment:process:query", "zsjy:enrollmentProcess:export", "zsjy:enrollmentStatistics:view"}, mode = SaMode.OR)
|
||||||
@Log(title = "新生录取名册", businessType = BusinessType.EXPORT)
|
@Log(title = "新生录取名册", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/exportRegister")
|
@PostMapping("/exportRegister")
|
||||||
public void exportRegister(ZsjyEnrollmentProcessBo bo, HttpServletResponse response) {
|
public void exportRegister(ZsjyEnrollmentProcessBo bo, HttpServletResponse response) {
|
||||||
|
|||||||
+5
-4
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.zsjy.service.impl;
|
package org.dromara.zsjy.service.impl;
|
||||||
|
|
||||||
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
@@ -156,7 +157,7 @@ public class ZsjyInternshipDailyServiceImpl implements IZsjyInternshipDailyServi
|
|||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("学生签到失败: {}", e.getMessage(), e);
|
log.error("学生签到失败: {}", e.getMessage(), e);
|
||||||
return R.fail("签到失败: " + e.getMessage());
|
return R.fail("签到失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +187,7 @@ public class ZsjyInternshipDailyServiceImpl implements IZsjyInternshipDailyServi
|
|||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取考勤日历数据失败: {}", e.getMessage(), e);
|
log.error("获取考勤日历数据失败: {}", e.getMessage(), e);
|
||||||
return R.fail("获取考勤日历数据失败: " + e.getMessage());
|
return R.fail("获取考勤日历数据失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +213,7 @@ public class ZsjyInternshipDailyServiceImpl implements IZsjyInternshipDailyServi
|
|||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取考勤统计数据失败: {}", e.getMessage(), e);
|
log.error("获取考勤统计数据失败: {}", e.getMessage(), e);
|
||||||
return R.fail("获取考勤统计数据失败: " + e.getMessage());
|
return R.fail("获取考勤统计数据失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +261,7 @@ public class ZsjyInternshipDailyServiceImpl implements IZsjyInternshipDailyServi
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取学生月度统计数据失败: studentId={}, year={}, month={}, error={}",
|
log.error("获取学生月度统计数据失败: studentId={}, year={}, month={}, error={}",
|
||||||
studentId, year, month, e.getMessage(), e);
|
studentId, year, month, e.getMessage(), e);
|
||||||
return R.fail("获取学生月度统计数据失败: " + e.getMessage());
|
return R.fail("获取学生月度统计数据失败: " + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
-- =============================================================================
|
||||||
|
-- 重置学生密码:菜单 + 按钮权限
|
||||||
|
-- 日期:2026-10-26
|
||||||
|
-- 父菜单:学生管理 (1959499382894141441)
|
||||||
|
-- Web 页面:xg/xsjcxx/studentMsg/studentPwdReset/index
|
||||||
|
-- 移动端首页入口权限:student:pwdreset:listapp
|
||||||
|
-- 重置后返回随机临时密码(仅显示一次),并踢出该学生已登录会话
|
||||||
|
-- 执行:开发/生产库均可幂等执行;执行后给角色勾选菜单或跑下方角色授权段
|
||||||
|
-- =============================================================================
|
||||||
|
|
||||||
|
-- 1. 菜单页(学生管理下级)
|
||||||
|
INSERT INTO `sys_menu` (
|
||||||
|
`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
|
||||||
|
`is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`,
|
||||||
|
`create_dept`, `create_by`, `create_time`, `remark`
|
||||||
|
)
|
||||||
|
SELECT 2026102610000000101, '重置学生密码', 1959499382894141441, 16, 'studentPwdReset',
|
||||||
|
'xg/xsjcxx/studentMsg/studentPwdReset/index', NULL,
|
||||||
|
1, 0, 'C', '0', '0', 'studentMsg:studentPwdReset:list', 'password',
|
||||||
|
103, 1, NOW(), '按学号查询并重置学生登录密码'
|
||||||
|
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `menu_id` = 2026102610000000101);
|
||||||
|
|
||||||
|
-- 2. 按钮:查询
|
||||||
|
INSERT INTO `sys_menu` (
|
||||||
|
`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
|
||||||
|
`is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`,
|
||||||
|
`create_dept`, `create_by`, `create_time`, `remark`
|
||||||
|
)
|
||||||
|
SELECT 2026102610000000102, '查询学生', 2026102610000000101, 1, '#', '', NULL,
|
||||||
|
1, 0, 'F', '0', '0', 'studentMsg:studentPwdReset:query', '#',
|
||||||
|
103, 1, NOW(), '按学号查询学生信息'
|
||||||
|
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `menu_id` = 2026102610000000102);
|
||||||
|
|
||||||
|
-- 3. 按钮:重置密码
|
||||||
|
INSERT INTO `sys_menu` (
|
||||||
|
`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
|
||||||
|
`is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`,
|
||||||
|
`create_dept`, `create_by`, `create_time`, `remark`
|
||||||
|
)
|
||||||
|
SELECT 2026102610000000103, '确认重置', 2026102610000000101, 2, '#', '', NULL,
|
||||||
|
1, 0, 'F', '0', '0', 'studentMsg:studentPwdReset:reset', '#',
|
||||||
|
103, 1, NOW(), '确认重置学生密码'
|
||||||
|
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `menu_id` = 2026102610000000103);
|
||||||
|
|
||||||
|
-- 4. 移动端首页入口权限(挂在同一菜单页下,供 hasPermi 控制入口可见)
|
||||||
|
INSERT INTO `sys_menu` (
|
||||||
|
`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
|
||||||
|
`is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`,
|
||||||
|
`create_dept`, `create_by`, `create_time`, `remark`
|
||||||
|
)
|
||||||
|
SELECT 2026102610000000104, '重置学生密码(移动端)', 2026102610000000101, 3, '', '', NULL,
|
||||||
|
1, 0, 'F', '0', '0', 'student:pwdreset:listapp', '#',
|
||||||
|
103, 1, NOW(), '移动端首页入口权限'
|
||||||
|
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `menu_id` = 2026102610000000104);
|
||||||
|
|
||||||
|
-- 5. 给已有「学生信息」菜单权限的角色补授权(幂等)
|
||||||
|
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
|
||||||
|
SELECT DISTINCT rm.role_id, m.menu_id
|
||||||
|
FROM `sys_role_menu` rm
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT 2026102610000000101 AS menu_id UNION ALL
|
||||||
|
SELECT 2026102610000000102 UNION ALL
|
||||||
|
SELECT 2026102610000000103 UNION ALL
|
||||||
|
SELECT 2026102610000000104
|
||||||
|
) m
|
||||||
|
WHERE rm.menu_id = 1948289114628902914
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM `sys_role_menu` x
|
||||||
|
WHERE x.role_id = rm.role_id AND x.menu_id = m.menu_id
|
||||||
|
);
|
||||||
|
|
||||||
|
-- 核对
|
||||||
|
SELECT menu_id, menu_name, parent_id, path, component, perms, menu_type
|
||||||
|
FROM sys_menu
|
||||||
|
WHERE menu_id BETWEEN 2026102610000000101 AND 2026102610000000104
|
||||||
|
ORDER BY menu_id;
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
-- =============================================================================
|
||||||
|
-- 工作流管理类接口权限按钮(安全整改:流程定义/实例/全部待办接口原先仅校验登录)
|
||||||
|
-- 日期:2026-10-26
|
||||||
|
-- 挂载菜单:流程定义(11620)、流程实例(11621)、待办任务(11631)
|
||||||
|
-- 授权方式:给已拥有对应菜单的角色补授权,不改变现有可见范围
|
||||||
|
-- 执行后需要相关用户重新登录(或清理 Redis 中的登录缓存)权限才会生效
|
||||||
|
-- 执行:开发/生产库均可幂等执行
|
||||||
|
-- =============================================================================
|
||||||
|
|
||||||
|
INSERT INTO `sys_menu` (
|
||||||
|
`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
|
||||||
|
`is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`,
|
||||||
|
`create_dept`, `create_by`, `create_time`, `remark`
|
||||||
|
)
|
||||||
|
SELECT t.menu_id, t.menu_name, t.parent_id, t.order_num, '#', '', NULL,
|
||||||
|
1, 0, 'F', '0', '0', t.perms, '#', 103, 1, NOW(), t.remark
|
||||||
|
FROM (
|
||||||
|
SELECT 2026102620000000101 AS menu_id, '流程定义查询' AS menu_name, 11620 AS parent_id, 1 AS order_num,
|
||||||
|
'workflow:definition:list' AS perms, '流程定义列表/详情/设计器读取' AS remark
|
||||||
|
UNION ALL
|
||||||
|
SELECT 2026102620000000102, '流程定义维护', 11620, 2,
|
||||||
|
'workflow:definition:edit', '流程定义新增/修改/发布/导入/删除/设计器保存'
|
||||||
|
UNION ALL
|
||||||
|
SELECT 2026102620000000103, '流程实例管理', 11621, 1,
|
||||||
|
'workflow:instance:manage', '全部实例查询/作废/挂起/变量/删除他人实例/撤销他人流程'
|
||||||
|
UNION ALL
|
||||||
|
SELECT 2026102620000000104, '全部待办管理', 11631, 1,
|
||||||
|
'workflow:task:manage', '全部待办/已办查询与修改办理人'
|
||||||
|
) t
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` m WHERE m.menu_id = t.menu_id);
|
||||||
|
|
||||||
|
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
|
||||||
|
SELECT DISTINCT rm.role_id, m.menu_id
|
||||||
|
FROM `sys_role_menu` rm
|
||||||
|
JOIN (
|
||||||
|
SELECT 11620 AS parent_id, 2026102620000000101 AS menu_id UNION ALL
|
||||||
|
SELECT 11620, 2026102620000000102 UNION ALL
|
||||||
|
SELECT 11621, 2026102620000000103 UNION ALL
|
||||||
|
SELECT 11631, 2026102620000000104
|
||||||
|
) m ON rm.menu_id = m.parent_id
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT 1 FROM `sys_role_menu` x WHERE x.role_id = rm.role_id AND x.menu_id = m.menu_id
|
||||||
|
);
|
||||||
|
|
||||||
|
-- 核对:哪些角色拿到了工作流管理权限(应只有管理员类角色)
|
||||||
|
SELECT r.role_id, r.role_key, r.role_name, m.perms
|
||||||
|
FROM sys_role_menu rm
|
||||||
|
JOIN sys_role r ON r.role_id = rm.role_id
|
||||||
|
JOIN sys_menu m ON m.menu_id = rm.menu_id
|
||||||
|
WHERE m.menu_id BETWEEN 2026102620000000101 AND 2026102620000000104
|
||||||
|
ORDER BY r.role_id, m.perms;
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
-- =============================================================================
|
||||||
|
-- 2026-11-13 教师反馈整改
|
||||||
|
-- 1. 违纪来源增加「学生处分」
|
||||||
|
-- 2. 在违纪处分记录菜单下增加「学生处分」页面,并授权给已有该菜单的角色
|
||||||
|
-- 处分种类由后端按编码自动补齐,本脚本不写死类型数据
|
||||||
|
-- 执行后相关用户需重新登录
|
||||||
|
-- =============================================================================
|
||||||
|
|
||||||
|
INSERT INTO `sys_dict_data` (
|
||||||
|
`dict_code`, `tenant_id`, `dict_sort`, `dict_label`, `dict_value`,
|
||||||
|
`dict_type`, `css_class`, `list_class`, `is_default`,
|
||||||
|
`create_dept`, `create_by`, `create_time`, `remark`
|
||||||
|
)
|
||||||
|
SELECT 2026111310010000001, '000000', 3, '学生处分', '3', 'xskh_violation_source', '', 'warning', 'N',
|
||||||
|
103, 1, NOW(), '学生处分。警告4、严重警告5、记过8、留校察看10计入班级月扣分;开除学籍记0分'
|
||||||
|
FROM DUAL
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT 1 FROM `sys_dict_data` WHERE `dict_type` = 'xskh_violation_source' AND `dict_value` = '3'
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO `sys_menu` (
|
||||||
|
`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
|
||||||
|
`is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`,
|
||||||
|
`create_dept`, `create_by`, `create_time`, `remark`
|
||||||
|
)
|
||||||
|
SELECT 2026111310010000101, '学生处分', parent.menu_id, 8, 'studentPunishment', 'xskh/studentPunishment/index', NULL,
|
||||||
|
1, 0, 'C', '0', '0', 'disciplineRecord:disciplineRecord:list', 'form',
|
||||||
|
103, 1, NOW(), '学生处分登记。分值进入班主任考核班级月扣分,开除学籍不计分'
|
||||||
|
FROM `sys_menu` parent
|
||||||
|
WHERE parent.perms = 'disciplineRecord:disciplineRecord:list'
|
||||||
|
AND parent.menu_type = 'C'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `menu_id` = 2026111310010000101)
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
|
||||||
|
SELECT DISTINCT rm.role_id, 2026111310010000101
|
||||||
|
FROM `sys_role_menu` rm
|
||||||
|
JOIN `sys_menu` parent ON parent.menu_id = rm.menu_id
|
||||||
|
WHERE parent.perms = 'disciplineRecord:disciplineRecord:list'
|
||||||
|
AND parent.menu_type = 'C'
|
||||||
|
AND EXISTS (SELECT 1 FROM `sys_menu` WHERE `menu_id` = 2026111310010000101)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM `sys_role_menu` owned
|
||||||
|
WHERE owned.role_id = rm.role_id AND owned.menu_id = 2026111310010000101
|
||||||
|
);
|
||||||
@@ -1,18 +1,19 @@
|
|||||||
# 杭州第一技师 — Drone Tag 三端打包设计
|
# 杭州第一技师 — Drone Tag 打包设计
|
||||||
|
|
||||||
## 背景
|
## 背景
|
||||||
|
|
||||||
在测试机既有 Gogs + Drone(`101.35.245.122:18088`)上,为仓库 `hzdyjs-xg/all-project` 增加 **仅 tag 触发** 的自动打包,产出后端 / Web / 移动端 H5 三份独立产物,并复用宿主机 Maven 本地仓库以加速 Java 构建。
|
在测试机既有 Gogs + Drone(`101.35.245.122:18088`)上,为仓库 `hzdyjs-xg/all-project` 增加 **仅 tag 触发** 的自动打包。因测试机约 3.6G 内存不足以完成 web Vite 生产构建(实测约 36 分钟后 OOM),**CI 当前只打包 backend + mobile-h5**;web 暂缓,后续另议。
|
||||||
|
|
||||||
## 目标
|
## 目标
|
||||||
|
|
||||||
- Push Git tag → 自动顺序构建三端并落盘
|
- Push Git tag → 自动顺序构建 backend、mobile-h5 并落盘
|
||||||
- 产物可按 tag 并存,便于回溯
|
- 产物可按 tag 并存,便于回溯
|
||||||
- Maven 依赖缓存在宿主机,不因容器销毁而丢失
|
- Maven 依赖缓存在宿主机,不因容器销毁而丢失
|
||||||
|
|
||||||
## 非目标
|
## 非目标
|
||||||
|
|
||||||
- 不自动部署到业务机
|
- 不自动部署到业务机
|
||||||
|
- CI 暂不打包 web(可本地 `npm run build:prod` / `build:ci`)
|
||||||
- 不打微信小程序(`build:mp-weixin`);移动端按 `pnpm run build`(H5)
|
- 不打微信小程序(`build:mp-weixin`);移动端按 `pnpm run build`(H5)
|
||||||
- 不合成单一总包
|
- 不合成单一总包
|
||||||
|
|
||||||
@@ -30,7 +31,6 @@
|
|||||||
```
|
```
|
||||||
/root/hzdyjs-releases/<tag>/
|
/root/hzdyjs-releases/<tag>/
|
||||||
backend-<tag>.jar
|
backend-<tag>.jar
|
||||||
web-<tag>.tar.gz
|
|
||||||
mobile-h5-<tag>.tar.gz
|
mobile-h5-<tag>.tar.gz
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -42,13 +42,9 @@
|
|||||||
`mvn clean package -Pprod -Dmaven.test.skip=true -Dmaven.compiler.parameters=true -Dmaven.repo.local=/maven-repo`
|
`mvn clean package -Pprod -Dmaven.test.skip=true -Dmaven.compiler.parameters=true -Dmaven.repo.local=/maven-repo`
|
||||||
源文件:`backend/ruoyi-admin/target/ruoyi-admin.jar` → `backend-<tag>.jar`
|
源文件:`backend/ruoyi-admin/target/ruoyi-admin.jar` → `backend-<tag>.jar`
|
||||||
|
|
||||||
2. **web**(`node:20-bookworm`)
|
2. **mobile**(`node:20-bookworm` + corepack/pnpm)
|
||||||
`npm install` → `npm run build:prod`
|
`pnpm install --frozen-lockfile`(仓库纳入 `mobile/pnpm-lock.yaml`;无效 `pnpm-workspace.yaml` 已删除)
|
||||||
(`web/package-lock.json` 被 gitignore,仓库无 lock,不能用 `npm ci`)
|
→ `pnpm run build`(H5);CI 设置 `PUPPETEER_SKIP_DOWNLOAD=1`
|
||||||
打包 `web/dist` → `web-<tag>.tar.gz`
|
|
||||||
|
|
||||||
3. **mobile**(`node:20-bookworm` + corepack/pnpm)
|
|
||||||
`pnpm install --frozen-lockfile` → `pnpm run build`(即 H5)
|
|
||||||
打包 `mobile/dist/build/h5` → `mobile-h5-<tag>.tar.gz`
|
打包 `mobile/dist/build/h5` → `mobile-h5-<tag>.tar.gz`
|
||||||
|
|
||||||
## Maven 公共缓存
|
## Maven 公共缓存
|
||||||
@@ -72,11 +68,11 @@
|
|||||||
|
|
||||||
## 失败策略
|
## 失败策略
|
||||||
|
|
||||||
任一步失败则整次构建失败;不部分覆盖同 tag 目录中已有文件以外的内容时,实现上可先 `mkdir -p` 再逐步写入——若中途失败,该 tag 目录可能不完整,以 Drone 构建状态为准。
|
任一步失败则整次构建失败;实现上可先 `mkdir -p` 再逐步写入——若中途失败,该 tag 目录可能不完整,以 Drone 构建状态为准。
|
||||||
|
|
||||||
## 验收
|
## 验收
|
||||||
|
|
||||||
1. 推送测试 tag(如 `ci-pkg-test-YYYYMMDDHHMM`)
|
1. 推送测试 tag(如 `ci-pkg-test-YYYYMMDDHHMM`)
|
||||||
2. Drone 构建 success
|
2. Drone 构建 success
|
||||||
3. 三文件均存在于 `/root/hzdyjs-releases/<tag>/`,且 jar/tar 非空
|
3. `backend-*.jar` 与 `mobile-h5-*.tar.gz` 均存在于 `/root/hzdyjs-releases/<tag>/`,且非空(无 web 包)
|
||||||
4. 第二次同仓库构建时 Maven 日志出现大量依赖来自本地仓库(明显快于首次)
|
4. 第二次同仓库构建时 Maven 日志出现大量依赖来自本地仓库(明显快于首次)
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
# 2026-11-13 教师反馈整改说明
|
||||||
|
|
||||||
|
## 假期留宿
|
||||||
|
|
||||||
|
学生和管理员只选日期。保存时开始日写成当天 08:00:00,结束日写成最后一晚的次日 08:00:00。已经是次日 08:00:00 的记录再次保存时不再加一天。待审、已通过可以按寝室号搜索,列表按开始日期升序。
|
||||||
|
|
||||||
|
## 寝室点名
|
||||||
|
|
||||||
|
同一校区同一天共用一个批次,格式 `RC{yyyyMMdd}C{校区ID}`。未传校区时今日汇总返回空,不汇总全校。请假和假期留宿同时显示;请假结束时刻落在 20:30–24:00 或 00:00–05:00 时,床位用橙色标出预计返寝时间。
|
||||||
|
|
||||||
|
## 纪律卫生
|
||||||
|
|
||||||
|
扣分项按类型说明前缀分成卫生、纪律、重大违纪,其余归入其他。分值按 0.5 分一档。每项可填写说明,提醒按钮展示类型规则。
|
||||||
|
|
||||||
|
教官查看当天请假使用:
|
||||||
|
|
||||||
|
`GET /studentLeave/studentLeave/queryByCheckDay?studentIds=&checkDate=`
|
||||||
|
|
||||||
|
返回学生 ID 到请假列表。权限与请假查询、宿舍检查、宿舍点名任一满足即可。床位是否锁定为请假仍按检查时刻是否落在请假区间内判断,不把当天已结束的请假算成当前请假。
|
||||||
|
|
||||||
|
## 请假待办
|
||||||
|
|
||||||
|
移动端从我的待办办理完成后回到待办列表。我的已办搜索词同时匹配流程名称、学生姓名、学号,销假同样适用。
|
||||||
|
|
||||||
|
## 学生处分
|
||||||
|
|
||||||
|
与日常违纪扣分分开。固定种类和分值:警告 4、严重警告 5、记过 8、留校察看 10、开除学籍 0。开除学籍仍登记人次,不计入班级月扣分。其余分值写入 `xskh_discipline_record`,`violation_source=3`、状态生效,由班主任考核现有的班级月扣分汇总计入。
|
||||||
|
|
||||||
|
| 方法 | 路径 | 说明 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| GET | `/disciplineRecord/disciplineRecord/punishment/options` | 处分种类 |
|
||||||
|
| POST | `/disciplineRecord/disciplineRecord/punishment` | 登记。必填学生、种类编码、原因;班级从学生信息带出 |
|
||||||
|
| GET | `/disciplineRecord/disciplineRecord/punishment/summary` | 按种类、按班级汇总人次和扣分 |
|
||||||
|
| POST | `/disciplineRecord/disciplineRecord/punishment/export` | 导出登记表 |
|
||||||
|
| POST | `/disciplineRecord/disciplineRecord/punishment/exportSummary` | 导出汇总表 |
|
||||||
|
|
||||||
|
列表沿用 `/disciplineRecord/disciplineRecord/list`,筛选 `violationSource=3`。
|
||||||
|
|
||||||
|
上线时执行 `backend/script/sql/update/update_20261113_feedback_rectify.sql`,然后重启后端。已登录用户需要重新登录后才能看到新菜单。
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
## API模块列表
|
## API模块列表
|
||||||
- [学生信息管理API](./学生信息管理API.md)
|
- [学生信息管理API](./学生信息管理API.md)
|
||||||
|
- [学生密码重置API](./学生密码重置API.md) - **新增**:按学号查询并重置学生登录密码为固定默认值(2026-10-26)
|
||||||
- [学生信息收集批次管理API](./学生信息收集批次管理API.md)
|
- [学生信息收集批次管理API](./学生信息收集批次管理API.md)
|
||||||
- [学生信息收集批次API](./学生信息收集批次API.md) - **重要更新**:修改列表排序方式为按创建时间倒序(2025-01-03)
|
- [学生信息收集批次API](./学生信息收集批次API.md) - **重要更新**:修改列表排序方式为按创建时间倒序(2025-01-03)
|
||||||
- [班级信息管理API](./班级信息管理API.md)
|
- [班级信息管理API](./班级信息管理API.md)
|
||||||
@@ -182,6 +183,7 @@
|
|||||||
| [班级教师关联管理API](./班级教师关联管理API.md) | 班主任辅导员关联关系 | ✅ 完成 | 2025-01-27 |
|
| [班级教师关联管理API](./班级教师关联管理API.md) | 班主任辅导员关联关系 | ✅ 完成 | 2025-01-27 |
|
||||||
| [班主任班级宿舍情况查看API](./班主任班级宿舍情况查看API.md) | 班主任只读查看本班宿舍违纪与点名 | ✅ 完成 | 2026-06-23 |
|
| [班主任班级宿舍情况查看API](./班主任班级宿舍情况查看API.md) | 班主任只读查看本班宿舍违纪与点名 | ✅ 完成 | 2026-06-23 |
|
||||||
| **[学生考核管理系统API](./学生考核管理系统API.md)** | **学生综合素质测评、违纪处分、奖励加分管理** | **✅ 完成** | **2025-01-27** |
|
| **[学生考核管理系统API](./学生考核管理系统API.md)** | **学生综合素质测评、违纪处分、奖励加分管理** | **✅ 完成** | **2025-01-27** |
|
||||||
|
| [20261113教师反馈整改说明](./20261113教师反馈整改说明.md) | 假期留宿时间、点名批次、当天请假、学生处分 | ✅ 完成 | 2026-11-13 |
|
||||||
| **[学生考核管理系统修改方案](./学生考核管理系统API修改方案.md)** | **基于标准化违纪处分等级的系统升级方案** | **📋 方案** | **2025-01-27** |
|
| **[学生考核管理系统修改方案](./学生考核管理系统API修改方案.md)** | **基于标准化违纪处分等级的系统升级方案** | **📋 方案** | **2025-01-27** |
|
||||||
| **[学生考核管理系统数据库修改影响分析](./学生考核管理系统数据库修改影响分析.md)** | **数据库升级脚本执行的详细影响分析** | **📊 分析** | **2025-01-27** |
|
| **[学生考核管理系统数据库修改影响分析](./学生考核管理系统数据库修改影响分析.md)** | **数据库升级脚本执行的详细影响分析** | **📊 分析** | **2025-01-27** |
|
||||||
|
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
# 学生密码重置 API 接口文档
|
||||||
|
|
||||||
|
## 模块概述
|
||||||
|
|
||||||
|
**模块名称**:Student Password Reset / 学生密码重置
|
||||||
|
**基础路径**:`/studentMsg/studentMsg`
|
||||||
|
**版本**:v1.0
|
||||||
|
**负责人**:学工模块
|
||||||
|
**更新时间**:2026-10-26
|
||||||
|
|
||||||
|
### 模块功能
|
||||||
|
|
||||||
|
学工老师按学号查询学生基本信息后,一键将对应学生登录账号密码重置为服务端随机生成的临时密码(2026-10-26 安全整改:取消固定默认密码)。
|
||||||
|
**不复用** `system:user:resetPwd`,避免把系统用户管理权下放给学工老师。
|
||||||
|
|
||||||
|
**核心约束**:
|
||||||
|
- 仅允许重置 `sys_user.account_type = '2'`(学生账号)
|
||||||
|
- 要求 `user_id = xg_student_msg.id`,且 `user_name` 与学号一致(若有用户名)
|
||||||
|
- 临时密码由服务端 SecureRandom 生成(10 位,含大小写、数字、特殊字符),前端不可传入自定义密码
|
||||||
|
- 数据范围:超管、校级账号(无学院)可操作全部学生;学院账号只能查询/重置本学院(或一年级代理学院)的学生
|
||||||
|
- 重置后立即踢下线该学生的所有在线会话
|
||||||
|
- 操作日志不记录响应体,临时密码不落库日志
|
||||||
|
|
||||||
|
**临时密码**:仅在本次接口响应 `data` 中返回一次,由老师当面告知学生,学生登录后应自行修改。
|
||||||
|
|
||||||
|
### 权限说明
|
||||||
|
|
||||||
|
| 权限标识 | 说明 |
|
||||||
|
| -------- | ---- |
|
||||||
|
| `studentMsg:studentPwdReset:list` | Web 菜单页可见 |
|
||||||
|
| `studentMsg:studentPwdReset:query` | 按学号查询 |
|
||||||
|
| `studentMsg:studentPwdReset:reset` | 确认重置密码 |
|
||||||
|
| `student:pwdreset:listapp` | 移动端首页入口可见 |
|
||||||
|
|
||||||
|
菜单脚本:`backend/script/sql/update/update_20261026_student_pwd_reset_menu.sql`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 接口概览
|
||||||
|
|
||||||
|
| 接口名称 | HTTP 方法 | 路径 | 权限要求 | 功能描述 |
|
||||||
|
| -------- | --------- | ---- | -------- | -------- |
|
||||||
|
| 按学号查询学生 | GET | `/studentMsg/studentMsg/queryByStudentNo/{studentNo}` | `studentMsg:studentPwdReset:query` | 返回姓名、学号、班级、班主任 |
|
||||||
|
| 重置学生密码 | PUT | `/studentMsg/studentMsg/resetStudentPassword/{studentNo}` | `studentMsg:studentPwdReset:reset` | 重置为随机临时密码 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 详细接口说明
|
||||||
|
|
||||||
|
### 1. 按学号查询学生(重置密码页)
|
||||||
|
|
||||||
|
- **接口路径**:`GET /studentMsg/studentMsg/queryByStudentNo/{studentNo}`
|
||||||
|
- **权限标识**:`studentMsg:studentPwdReset:query`
|
||||||
|
- **功能描述**:按学号查询学生档案,用于重置前确认身份;班主任姓名优先取学生档案,为空时回退班级表
|
||||||
|
|
||||||
|
#### 路径参数
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必填 | 说明 |
|
||||||
|
| ------ | ---- | ---- | ---- |
|
||||||
|
| studentNo | string | 是 | 学号 |
|
||||||
|
|
||||||
|
#### 成功响应
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"code": 200,
|
||||||
|
"msg": "操作成功",
|
||||||
|
"data": {
|
||||||
|
"id": 1234567890123456789,
|
||||||
|
"studentNo": "202513063048",
|
||||||
|
"name": "张三",
|
||||||
|
"className": "计应2401",
|
||||||
|
"classTeacherName": "李老师"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 错误场景
|
||||||
|
|
||||||
|
| 场景 | 提示 |
|
||||||
|
| ---- | ---- |
|
||||||
|
| 学号为空 | 学号不能为空 |
|
||||||
|
| 学号不存在 | 未找到学号对应的学生信息 |
|
||||||
|
| 无权限 | 403 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2. 重置学生密码
|
||||||
|
|
||||||
|
- **接口路径**:`PUT /studentMsg/studentMsg/resetStudentPassword/{studentNo}`
|
||||||
|
- **权限标识**:`studentMsg:studentPwdReset:reset`
|
||||||
|
- **功能描述**:将学号对应学生登录密码重置为随机临时密码并踢下线;写操作日志「重置学生密码」(不记录响应)
|
||||||
|
- **防重复提交**:`@RepeatSubmit`
|
||||||
|
|
||||||
|
#### 路径参数
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必填 | 说明 |
|
||||||
|
| ------ | ---- | ---- | ---- |
|
||||||
|
| studentNo | string | 是 | 学号 |
|
||||||
|
|
||||||
|
#### 请求体
|
||||||
|
|
||||||
|
无。临时密码由服务端随机生成并 BCrypt 后写入,不允许客户端传密。
|
||||||
|
|
||||||
|
#### 成功响应
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"code": 200,
|
||||||
|
"msg": "操作成功",
|
||||||
|
"data": "Abcdef@123"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 错误场景
|
||||||
|
|
||||||
|
| 场景 | 提示 |
|
||||||
|
| ---- | ---- |
|
||||||
|
| 学号不存在 | 未找到学号对应的学生信息 |
|
||||||
|
| 无登录账号 | 该学生没有登录账号,无法重置密码 |
|
||||||
|
| 非学生账号 | 该账号不是学生账号,禁止重置 |
|
||||||
|
| 学号与登录名不一致 | 学号与登录账号不一致,请联系管理员 |
|
||||||
|
| 非本学院学生 | 只能操作本学院的学生 |
|
||||||
|
| 无权限 | 403 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 前端与移动端
|
||||||
|
|
||||||
|
| 端 | 路径 / 入口 |
|
||||||
|
| -- | ----------- |
|
||||||
|
| Web | `web/src/views/xg/xsjcxx/studentMsg/studentPwdReset/index.vue` |
|
||||||
|
| Web API | `web/src/api/xg/xsjcxx/studentMsg/studentMsg/index.ts` → `queryStudentForPwdReset` / `resetStudentPassword` |
|
||||||
|
| 移动端页面 | `mobile/src/pages/xg/xsjcxx/studentPwdReset/index.vue` |
|
||||||
|
| 移动端 API | `mobile/src/api/studentPwdReset.js` |
|
||||||
|
| 移动端首页 | 学工管理 →「重置学生密码」(`student:pwdreset:listapp`) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 验收要点
|
||||||
|
|
||||||
|
1. 有权限账号:学号查得到 → 重置成功 → 该学号可用默认密码登录
|
||||||
|
2. 无权限账号:接口 403
|
||||||
|
3. 不存在学号 / 无用户 / 非学生账号:友好错误,不改密
|
||||||
|
4. Web、移动端流程一致:输入学号 → 查询 → 确认 → 重置
|
||||||
Loaded 100 of 162 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user