feat:文件上传的功能开发

master
赵佳正 2 months ago
parent a2b539c2c3
commit e7c54403d7

@ -1,9 +1,7 @@
package com.yau.digitalrmb.identity.application;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yau.digitalrmb.identity.infrastructure.persistence.entity.PlatformUserSnapshotEntity;
import com.yau.digitalrmb.identity.infrastructure.persistence.entity.UserEntity;
import com.yau.digitalrmb.identity.infrastructure.persistence.mapper.PlatformUserSnapshotMapper;
import com.yau.digitalrmb.identity.infrastructure.persistence.mapper.UserMapper;
import com.yau.digitalrmb.platformintegration.application.VerifiedPlatformToken;
import org.springframework.security.crypto.password.PasswordEncoder;
@ -13,16 +11,17 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.UUID;
/**
* 智云单点登录的本地账户落地:把智云 token 里的用户信息同步到本系统 {@code sys_user} 主表。
* 首次登录新增一条本地用户,之后每次登录更新;学校/学院/专业/班级等平台字段一并存在 sys_user 上。
*/
@Service
public class LocalSsoAccountService {
private final UserMapper userMapper;
private final PlatformUserSnapshotMapper snapshotMapper;
private final PasswordEncoder passwordEncoder;
public LocalSsoAccountService(UserMapper userMapper, PlatformUserSnapshotMapper snapshotMapper,
PasswordEncoder passwordEncoder) {
public LocalSsoAccountService(UserMapper userMapper, PasswordEncoder passwordEncoder) {
this.userMapper = userMapper;
this.snapshotMapper = snapshotMapper;
this.passwordEncoder = passwordEncoder;
}
@ -48,6 +47,10 @@ public class LocalSsoAccountService {
user.setClassName(token.getClassName());
user.setSchoolId(token.getSchoolId());
user.setSchoolName(token.getSchoolName());
user.setCollegeId(token.getCollegeId());
user.setCollegeName(token.getCollegeName());
user.setMajorId(token.getMajorId());
user.setMajorName(token.getMajorName());
user.setRoleId(token.getRoleId());
user.setIsDeleted(false);
user.setZyUserId(token.getUserId());
@ -57,7 +60,6 @@ public class LocalSsoAccountService {
} else {
userMapper.updateById(user);
}
upsertSnapshot(user.getUserId(), token);
return user;
}
@ -69,33 +71,6 @@ public class LocalSsoAccountService {
.last("LIMIT 1"));
}
private void upsertSnapshot(String localUserId, VerifiedPlatformToken token) {
PlatformUserSnapshotEntity snapshot = snapshotMapper.selectById(localUserId);
boolean newSnapshot = snapshot == null;
if (snapshot == null) {
snapshot = new PlatformUserSnapshotEntity();
snapshot.setPlatformUserId(localUserId);
}
snapshot.setAccount(token.getUsername());
snapshot.setDisplayName(token.getDisplayName());
snapshot.setSchoolId(token.getSchoolId());
snapshot.setSchoolName(token.getSchoolName());
snapshot.setCollegeId(token.getCollegeId());
snapshot.setCollegeName(token.getCollegeName());
snapshot.setMajorId(token.getMajorId());
snapshot.setMajorName(token.getMajorName());
snapshot.setClassId(token.getClassId());
snapshot.setClassName(token.getClassName());
snapshot.setStudentId(token.getStudentId());
snapshot.setSourceUpdatedAt(LocalDateTime.now());
snapshot.setSyncedAt(LocalDateTime.now());
if (newSnapshot) {
snapshotMapper.insert(snapshot);
} else {
snapshotMapper.updateById(snapshot);
}
}
private boolean isUuid(String value) {
try {
UUID.fromString(value);

@ -1,54 +0,0 @@
package com.yau.digitalrmb.identity.infrastructure.persistence.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@TableName("platform_user_snapshot")
public class PlatformUserSnapshotEntity {
@TableId(value = "platform_user_id", type = IdType.INPUT)
private String platformUserId;
private String account;
private String displayName;
@TableField("school_id")
private String schoolId;
@TableField("school_name")
private String schoolName;
@TableField("college_id")
private String collegeId;
@TableField("college_name")
private String collegeName;
@TableField("major_id")
private String majorId;
@TableField("major_name")
private String majorName;
@TableField("class_id")
private String classId;
@TableField("class_name")
private String className;
@TableField("student_id")
private String studentId;
private LocalDateTime sourceUpdatedAt;
@TableField("synced_at")
private LocalDateTime syncedAt;
}

@ -42,6 +42,18 @@ public class UserEntity {
@TableField("school_id")
private String schoolId;
@TableField("college_id")
private String collegeId;
@TableField("college_name")
private String collegeName;
@TableField("major_id")
private String majorId;
@TableField("major_name")
private String majorName;
@TableField("authorize_time")
private LocalDate authorizeTime;

@ -1,9 +0,0 @@
package com.yau.digitalrmb.identity.infrastructure.persistence.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yau.digitalrmb.identity.infrastructure.persistence.entity.PlatformUserSnapshotEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PlatformUserSnapshotMapper extends BaseMapper<PlatformUserSnapshotEntity> {
}

@ -10,7 +10,8 @@ import org.apache.ibatis.annotations.Update;
@Mapper
public interface UserMapper extends BaseMapper<UserEntity> {
@Select("SELECT user_id, student_id, password, user_name, class_id, class_name, phone, "
+ "school_name, school_id, authorize_time, authorize_end_time, role_id, "
+ "school_name, school_id, college_id, college_name, major_id, major_name, "
+ "authorize_time, authorize_end_time, role_id, "
+ "create_time, is_deleted, zy_user_id FROM sys_user "
+ "WHERE student_id = #{studentId} AND (is_deleted = 0 OR is_deleted IS NULL) LIMIT 1")
UserEntity selectActiveByStudentId(@Param("studentId") String studentId);

@ -2,8 +2,6 @@ package com.yau.digitalrmb.platformintegration.application;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yau.digitalrmb.platformintegration.config.PlatformIntegrationProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
@ -15,20 +13,26 @@ import java.time.Clock;
import java.time.Instant;
import java.util.Base64;
/**
* 校验智云(ZhiYun)下发的 SSO JWT。
* 逻辑与 cross_training_platform 的 TokenProvider.getJWTUserByZhiYun 保持一致:
* HS256 验签、共享密钥写死为本系统对接智云的同一把密钥、解析失败直接抛异常
* (不做子系统 token 兜底)。
*/
@Component
@ConditionalOnProperty(prefix = "platform-integration", name = "enabled", havingValue = "true")
public class PlatformTokenVerifier {
private final PlatformIntegrationProperties.Token properties;
/** 智云 SSO 共享密钥,与 cross_training_platform 的 TokenProvider.SECRET_ZHIYUN 为同一把 */
private static final String ZHIYUN_SECRET = "zy_kzy_mnjy_fp76ckwuczzmb67w0a8x0";
private final ObjectMapper objectMapper;
private final Clock clock;
@Autowired
public PlatformTokenVerifier(PlatformIntegrationProperties properties) {
this(properties.getToken(), new ObjectMapper(), Clock.systemUTC());
public PlatformTokenVerifier() {
this(new ObjectMapper(), Clock.systemUTC());
}
PlatformTokenVerifier(PlatformIntegrationProperties.Token properties, ObjectMapper objectMapper, Clock clock) {
this.properties = properties;
PlatformTokenVerifier(ObjectMapper objectMapper, Clock clock) {
this.objectMapper = objectMapper;
this.clock = clock;
}
@ -49,30 +53,44 @@ public class PlatformTokenVerifier {
}
verifySignature(parts);
JsonNode payload = readJson(parts[1]);
// exp 校验(智云 token 可能不带 exp,不带则跳过)
JsonNode expiration = payload.path("exp");
if (!expiration.isMissingNode()
&& (!expiration.canConvertToLong()
|| Instant.ofEpochSecond(expiration.asLong()).compareTo(now) <= 0)) {
throw invalid();
}
String userId = requiredText(payload, "userId");
String username = requiredText(payload, "username");
String password = optionalText(payload, "password");
if (password == null) {
if (password == null || password.trim().isEmpty()) {
password = "123qwe";
}
int roleId = requiredRoleId(payload);
int roleId;
JsonNode roleNode = payload.path("roleid");
if (roleNode.isMissingNode() || !roleNode.canConvertToLong()) {
roleId = 4;
} else {
roleId = (int) roleNode.asLong();
}
String displayName = optionalText(payload, "name");
if (displayName == null || displayName.trim().isEmpty()) {
displayName = username;
}
String schoolId = optionalText(payload, "schoolId", "0");
String schoolName = optionalText(payload, "school", "schoolName");
String classId = optionalText(payload, "classId");
String className = optionalText(payload, "class");
String studentId = optionalText(payload, "studentNo", "studentId", "studentid");
String collegeId = optionalText(payload, "collegeId");
String collegeName = optionalText(payload, "collegeName", "college");
String majorId = optionalText(payload, "majorId");
String majorName = optionalText(payload, "majorName", "major");
return new VerifiedPlatformToken(userId, username, displayName, password, roleId,
optionalText(payload, "schoolId"),
optionalText(payload, "schoolName", "school"), optionalText(payload, "collegeId"),
optionalText(payload, "collegeName"), optionalText(payload, "majorId"),
optionalText(payload, "majorName", "major"), optionalText(payload, "classId"),
optionalText(payload, "className", "class"),
optionalText(payload, "studentId", "studentid", "studentNo"));
schoolId, schoolName, collegeId, collegeName, majorId, majorName, classId, className, studentId);
} catch (PlatformTokenException exception) {
throw exception;
} catch (Exception exception) {
@ -82,32 +100,25 @@ public class PlatformTokenVerifier {
private void verifySignature(String[] parts) throws Exception {
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(new SecretKeySpec(properties.getLinkSecretKey().getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
mac.init(new SecretKeySpec(ZHIYUN_SECRET.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
byte[] expected = mac.doFinal((parts[0] + "." + parts[1]).getBytes(StandardCharsets.US_ASCII));
if (!MessageDigest.isEqual(expected, Base64.getUrlDecoder().decode(parts[2]))) {
throw invalid();
}
}
private int requiredRoleId(JsonNode payload) {
long roleId = requiredLong(payload, "roleid", "roleId");
if (roleId != 1L && roleId != 3L && roleId != 4L) {
throw invalid();
}
return (int) roleId;
private JsonNode readJson(String encoded) throws Exception {
return objectMapper.readTree(Base64.getUrlDecoder().decode(encoded));
}
private JsonNode readJson(String encoded) throws Exception { return objectMapper.readTree(Base64.getUrlDecoder().decode(encoded)); }
private long requiredLong(JsonNode payload, String... names) {
for (String name : names) {
JsonNode node = payload.path(name);
if (node.canConvertToLong()) {
return node.asLong();
}
private String requiredText(JsonNode payload, String name) {
String value = optionalText(payload, name);
if (value == null) {
throw invalid();
}
throw invalid();
return value;
}
private String requiredText(JsonNode payload, String name) { String value = payload.path(name).asText(); if (value == null || value.trim().isEmpty()) throw invalid(); return value; }
private String optionalText(JsonNode payload, String... names) {
for (String name : names) {
JsonNode node = payload.path(name);
@ -120,5 +131,8 @@ public class PlatformTokenVerifier {
}
return null;
}
private PlatformTokenException invalid() { return new PlatformTokenException("平台登录凭据无效"); }
private PlatformTokenException invalid() {
return new PlatformTokenException("平台登录凭据无效");
}
}

@ -13,18 +13,9 @@ import javax.validation.constraints.NotBlank;
@Validated
@ConfigurationProperties("platform-integration")
public class PlatformIntegrationProperties {
@Valid
private Token token = new Token();
@Valid
private Frontend frontend = new Frontend();
@Getter
@Setter
public static class Token {
@NotBlank
private String linkSecretKey;
}
@Getter
@Setter
public static class Frontend {

@ -1,8 +1,6 @@
package com.yau.digitalrmb.security.application;
import com.yau.digitalrmb.identity.infrastructure.persistence.entity.PlatformUserSnapshotEntity;
import com.yau.digitalrmb.identity.infrastructure.persistence.entity.UserEntity;
import com.yau.digitalrmb.identity.infrastructure.persistence.mapper.PlatformUserSnapshotMapper;
import com.yau.digitalrmb.identity.infrastructure.persistence.mapper.UserMapper;
import com.yau.digitalrmb.security.context.AuthContextHolder;
import com.yau.digitalrmb.shared.api.ErrorCode;
@ -11,26 +9,21 @@ import org.springframework.stereotype.Service;
@Service
public class CurrentUserService {
private final PlatformUserSnapshotMapper snapshotMapper;
private final UserMapper userMapper;
public CurrentUserService(PlatformUserSnapshotMapper snapshotMapper, UserMapper userMapper) {
this.snapshotMapper = snapshotMapper;
public CurrentUserService(UserMapper userMapper) {
this.userMapper = userMapper;
}
public CurrentUser getCurrentUser() {
String userId = AuthContextHolder.get().getUserId();
UserEntity user = userMapper.selectById(userId);
PlatformUserSnapshotEntity snapshot = snapshotMapper.selectById(userId);
if (user == null || user.getRoleId() == null) {
throw unauthorized("用户身份不存在");
}
return new CurrentUser(user.getSchoolId(), user.getSchoolName(),
snapshot == null ? null : snapshot.getCollegeId(),
snapshot == null ? null : snapshot.getCollegeName(),
snapshot == null ? null : snapshot.getMajorId(),
snapshot == null ? null : snapshot.getMajorName(),
user.getCollegeId(), user.getCollegeName(),
user.getMajorId(), user.getMajorName(),
user.getRoleId().longValue(), user.getUserId(), user.getStudentId(), user.getUserName(),
user.getClassId(), user.getClassName(), user.getStudentId());
}

@ -2,9 +2,7 @@ package com.yau.digitalrmb.security.interfaces;
import com.yau.digitalrmb.identity.application.LocalSsoAccountService;
import com.yau.digitalrmb.identity.domain.UserRole;
import com.yau.digitalrmb.identity.infrastructure.persistence.entity.PlatformUserSnapshotEntity;
import com.yau.digitalrmb.identity.infrastructure.persistence.entity.UserEntity;
import com.yau.digitalrmb.identity.infrastructure.persistence.mapper.PlatformUserSnapshotMapper;
import com.yau.digitalrmb.identity.infrastructure.persistence.mapper.UserMapper;
import com.yau.digitalrmb.platformintegration.application.PlatformTokenVerifier;
import com.yau.digitalrmb.platformintegration.application.VerifiedPlatformToken;
@ -44,9 +42,6 @@ public class UserController {
@Resource
private UserMapper userMapper;
@Resource
private PlatformUserSnapshotMapper snapshotMapper;
@PostMapping("/login")
@Operation(summary = "用户登录", description = "支持账号密码登录和智云TOKEN单点登录")
public UserLoginResult<UserLoginResponse> login(
@ -82,15 +77,11 @@ public class UserController {
}
private UserLoginResult<UserLoginResponse> success(UserEntity user, JwtTokenService.Token token) {
PlatformUserSnapshotEntity snapshot = snapshotMapper.selectById(user.getUserId());
String authority = "ROLE_" + UserRole.fromId(user.getRoleId()).getAuthority();
UserLoginResponse response = new UserLoginResponse(
user.getUserId(), user.getUserName(), token.accessToken(), "Bearer", token.expiresIn(),
user.getRoleId(), user.getClassId(), user.getClassName(), user.getSchoolId(), user.getSchoolName(),
snapshot == null ? null : snapshot.getCollegeId(),
snapshot == null ? null : snapshot.getCollegeName(),
snapshot == null ? null : snapshot.getMajorId(),
snapshot == null ? null : snapshot.getMajorName(),
user.getCollegeId(), user.getCollegeName(), user.getMajorId(), user.getMajorName(),
user.getStudentId(), user.getStudentId(), Collections.singletonList(authority));
return UserLoginResult.success(response);
}

@ -14,8 +14,6 @@ knife4j:
enable: true
platform-integration:
enabled: true
token:
link-secret-key: ${DIGITAL_RMB_PLATFORM_LINK_SECRET_KEY:zy_kzy_mnjy_fp76ckwuczzmb67w0a8x0}
security:
jwt:
secret: 0123456789012345678901234567890123456789012345678901234567890123

@ -9,7 +9,5 @@ security:
secret: 0123456789012345678901234567890123456789012345678901234567890123
access-token-ttl: PT4H
platform-integration:
token:
link-secret-key: local-token-sso-test-secret-key-123456
frontend:
callback-url: https://rmb.example.edu/sso-callback

@ -40,8 +40,6 @@ springdoc:
knife4j:
enable: false
platform-integration:
token:
link-secret-key: ${DIGITAL_RMB_PLATFORM_LINK_SECRET_KEY}
frontend:
callback-url: ${DIGITAL_RMB_FRONTEND_CALLBACK_URL:http://localhost:5173/sso-callback}
institution-training:

@ -11,6 +11,10 @@ CREATE TABLE IF NOT EXISTS sys_user (
phone VARCHAR(100) NULL,
school_name VARCHAR(100) NULL,
school_id VARCHAR(36) NULL,
college_id VARCHAR(64) NULL,
college_name VARCHAR(128) NULL,
major_id VARCHAR(64) NULL,
major_name VARCHAR(128) NULL,
authorize_time DATE NULL,
authorize_end_time DATE NULL,
role_id TINYINT NULL,
@ -20,23 +24,6 @@ CREATE TABLE IF NOT EXISTS sys_user (
UNIQUE KEY uk_sys_user_student_id (student_id)
);
CREATE TABLE IF NOT EXISTS platform_user_snapshot (
platform_user_id VARCHAR(36) PRIMARY KEY,
account VARCHAR(64) NOT NULL,
display_name VARCHAR(64) NOT NULL,
source_updated_at TIMESTAMP NOT NULL,
synced_at TIMESTAMP NOT NULL,
school_id VARCHAR(64) NULL,
school_name VARCHAR(128) NULL,
college_id VARCHAR(64) NULL,
college_name VARCHAR(128) NULL,
major_id VARCHAR(64) NULL,
major_name VARCHAR(128) NULL,
class_id VARCHAR(64) NULL,
class_name VARCHAR(128) NULL,
student_id VARCHAR(64) NULL
);
CREATE TABLE IF NOT EXISTS auth_login_exchange_code (
code_hash CHAR(64) PRIMARY KEY,
platform_user_id VARCHAR(36) NOT NULL,
@ -616,22 +603,6 @@ INSERT INTO central_bank_currency_vault (currency, available_balance)
VALUES ('DC', 300000000.00)
ON DUPLICATE KEY UPDATE currency = VALUES(currency);
INSERT INTO platform_user_snapshot (
platform_user_id, account, display_name, source_updated_at, synced_at
)
VALUES (
'00000000-0000-0000-0000-000000000487',
'tzs001',
'tzs001',
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP
)
ON DUPLICATE KEY UPDATE
account = VALUES(account),
display_name = VALUES(display_name),
source_updated_at = CURRENT_TIMESTAMP,
synced_at = CURRENT_TIMESTAMP;
CREATE TABLE IF NOT EXISTS business_knowledge_category (
code VARCHAR(64) PRIMARY KEY,
name VARCHAR(128) NOT NULL,

@ -53,12 +53,13 @@ class LocalSsoAccountServiceTest {
}
@Test
void synchronizesCompleteProfileIntoLocalSnapshot() {
void synchronizesCompleteProfileIntoLocalUser() {
service.synchronize(completeToken(USER_603, "sso603", 4L));
JdbcTemplate jdbc = new JdbcTemplate(dataSource);
Map<String, Object> user = jdbc.queryForMap(
"SELECT user_id, student_id, password, user_name, class_id, class_name, school_id, school_name, "
+ "college_id, college_name, major_id, major_name, "
+ "role_id, is_deleted, zy_user_id FROM sys_user WHERE user_id = ?", USER_603);
assertThat(user).containsEntry("user_id", USER_603)
.containsEntry("student_id", "20240603")
@ -67,20 +68,15 @@ class LocalSsoAccountServiceTest {
.containsEntry("class_name", "Class 1")
.containsEntry("school_id", "610000")
.containsEntry("school_name", "Yan'an University")
.containsEntry("college_id", "100")
.containsEntry("college_name", "Computer College")
.containsEntry("major_id", "101")
.containsEntry("major_name", "Software Engineering")
.containsEntry("role_id", 4)
.containsEntry("is_deleted", 0)
.containsEntry("zy_user_id", USER_603);
String userPassword = (String) user.get("password");
assertThat(passwordEncoder.matches("password", userPassword)).isTrue();
Map<String, Object> row = jdbc.queryForMap(
"SELECT school_id, college_name, major_name, class_name, student_id "
+ "FROM platform_user_snapshot WHERE platform_user_id = ?", USER_603);
assertThat(row).containsEntry("school_id", "610000")
.containsEntry("college_name", "Computer College")
.containsEntry("major_name", "Software Engineering")
.containsEntry("class_name", "Class 1")
.containsEntry("student_id", "20240603");
}
private VerifiedPlatformToken completeToken(String userId, String username, long roleId) {

@ -1,7 +1,6 @@
package com.yau.digitalrmb.platformintegration.application;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yau.digitalrmb.platformintegration.config.PlatformIntegrationProperties;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -20,16 +19,14 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
class PlatformTokenVerifierTest {
private static final String SECRET = "local-token-sso-test-secret-key-123456";
private static final String SECRET = "zy_kzy_mnjy_fp76ckwuczzmb67w0a8x0";
private static final String USER_ID = "00000000-0000-0000-0000-000000000487";
private final Instant now = Instant.parse("2026-08-03T04:00:00Z");
private PlatformTokenVerifier verifier;
@BeforeEach
void setUp() {
PlatformIntegrationProperties.Token properties = new PlatformIntegrationProperties.Token();
properties.setLinkSecretKey(SECRET);
verifier = new PlatformTokenVerifier(properties, new ObjectMapper(), Clock.fixed(now, ZoneOffset.UTC));
verifier = new PlatformTokenVerifier(new ObjectMapper(), Clock.fixed(now, ZoneOffset.UTC));
}
@Test

@ -28,7 +28,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@AutoConfigureMockMvc
@ActiveProfiles("test")
class UserControllerTest {
private static final String SECRET = "local-token-sso-test-secret-key-123456";
private static final String SECRET = "zy_kzy_mnjy_fp76ckwuczzmb67w0a8x0";
@Autowired
private MockMvc mvc;

@ -21,11 +21,6 @@ platform-integration:
url: jdbc:h2:mem:platform_workflow;MODE=MySQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=TRUE
username: sa
password: test-password
token:
link-secret-key: local-token-sso-test-secret-key-123456
max-age: PT2M
teacher-claim-value: teacher
student-claim-value: student
cas:
login-url: https://sso.example.edu/login
validate-url: https://sso.example.edu/p3/serviceValidate

@ -8,6 +8,10 @@ CREATE TABLE IF NOT EXISTS sys_user (
phone VARCHAR(100) NULL,
school_name VARCHAR(100) NULL,
school_id VARCHAR(36) NULL,
college_id VARCHAR(64) NULL,
college_name VARCHAR(128) NULL,
major_id VARCHAR(64) NULL,
major_name VARCHAR(128) NULL,
authorize_time DATE NULL,
authorize_end_time DATE NULL,
role_id TINYINT NULL,
@ -17,23 +21,6 @@ CREATE TABLE IF NOT EXISTS sys_user (
UNIQUE KEY uk_sys_user_student_id (student_id)
);
CREATE TABLE IF NOT EXISTS platform_user_snapshot (
platform_user_id VARCHAR(36) PRIMARY KEY,
account VARCHAR(64) NOT NULL,
display_name VARCHAR(64) NOT NULL,
source_updated_at TIMESTAMP NOT NULL,
synced_at TIMESTAMP NOT NULL,
school_id VARCHAR(64) NULL,
school_name VARCHAR(128) NULL,
college_id VARCHAR(64) NULL,
college_name VARCHAR(128) NULL,
major_id VARCHAR(64) NULL,
major_name VARCHAR(128) NULL,
class_id VARCHAR(64) NULL,
class_name VARCHAR(128) NULL,
student_id VARCHAR(64) NULL
);
CREATE TABLE IF NOT EXISTS auth_login_exchange_code (
code_hash CHAR(64) PRIMARY KEY,
platform_user_id VARCHAR(36) NOT NULL,
@ -263,22 +250,6 @@ ON DUPLICATE KEY UPDATE
role_id = VALUES(role_id),
is_deleted = 0;
INSERT INTO platform_user_snapshot (
platform_user_id, account, display_name, source_updated_at, synced_at
)
VALUES (
'00000000-0000-0000-0000-000000000487',
'tzs001',
'tzs001',
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP
)
ON DUPLICATE KEY UPDATE
account = VALUES(account),
display_name = VALUES(display_name),
source_updated_at = CURRENT_TIMESTAMP,
synced_at = CURRENT_TIMESTAMP;
CREATE TABLE IF NOT EXISTS issuance_bank_inventory (
bank_code VARCHAR(32) PRIMARY KEY,
current_balance DECIMAL(20, 2) NOT NULL,

Loading…
Cancel
Save