fix: 完善日计划租约精度与安全配置
This commit is contained in:
@@ -3,6 +3,7 @@ package cn.code.nl.module.lms.framwork.security.config;
|
|||||||
import cn.code.nl.framework.security.config.AuthorizeRequestsCustomizer;
|
import cn.code.nl.framework.security.config.AuthorizeRequestsCustomizer;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer;
|
import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer;
|
||||||
|
|
||||||
@@ -106,7 +107,7 @@ public class SecurityConfiguration {
|
|||||||
.requestMatchers("/swagger-ui").permitAll()
|
.requestMatchers("/swagger-ui").permitAll()
|
||||||
.requestMatchers("/swagger-ui/**").permitAll();
|
.requestMatchers("/swagger-ui/**").permitAll();
|
||||||
// ERP 日计划接口使用独立令牌鉴权
|
// ERP 日计划接口使用独立令牌鉴权
|
||||||
registry.requestMatchers("/lms/daily-plan/erpPush").permitAll();
|
registry.requestMatchers(HttpMethod.POST, "/lms/daily-plan/erpPush").permitAll();
|
||||||
// Spring Boot Actuator 的安全配置
|
// Spring Boot Actuator 的安全配置
|
||||||
registry.requestMatchers("/actuator").permitAll()
|
registry.requestMatchers("/actuator").permitAll()
|
||||||
.requestMatchers("/actuator/**").permitAll();
|
.requestMatchers("/actuator/**").permitAll();
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
UPDATE lms_daily_plan_claim
|
UPDATE lms_daily_plan_claim
|
||||||
SET claim_status = 1, active_flag = NULL, confirmed_time = NOW(), updater = #{updater}, version = version + 1
|
SET claim_status = 1, active_flag = NULL, confirmed_time = NOW(), updater = #{updater}, version = version + 1
|
||||||
WHERE claim_id = #{claimId} AND version = #{version} AND claim_status = 0 AND active_flag = 1
|
WHERE claim_id = #{claimId} AND version = #{version} AND claim_status = 0 AND active_flag = 1
|
||||||
AND expire_time > NOW() AND deleted = b'0'
|
AND expire_time > NOW(6) AND deleted = b'0'
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="releaseClaim">
|
<update id="releaseClaim">
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
UPDATE lms_daily_plan_claim
|
UPDATE lms_daily_plan_claim
|
||||||
SET expire_time = #{expireTime}, updater = #{updater}, version = version + 1
|
SET expire_time = #{expireTime}, updater = #{updater}, version = version + 1
|
||||||
WHERE claim_token = #{claimToken} AND version = #{version} AND claim_status = 0 AND active_flag = 1
|
WHERE claim_token = #{claimToken} AND version = #{version} AND claim_status = 0 AND active_flag = 1
|
||||||
AND expire_time > NOW() AND deleted = b'0'
|
AND expire_time > NOW(6) AND deleted = b'0'
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="expireClaims">
|
<update id="expireClaims">
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
AND claim.tenant_id = lms_daily_plan.tenant_id
|
AND claim.tenant_id = lms_daily_plan.tenant_id
|
||||||
AND claim.strategy_type = #{strategyType}
|
AND claim.strategy_type = #{strategyType}
|
||||||
AND claim.claim_status = 0 AND claim.active_flag = 1
|
AND claim.claim_status = 0 AND claim.active_flag = 1
|
||||||
AND claim.expire_time > NOW() AND claim.deleted = b'0'
|
AND claim.expire_time > NOW(6) AND claim.deleted = b'0'
|
||||||
)
|
)
|
||||||
FOR UPDATE
|
FOR UPDATE
|
||||||
</select>
|
</select>
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
WHERE claim.daily_plan_id = lms_daily_plan.daily_plan_id
|
WHERE claim.daily_plan_id = lms_daily_plan.daily_plan_id
|
||||||
AND claim.tenant_id = lms_daily_plan.tenant_id
|
AND claim.tenant_id = lms_daily_plan.tenant_id
|
||||||
AND claim.strategy_type = 1 AND claim.claim_status = 0
|
AND claim.strategy_type = 1 AND claim.claim_status = 0
|
||||||
AND claim.active_flag = 1 AND claim.expire_time > NOW() AND claim.deleted = b'0'
|
AND claim.active_flag = 1 AND claim.expire_time > NOW(6) AND claim.deleted = b'0'
|
||||||
)
|
)
|
||||||
ORDER BY sort_seq ASC, daily_plan_id ASC
|
ORDER BY sort_seq ASC, daily_plan_id ASC
|
||||||
</select>
|
</select>
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
WHERE claim.daily_plan_id = lms_daily_plan.daily_plan_id
|
WHERE claim.daily_plan_id = lms_daily_plan.daily_plan_id
|
||||||
AND claim.tenant_id = lms_daily_plan.tenant_id
|
AND claim.tenant_id = lms_daily_plan.tenant_id
|
||||||
AND claim.strategy_type = 2 AND claim.claim_status = 0
|
AND claim.strategy_type = 2 AND claim.claim_status = 0
|
||||||
AND claim.active_flag = 1 AND claim.expire_time > NOW() AND claim.deleted = b'0'
|
AND claim.active_flag = 1 AND claim.expire_time > NOW(6) AND claim.deleted = b'0'
|
||||||
)
|
)
|
||||||
ORDER BY sort_seq ASC, daily_plan_id ASC
|
ORDER BY sort_seq ASC, daily_plan_id ASC
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ CREATE TABLE IF NOT EXISTS `lms_daily_plan_claim` (
|
|||||||
`version` int NOT NULL DEFAULT 0 COMMENT '领取乐观锁版本号',
|
`version` int NOT NULL DEFAULT 0 COMMENT '领取乐观锁版本号',
|
||||||
`claim_status` tinyint NOT NULL DEFAULT 0 COMMENT '领取状态:0执行中,1已确认,2已释放,3已过期',
|
`claim_status` tinyint NOT NULL DEFAULT 0 COMMENT '领取状态:0执行中,1已确认,2已释放,3已过期',
|
||||||
`active_flag` tinyint DEFAULT 1 COMMENT '有效领取唯一标记,终态置空',
|
`active_flag` tinyint DEFAULT 1 COMMENT '有效领取唯一标记,终态置空',
|
||||||
`expire_time` datetime NOT NULL COMMENT '租约过期时间',
|
`expire_time` datetime(6) NOT NULL COMMENT '租约过期时间',
|
||||||
`confirmed_time` datetime DEFAULT NULL COMMENT '确认时间',
|
`confirmed_time` datetime DEFAULT NULL COMMENT '确认时间',
|
||||||
`operator` varchar(64) NOT NULL COMMENT '领取人/执行器',
|
`operator` varchar(64) NOT NULL COMMENT '领取人/执行器',
|
||||||
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
|
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
|
||||||
@@ -98,7 +98,8 @@ CREATE TABLE IF NOT EXISTS `lms_daily_plan_operation_log` (
|
|||||||
`operation_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间',
|
`operation_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间',
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
PRIMARY KEY (`operation_log_id`)
|
PRIMARY KEY (`operation_log_id`),
|
||||||
|
KEY `idx_plan_operation_time` (`tenant_id`, `daily_plan_id`, `deleted`, `operation_time`)
|
||||||
) COMMENT='LMS日计划操作日志';
|
) COMMENT='LMS日计划操作日志';
|
||||||
|
|
||||||
-- 兼容已执行过旧版脚本的数据库,幂等补充候选组合索引。
|
-- 兼容已执行过旧版脚本的数据库,幂等补充候选组合索引。
|
||||||
@@ -113,6 +114,23 @@ SET @lms_daily_plan_ddl = IF(
|
|||||||
PREPARE lms_daily_plan_stmt FROM @lms_daily_plan_ddl;
|
PREPARE lms_daily_plan_stmt FROM @lms_daily_plan_ddl;
|
||||||
EXECUTE lms_daily_plan_stmt;
|
EXECUTE lms_daily_plan_stmt;
|
||||||
DEALLOCATE PREPARE lms_daily_plan_stmt;
|
DEALLOCATE PREPARE lms_daily_plan_stmt;
|
||||||
|
SET @lms_daily_plan_ddl = IF(
|
||||||
|
EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = 'lms_daily_plan_claim' AND column_name = 'expire_time'
|
||||||
|
AND datetime_precision = 6),
|
||||||
|
'SELECT 1',
|
||||||
|
'ALTER TABLE lms_daily_plan_claim MODIFY COLUMN expire_time DATETIME(6) NOT NULL COMMENT ''租约过期时间''');
|
||||||
|
PREPARE lms_daily_plan_stmt FROM @lms_daily_plan_ddl;
|
||||||
|
EXECUTE lms_daily_plan_stmt;
|
||||||
|
DEALLOCATE PREPARE lms_daily_plan_stmt;
|
||||||
|
SET @lms_daily_plan_ddl = IF(
|
||||||
|
EXISTS (SELECT 1 FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = 'lms_daily_plan_operation_log' AND index_name = 'idx_plan_operation_time'),
|
||||||
|
'SELECT 1',
|
||||||
|
'ALTER TABLE lms_daily_plan_operation_log ADD INDEX idx_plan_operation_time (tenant_id, daily_plan_id, deleted, operation_time)');
|
||||||
|
PREPARE lms_daily_plan_stmt FROM @lms_daily_plan_ddl;
|
||||||
|
EXECUTE lms_daily_plan_stmt;
|
||||||
|
DEALLOCATE PREPARE lms_daily_plan_stmt;
|
||||||
SET @lms_daily_plan_ddl = IF(
|
SET @lms_daily_plan_ddl = IF(
|
||||||
EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = DATABASE()
|
EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = DATABASE()
|
||||||
AND table_name = 'lms_daily_plan_claim' AND column_name = 'progress_qty'),
|
AND table_name = 'lms_daily_plan_claim' AND column_name = 'progress_qty'),
|
||||||
|
|||||||
Reference in New Issue
Block a user