fix: 审核列表与申报可见性,并统一 Docker 北京时区
修复团支部等角色待审漏数、PageParam 对 Collection 的 IN 条件失效,以及容器默认 UTC 导致时间偏移 8 小时的问题。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
FROM openjdk:8-jdk-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN mkdir -p /app/logs /app/uploads /app/file \
|
||||
&& apk add --no-cache tzdata \
|
||||
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
||||
&& echo "Asia/Shanghai" > /etc/timezone
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
ENV LANG=C.UTF-8
|
||||
ENV JAVA_OPTS="-Xms512m -Xmx1024m -Duser.timezone=Asia/Shanghai -Djava.security.egd=file:/dev/./urandom"
|
||||
ENV SPRING_PROFILES_ACTIVE=prod
|
||||
|
||||
COPY target/*.jar app.jar
|
||||
|
||||
EXPOSE 38927
|
||||
|
||||
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar app.jar"]
|
||||
@@ -0,0 +1,17 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
tuanwei-api:
|
||||
build: .
|
||||
container_name: tuanwei-api
|
||||
ports:
|
||||
- "38927:38927"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- SPRING_PROFILES_ACTIVE=prod
|
||||
- JAVA_OPTS=-Xms512m -Xmx1024m -Duser.timezone=Asia/Shanghai -Djava.security.egd=file:/dev/./urandom
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
- ./file:/app/file
|
||||
- ./uploads:/app/uploads
|
||||
restart: unless-stopped
|
||||
@@ -14,6 +14,8 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.springframework.web.socket.config.annotation.EnableWebSocket;
|
||||
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* 启动类
|
||||
* Created by WebSoft on 2018-02-22 11:29:03
|
||||
@@ -29,6 +31,8 @@ import org.springframework.web.socket.config.annotation.EnableWebSocket;
|
||||
public class WebSoftApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Docker 默认 UTC,未设置 TZ 时 LocalDateTime.now() 会比北京时间慢 8 小时
|
||||
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
|
||||
SpringApplication.run(WebSoftApplication.class, args);
|
||||
}
|
||||
|
||||
|
||||
@@ -171,6 +171,10 @@ public class BaseController {
|
||||
return;
|
||||
}
|
||||
Set<Integer> userIds = resolveScopedUserIdsByOrganization();
|
||||
// 组织树解析偶发漏掉本人时,仍保证能看到自己提交的数据
|
||||
if (loginUserId != null) {
|
||||
userIds.add(loginUserId);
|
||||
}
|
||||
if (!userIds.isEmpty()) {
|
||||
userIdsSetter.accept(userIds);
|
||||
}
|
||||
|
||||
@@ -260,10 +260,30 @@ public class PageParam<T, U extends BaseParam> extends Page<T> {
|
||||
queryWrapper.isNotNull(fieldName);
|
||||
break;
|
||||
case IN:
|
||||
queryWrapper.in(fieldName, fieldValue);
|
||||
// Collection 必须走 in(column, Collection),不能走 in(column, Object...),
|
||||
// 否则整个集合会被当成单个参数,导致 user_id IN (?) 永远匹配不到。
|
||||
if (fieldValue instanceof Collection) {
|
||||
Collection<?> coll = (Collection<?>) fieldValue;
|
||||
if (!coll.isEmpty()) {
|
||||
queryWrapper.in(fieldName, coll);
|
||||
}
|
||||
} else if (fieldValue != null && fieldValue.getClass().isArray()) {
|
||||
queryWrapper.in(fieldName, (Object[]) fieldValue);
|
||||
} else {
|
||||
queryWrapper.in(fieldName, fieldValue);
|
||||
}
|
||||
break;
|
||||
case NOT_IN:
|
||||
queryWrapper.notIn(fieldName, fieldValue);
|
||||
if (fieldValue instanceof Collection) {
|
||||
Collection<?> coll = (Collection<?>) fieldValue;
|
||||
if (!coll.isEmpty()) {
|
||||
queryWrapper.notIn(fieldName, coll);
|
||||
}
|
||||
} else if (fieldValue != null && fieldValue.getClass().isArray()) {
|
||||
queryWrapper.notIn(fieldName, (Object[]) fieldValue);
|
||||
} else {
|
||||
queryWrapper.notIn(fieldName, fieldValue);
|
||||
}
|
||||
break;
|
||||
case IN_STR:
|
||||
if (fieldValue instanceof String) {
|
||||
|
||||
@@ -170,6 +170,11 @@ public class ReviewListController extends BaseController {
|
||||
if (!isBackendAccess(param) || !hasBackendScopeRole()) {
|
||||
return;
|
||||
}
|
||||
// 已按当前审核人收敛时,不再按申报人组织过滤。
|
||||
// 否则团支部/院团委等角色会漏掉「已指派给自己、但申报人不在本组织树」的待审。
|
||||
if (param.getUserId() != null) {
|
||||
return;
|
||||
}
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser == null || loginUser.getOrganizationId() == null) {
|
||||
return;
|
||||
|
||||
@@ -264,9 +264,6 @@
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
@@ -467,6 +464,10 @@
|
||||
AND latest_group.pk = grouped.pk
|
||||
INNER JOIN gxmu_review_list latest ON latest.id = latest_group.latest_id
|
||||
<where>
|
||||
<!-- 个人审核列表只看「当前轮到我」的最新节点,避免历史参与过的流程被带出 -->
|
||||
<if test="param.userId != null">
|
||||
AND latest.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND latest.status = #{param.status}
|
||||
</if>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://1Panel-mariadb-ZOpD:3306/tuanwei?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
|
||||
url: jdbc:mysql://1Panel-mariadb-ZOpD:3306/tuanwei?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
|
||||
username: tuanwei
|
||||
password: TytQZsSW5m4wGh38
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
||||
@@ -38,7 +38,7 @@ spring:
|
||||
|
||||
# json时间格式设置
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
time-zone: Asia/Shanghai
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
|
||||
# 设置上传文件大小
|
||||
|
||||
Reference in New Issue
Block a user