chore: 补充裁判端联调配置与QA数据脚本
This commit is contained in:
parent
3277a76730
commit
8512f85c5c
@ -9,6 +9,7 @@ using YD_Event.Core.Options;
|
||||
using Mapster;
|
||||
using Newtonsoft.Json;
|
||||
using Yitter.IdGenerator;
|
||||
using Microsoft.Data.SqlClient;
|
||||
|
||||
namespace SqlSugar;
|
||||
|
||||
@ -80,6 +81,19 @@ public static class SqlSugarExtensions
|
||||
public static IServiceCollection AddSqlSugar(this IServiceCollection services)
|
||||
{
|
||||
var options = App.GetOptions<DbConnectionOptions>();
|
||||
if (string.Equals(Environment.GetEnvironmentVariable("YD_EVENT_ALLOW_UNENCRYPTED_SQL"), "1", StringComparison.Ordinal))
|
||||
{
|
||||
options.Connections.ForEach(connection =>
|
||||
{
|
||||
if (connection.DbType != DbType.SqlServer) return;
|
||||
var builder = new SqlConnectionStringBuilder(connection.ConnectionString)
|
||||
{
|
||||
Encrypt = false,
|
||||
TrustServerCertificate = true
|
||||
};
|
||||
connection.ConnectionString = builder.ConnectionString;
|
||||
});
|
||||
}
|
||||
ICacheService ormCache = new SqlSugarCache();
|
||||
options.Connections.ForEach(x =>
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@ Serve.Run(RunOptions.Default
|
||||
.WithArgs(args)
|
||||
.ConfigureBuilder(builder =>
|
||||
{
|
||||
// 确保容器内绑定到所有IP,端口9996
|
||||
builder.WebHost.UseUrls("http://*:9997");
|
||||
// 本地裁判端联调统一使用 5000 端口,并绑定全部网卡供 adb reverse 转发。
|
||||
builder.WebHost.UseUrls("http://*:5000");
|
||||
})
|
||||
);
|
||||
|
||||
@ -10,9 +10,9 @@
|
||||
"Kestrel": {
|
||||
"Endpoints": {
|
||||
"Http": {
|
||||
"Url": "http://*:9996"
|
||||
"Url": "http://*:5000"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
}
|
||||
|
||||
134
二期需求/20260903_bind_existing_judge_accounts.sql
Normal file
134
二期需求/20260903_bind_existing_judge_accounts.sql
Normal file
@ -0,0 +1,134 @@
|
||||
:setvar JudgeDJPassword "__REQUIRED__"
|
||||
:setvar JudgePPassword "__REQUIRED__"
|
||||
:setvar JudgeTPassword "__REQUIRED__"
|
||||
|
||||
SET XACT_ABORT ON;
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
IF N'$(JudgeDJPassword)' = N'__REQUIRED__'
|
||||
OR N'$(JudgePPassword)' = N'__REQUIRED__'
|
||||
OR N'$(JudgeTPassword)' = N'__REQUIRED__'
|
||||
THROW 51000, N'请通过 sqlcmd -v 提供 JudgeDJPassword、JudgePPassword 和 JudgeTPassword。', 1;
|
||||
|
||||
-- 本脚本只适用于当前 QA 赛事及场次;基础档案不匹配时立即停止,避免误改其他环境。
|
||||
IF NOT EXISTS (SELECT 1 FROM dbo.Referee WHERE Id = 9001 AND Mobile = '13800000001' AND DeleteMark = 0)
|
||||
OR NOT EXISTS (SELECT 1 FROM dbo.Referee WHERE Id = 9002 AND Mobile = '13800000002' AND DeleteMark = 0)
|
||||
OR NOT EXISTS (SELECT 1 FROM dbo.Referee WHERE Id = 9003 AND Mobile = '13800000003' AND DeleteMark = 0)
|
||||
THROW 51001, N'现有裁判档案与预期不一致,已停止账号换绑。', 1;
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM dbo.EventSession WHERE Id = 468424868974597 AND EventId = 466884260081669 AND DeleteMark = 0)
|
||||
THROW 51002, N'目标赛事场次不存在,已停止账号换绑。', 1;
|
||||
|
||||
DECLARE @Accounts TABLE (
|
||||
UserId BIGINT NOT NULL,
|
||||
RefereeId BIGINT NOT NULL,
|
||||
EventRefereeId BIGINT NOT NULL,
|
||||
AssignmentId BIGINT NOT NULL,
|
||||
Name VARCHAR(64) NOT NULL,
|
||||
Mobile VARCHAR(20) NOT NULL,
|
||||
RoleMask INT NOT NULL,
|
||||
JudgeRole VARCHAR(32) NOT NULL,
|
||||
JudgeRoleType VARCHAR(16) NOT NULL,
|
||||
PasswordPrefix VARCHAR(16) NOT NULL,
|
||||
PlainPassword VARCHAR(64) NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO @Accounts VALUES
|
||||
(9001, 9001, 8001, 9101, '张裁判', '13800000001', 4, 'DJ1', 'DJ', 'LNL3', '$(JudgeDJPassword)'),
|
||||
(9002, 9002, 8002, 9102, '李裁判', '13800000002', 2, 'P1', 'P', 'oP76', '$(JudgePPassword)'),
|
||||
(9003, 9003, 8003, 9103, '王裁判', '13800000003', 1, 'T', 'T', 'PdYK', '$(JudgeTPassword)');
|
||||
|
||||
-- 使用应用现有的 Hashids(id)+MD5(password) 规则生成登录密码,密码本身不固化在仓库。
|
||||
MERGE dbo.AppUser AS target
|
||||
USING @Accounts AS source ON target.Id = source.UserId
|
||||
WHEN MATCHED THEN UPDATE SET
|
||||
target.Name = source.Name,
|
||||
target.Mobile = source.Mobile,
|
||||
target.Password = LOWER(CONVERT(VARCHAR(32), HASHBYTES('MD5', source.PasswordPrefix + source.PlainPassword), 2)),
|
||||
target.MiniProgramRole = 2,
|
||||
target.AuditStatus = 2,
|
||||
target.Status = 0,
|
||||
target.DeleteMark = 0,
|
||||
target.UpdatedUserId = 0,
|
||||
target.UpdatedTime = GETDATE()
|
||||
WHEN NOT MATCHED THEN INSERT
|
||||
(Id, Name, Gender, Mobile, AuditStatus, Status, DeleteMark, CreatedUserId, CreatedTime,
|
||||
PersonType, Password, AuthType, MiniProgramRole, AuditTime, Remark)
|
||||
VALUES
|
||||
(source.UserId, source.Name, 0, source.Mobile, 2, 0, 0, 0, GETDATE(),
|
||||
0, LOWER(CONVERT(VARCHAR(32), HASHBYTES('MD5', source.PasswordPrefix + source.PlainPassword), 2)),
|
||||
0, 2, GETDATE(), N'裁判端正式联调账号');
|
||||
|
||||
UPDATE referee SET
|
||||
referee.AppUserId = account.UserId,
|
||||
referee.Roles = account.RoleMask,
|
||||
referee.AuditStatus = 2,
|
||||
referee.Status = 0,
|
||||
referee.DeleteMark = 0,
|
||||
referee.UpdatedUserId = 0,
|
||||
referee.UpdatedTime = GETDATE()
|
||||
FROM dbo.Referee referee
|
||||
INNER JOIN @Accounts account ON account.RefereeId = referee.Id;
|
||||
|
||||
UPDATE eventReferee SET
|
||||
eventReferee.Status = 0,
|
||||
eventReferee.DeleteMark = 0,
|
||||
eventReferee.UpdatedUserId = 0,
|
||||
eventReferee.UpdatedTime = GETDATE()
|
||||
FROM dbo.EventReferee eventReferee
|
||||
INNER JOIN @Accounts account ON account.EventRefereeId = eventReferee.Id
|
||||
WHERE eventReferee.EventId = 466884260081669;
|
||||
|
||||
-- 旧联调席位只停用,不改写旧评分单和任务,历史数据仍可追溯且不会串到新账号。
|
||||
UPDATE assignment SET
|
||||
assignment.AssignmentStatus = 9,
|
||||
assignment.Status = 1,
|
||||
assignment.SubmittedTime = NULL,
|
||||
assignment.Remark = N'已由正式裁判账号换绑,旧联调席位停用',
|
||||
assignment.UpdatedUserId = 0,
|
||||
assignment.UpdatedTime = GETDATE()
|
||||
FROM dbo.EventJudgeAssignment assignment
|
||||
INNER JOIN dbo.AppUser appUser ON appUser.Id = assignment.JudgeUserId
|
||||
WHERE assignment.SessionId = 468424868974597
|
||||
AND appUser.Mobile IN ('19900000001', '19900000002', '19900000003')
|
||||
AND assignment.DeleteMark = 0;
|
||||
|
||||
MERGE dbo.EventJudgeAssignment AS target
|
||||
USING @Accounts AS source ON target.Id = source.AssignmentId
|
||||
WHEN MATCHED THEN UPDATE SET
|
||||
target.EventId = 466884260081669,
|
||||
target.SessionId = 468424868974597,
|
||||
target.EventRefereeId = source.EventRefereeId,
|
||||
target.RefereeId = source.RefereeId,
|
||||
target.JudgeUserId = source.UserId,
|
||||
target.JudgeRole = source.JudgeRole,
|
||||
target.JudgeRoleType = source.JudgeRoleType,
|
||||
target.AssignmentStatus = 1,
|
||||
target.Status = 0,
|
||||
target.DeleteMark = 0,
|
||||
target.SubmittedTime = GETDATE(),
|
||||
target.Remark = N'裁判端正式联调席位',
|
||||
target.UpdatedUserId = 0,
|
||||
target.UpdatedTime = GETDATE()
|
||||
WHEN NOT MATCHED THEN INSERT
|
||||
(Id, EventId, SessionId, EventRefereeId, RefereeId, JudgeUserId, JudgeRole, JudgeRoleType,
|
||||
AssignmentStatus, SubmittedTime, Remark, Status, DeleteMark, CreatedUserId, CreatedTime)
|
||||
VALUES
|
||||
(source.AssignmentId, 466884260081669, 468424868974597, source.EventRefereeId, source.RefereeId,
|
||||
source.UserId, source.JudgeRole, source.JudgeRoleType, 1, GETDATE(), N'裁判端正式联调席位',
|
||||
0, 0, 0, GETDATE());
|
||||
|
||||
-- 联调账号做可恢复的软删除;关联的旧草稿、任务和评分单不物理删除。
|
||||
UPDATE eventReferee SET eventReferee.Status = 1, eventReferee.DeleteMark = 1,
|
||||
eventReferee.UpdatedUserId = 0, eventReferee.UpdatedTime = GETDATE()
|
||||
FROM dbo.EventReferee eventReferee
|
||||
INNER JOIN dbo.Referee referee ON referee.Id = eventReferee.RefereeId
|
||||
WHERE referee.Mobile IN ('19900000001', '19900000002', '19900000003');
|
||||
|
||||
UPDATE dbo.Referee SET Status = 1, DeleteMark = 1, UpdatedUserId = 0, UpdatedTime = GETDATE()
|
||||
WHERE Mobile IN ('19900000001', '19900000002', '19900000003');
|
||||
|
||||
UPDATE dbo.AppUser SET Status = 1, DeleteMark = 1, UpdatedUserId = 0, UpdatedTime = GETDATE()
|
||||
WHERE Mobile IN ('19900000001', '19900000002', '19900000003');
|
||||
|
||||
COMMIT TRANSACTION;
|
||||
183
二期需求/20260904_complete_wire_e2e_judges.sql
Normal file
183
二期需求/20260904_complete_wire_e2e_judges.sql
Normal file
@ -0,0 +1,183 @@
|
||||
SET NOCOUNT ON;
|
||||
SET XACT_ABORT ON;
|
||||
|
||||
IF N'$(JudgeDJ2Password)' = N'__REQUIRED__'
|
||||
OR N'$(JudgeDT1Password)' = N'__REQUIRED__'
|
||||
OR N'$(JudgeDT2Password)' = N'__REQUIRED__'
|
||||
OR N'$(JudgeP2Password)' = N'__REQUIRED__'
|
||||
THROW 51000, N'请通过 sqlcmd -v 提供四名裁判的密码。', 1;
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT 1 FROM dbo.EventSession
|
||||
WHERE Id = 468424868974597 AND EventId = 466884260081669 AND DeleteMark = 0
|
||||
)
|
||||
THROW 51001, N'目标 QA 场次不存在,已停止七席补齐。', 1;
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM dbo.Referee WHERE Id = 9004 AND Mobile = '13800000004' AND DeleteMark = 0)
|
||||
OR NOT EXISTS (SELECT 1 FROM dbo.Referee WHERE Id = 9005 AND Mobile = '13800000005' AND DeleteMark = 0)
|
||||
THROW 51002, N'赵裁判或陈裁判档案与预期不一致。', 1;
|
||||
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM dbo.AppUser
|
||||
WHERE (Id IN (9004,9005,9006,9007) OR Mobile IN ('13800000004','13800000005','13800000006','13800000007'))
|
||||
AND NOT ((Id = 9004 AND Mobile = '13800000004')
|
||||
OR (Id = 9005 AND Mobile = '13800000005')
|
||||
OR (Id = 9006 AND Mobile = '13800000006')
|
||||
OR (Id = 9007 AND Mobile = '13800000007'))
|
||||
)
|
||||
THROW 51003, N'预留 AppUser ID 或手机号已被其他账号占用。', 1;
|
||||
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM dbo.Referee
|
||||
WHERE (Id IN (9006,9007) OR Mobile IN ('13800000006','13800000007'))
|
||||
AND NOT ((Id = 9006 AND Mobile = '13800000006') OR (Id = 9007 AND Mobile = '13800000007'))
|
||||
)
|
||||
THROW 51004, N'预留裁判档案 ID 或手机号已被占用。', 1;
|
||||
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM dbo.EventReferee
|
||||
WHERE Id IN (8004,8005,8006,8007)
|
||||
AND NOT ((Id = 8004 AND RefereeId = 9004)
|
||||
OR (Id = 8005 AND RefereeId = 9005)
|
||||
OR (Id = 8006 AND RefereeId = 9006)
|
||||
OR (Id = 8007 AND RefereeId = 9007))
|
||||
)
|
||||
THROW 51005, N'预留赛事裁判 ID 已被其他档案占用。', 1;
|
||||
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM dbo.EventJudgeAssignment
|
||||
WHERE Id IN (9104,9105,9106,9107)
|
||||
AND NOT ((Id = 9104 AND RefereeId = 9004)
|
||||
OR (Id = 9105 AND RefereeId = 9005)
|
||||
OR (Id = 9106 AND RefereeId = 9006)
|
||||
OR (Id = 9107 AND RefereeId = 9007))
|
||||
)
|
||||
THROW 51006, N'预留裁判席位 ID 已被占用。', 1;
|
||||
|
||||
DECLARE @Accounts TABLE (
|
||||
UserId BIGINT NOT NULL,
|
||||
RefereeId BIGINT NOT NULL,
|
||||
EventRefereeId BIGINT NOT NULL,
|
||||
AssignmentId BIGINT NOT NULL,
|
||||
Name NVARCHAR(64) NOT NULL,
|
||||
Mobile VARCHAR(20) NOT NULL,
|
||||
RoleMask INT NOT NULL,
|
||||
JudgeRole VARCHAR(32) NOT NULL,
|
||||
JudgeRoleType VARCHAR(16) NOT NULL,
|
||||
PasswordPrefix VARCHAR(16) NOT NULL,
|
||||
PlainPassword VARCHAR(64) NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO @Accounts VALUES
|
||||
(9004,9004,8004,9104,N'赵裁判','13800000004',4,'DJ2','DJ','WaMM','$(JudgeDJ2Password)'),
|
||||
(9005,9005,8005,9105,N'陈裁判','13800000005',4,'DT1','DT','YlOL','$(JudgeDT1Password)'),
|
||||
(9006,9006,8006,9106,N'QA裁判-DT2','13800000006',4,'DT2','DT','aRq5','$(JudgeDT2Password)'),
|
||||
(9007,9007,8007,9107,N'QA裁判-P2','13800000007',2,'P2','P','yekr','$(JudgeP2Password)');
|
||||
|
||||
MERGE dbo.AppUser AS target
|
||||
USING @Accounts AS source ON target.Id = source.UserId
|
||||
WHEN MATCHED THEN UPDATE SET
|
||||
target.Name = source.Name,
|
||||
target.Mobile = source.Mobile,
|
||||
target.Password = LOWER(CONVERT(VARCHAR(32), HASHBYTES('MD5', source.PasswordPrefix + source.PlainPassword), 2)),
|
||||
target.MiniProgramRole = 2,
|
||||
target.AuditStatus = 2,
|
||||
target.Status = 0,
|
||||
target.DeleteMark = 0,
|
||||
target.UpdatedUserId = 0,
|
||||
target.UpdatedTime = GETDATE()
|
||||
WHEN NOT MATCHED THEN INSERT
|
||||
(Id, Name, Gender, Mobile, AuditStatus, Status, DeleteMark, CreatedUserId, CreatedTime,
|
||||
PersonType, Password, AuthType, MiniProgramRole, AuditTime, Remark)
|
||||
VALUES
|
||||
(source.UserId, source.Name, 0, source.Mobile, 2, 0, 0, 0, GETDATE(),
|
||||
0, LOWER(CONVERT(VARCHAR(32), HASHBYTES('MD5', source.PasswordPrefix + source.PlainPassword), 2)),
|
||||
0, 2, GETDATE(), N'交互绳七席端到端 QA 裁判账号');
|
||||
|
||||
MERGE dbo.Referee AS target
|
||||
USING (SELECT * FROM @Accounts WHERE RefereeId IN (9006,9007)) AS source ON target.Id = source.RefereeId
|
||||
WHEN MATCHED THEN UPDATE SET
|
||||
target.Name = source.Name,
|
||||
target.Mobile = source.Mobile,
|
||||
target.AppUserId = source.UserId,
|
||||
target.Roles = source.RoleMask,
|
||||
target.AuditStatus = 2,
|
||||
target.Status = 0,
|
||||
target.DeleteMark = 0,
|
||||
target.UpdatedUserId = 0,
|
||||
target.UpdatedTime = GETDATE()
|
||||
WHEN NOT MATCHED THEN INSERT
|
||||
(Id,Name,Mobile,AppUserId,ProvinceCode,ProvinceName,CityCode,CityName,DistrictCode,DistrictName,
|
||||
Level,CertificateUrl,Roles,AuditStatus,AuditRemark,AuditUserId,AuditTime,Status,DeleteMark,CreatedUserId,CreatedTime)
|
||||
VALUES
|
||||
(source.RefereeId,source.Name,source.Mobile,source.UserId,'310000',N'上海市','310100',N'上海市','310101',N'QA测试区',
|
||||
3,'',source.RoleMask,2,N'交互绳七席端到端 QA 专用',0,GETDATE(),0,0,0,GETDATE());
|
||||
|
||||
UPDATE referee SET
|
||||
referee.AppUserId = account.UserId,
|
||||
referee.Roles = account.RoleMask,
|
||||
referee.AuditStatus = 2,
|
||||
referee.Status = 0,
|
||||
referee.DeleteMark = 0,
|
||||
referee.UpdatedUserId = 0,
|
||||
referee.UpdatedTime = GETDATE()
|
||||
FROM dbo.Referee referee
|
||||
INNER JOIN @Accounts account ON account.RefereeId = referee.Id;
|
||||
|
||||
MERGE dbo.EventReferee AS target
|
||||
USING @Accounts AS source ON target.Id = source.EventRefereeId
|
||||
WHEN MATCHED THEN UPDATE SET
|
||||
target.EventId = 466884260081669,
|
||||
target.RefereeId = source.RefereeId,
|
||||
target.SourceType = 1,
|
||||
target.Status = 0,
|
||||
target.DeleteMark = 0,
|
||||
target.UpdatedUserId = 0,
|
||||
target.UpdatedTime = GETDATE()
|
||||
WHEN NOT MATCHED THEN INSERT
|
||||
(Id,EventId,RefereeId,RefereeApplicationId,SourceType,Status,DeleteMark,CreatedUserId,CreatedTime)
|
||||
VALUES
|
||||
(source.EventRefereeId,466884260081669,source.RefereeId,NULL,1,0,0,0,GETDATE());
|
||||
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM dbo.EventJudgeAssignment
|
||||
WHERE SessionId = 468424868974597 AND AssignmentStatus = 1 AND DeleteMark = 0
|
||||
AND JudgeRole IN ('DJ2','DT1','DT2','P2') AND Id NOT IN (9104,9105,9106,9107)
|
||||
)
|
||||
THROW 51007, N'目标席位已存在其他有效分配,请先人工核对。', 1;
|
||||
|
||||
MERGE dbo.EventJudgeAssignment AS target
|
||||
USING @Accounts AS source ON target.Id = source.AssignmentId
|
||||
WHEN MATCHED THEN UPDATE SET
|
||||
target.EventId = 466884260081669,
|
||||
target.SessionId = 468424868974597,
|
||||
target.EventRefereeId = source.EventRefereeId,
|
||||
target.RefereeId = source.RefereeId,
|
||||
target.JudgeUserId = source.UserId,
|
||||
target.JudgeRole = source.JudgeRole,
|
||||
target.JudgeRoleType = source.JudgeRoleType,
|
||||
target.AssignmentStatus = 1,
|
||||
target.SubmittedTime = GETDATE(),
|
||||
target.Remark = N'交互绳七席端到端 QA 席位',
|
||||
target.Status = 0,
|
||||
target.DeleteMark = 0,
|
||||
target.UpdatedUserId = 0,
|
||||
target.UpdatedTime = GETDATE()
|
||||
WHEN NOT MATCHED THEN INSERT
|
||||
(Id,EventId,SessionId,EventRefereeId,RefereeId,JudgeUserId,JudgeRole,JudgeRoleType,
|
||||
AssignmentStatus,SubmittedTime,Remark,Status,DeleteMark,CreatedUserId,CreatedTime)
|
||||
VALUES
|
||||
(source.AssignmentId,466884260081669,468424868974597,source.EventRefereeId,source.RefereeId,source.UserId,
|
||||
source.JudgeRole,source.JudgeRoleType,1,GETDATE(),N'交互绳七席端到端 QA 席位',0,0,0,GETDATE());
|
||||
|
||||
IF (SELECT COUNT(*) FROM dbo.EventJudgeAssignment
|
||||
WHERE SessionId = 468424868974597 AND AssignmentStatus = 1 AND Status = 0 AND DeleteMark = 0
|
||||
AND JudgeRole IN ('DJ1','DJ2','DT1','DT2','P1','P2','T')) <> 7
|
||||
THROW 51008, N'交互绳七个有效席位校验失败。', 1;
|
||||
|
||||
COMMIT TRANSACTION;
|
||||
|
||||
SELECT a.Mobile,a.Name,a.JudgeRole,a.JudgeRoleType,a.RoleMask
|
||||
FROM @Accounts a ORDER BY a.AssignmentId;
|
||||
76
二期需求/20260904_repair_wire_e2e_entries.sql
Normal file
76
二期需求/20260904_repair_wire_e2e_entries.sql
Normal file
@ -0,0 +1,76 @@
|
||||
SET NOCOUNT ON;
|
||||
SET XACT_ABORT ON;
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM dbo.EventSessionEntry WHERE Id = 468424869007365 AND SessionId = 468424868974597)
|
||||
OR NOT EXISTS (SELECT 1 FROM dbo.EventSessionEntry WHERE Id = 468424869011461 AND SessionId = 468424868974597)
|
||||
THROW 51100, N'目标 QA 出场记录不存在。', 1;
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM dbo.EventRegistrationItem WHERE Id = 466884849647621 AND DeleteMark = 0)
|
||||
OR NOT EXISTS (SELECT 1 FROM dbo.EventRegistrationPerson WHERE Id = 466885642186757 AND DeleteMark = 0)
|
||||
OR NOT EXISTS (SELECT 1 FROM dbo.EventRegistrationPerson WHERE Id = 466885642182661 AND DeleteMark = 0)
|
||||
THROW 51101, N'用于复制的 QA 报名数据不存在。', 1;
|
||||
|
||||
IF EXISTS (SELECT 1 FROM dbo.EventRegistrationItem WHERE Id IN (9301,9302) AND ISNULL(Remark,'') NOT LIKE N'%交互绳端到端QA%')
|
||||
OR EXISTS (SELECT 1 FROM dbo.EventRegistrationPerson WHERE Id IN (9401,9402) AND ISNULL(Remark,'') NOT LIKE N'%交互绳端到端QA%')
|
||||
THROW 51102, N'预留 QA 报名数据 ID 已被其他数据占用。', 1;
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM dbo.EventRegistrationItem WHERE Id = 9301)
|
||||
BEGIN
|
||||
INSERT dbo.EventRegistrationItem
|
||||
(Id,RegistrationId,ProjectId,EventProjectGroupId,ProjectName,ProjectTypeName,GroupName,
|
||||
UnitPrice,PersonCount,TotalPrice,Remark,RefundOrderId,DeleteMark,CreatedUserId,CreatedTime,UpdatedUserId,UpdatedTime)
|
||||
SELECT 9301,RegistrationId,ProjectId,EventProjectGroupId,ProjectName,ProjectTypeName,GroupName,
|
||||
0,1,0,N'交互绳端到端QA-出场1',NULL,0,0,GETDATE(),NULL,NULL
|
||||
FROM dbo.EventRegistrationItem WHERE Id = 466884849647621;
|
||||
END;
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM dbo.EventRegistrationItem WHERE Id = 9302)
|
||||
BEGIN
|
||||
INSERT dbo.EventRegistrationItem
|
||||
(Id,RegistrationId,ProjectId,EventProjectGroupId,ProjectName,ProjectTypeName,GroupName,
|
||||
UnitPrice,PersonCount,TotalPrice,Remark,RefundOrderId,DeleteMark,CreatedUserId,CreatedTime,UpdatedUserId,UpdatedTime)
|
||||
SELECT 9302,RegistrationId,ProjectId,EventProjectGroupId,ProjectName,ProjectTypeName,GroupName,
|
||||
0,1,0,N'交互绳端到端QA-出场2',NULL,0,0,GETDATE(),NULL,NULL
|
||||
FROM dbo.EventRegistrationItem WHERE Id = 466884849647621;
|
||||
END;
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM dbo.EventRegistrationPerson WHERE Id = 9401)
|
||||
BEGIN
|
||||
INSERT dbo.EventRegistrationPerson
|
||||
(Id,RegistrationId,RegistrationItemId,ProjectId,EventProjectGroupId,PersonType,UserId,Name,Gender,
|
||||
IdCard,BirthDate,Phone,Age,Email,GroupName,ProjectName,CustomFieldValue,Remark,RefundOrderId,
|
||||
DeleteMark,CreatedUserId,CreatedTime,UpdatedUserId,UpdatedTime)
|
||||
SELECT 9401,RegistrationId,9301,ProjectId,EventProjectGroupId,PersonType,UserId,Name,Gender,
|
||||
IdCard,BirthDate,Phone,Age,Email,GroupName,ProjectName,CustomFieldValue,N'交互绳端到端QA-出场1',NULL,
|
||||
0,0,GETDATE(),NULL,NULL
|
||||
FROM dbo.EventRegistrationPerson WHERE Id = 466885642186757;
|
||||
END;
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM dbo.EventRegistrationPerson WHERE Id = 9402)
|
||||
BEGIN
|
||||
INSERT dbo.EventRegistrationPerson
|
||||
(Id,RegistrationId,RegistrationItemId,ProjectId,EventProjectGroupId,PersonType,UserId,Name,Gender,
|
||||
IdCard,BirthDate,Phone,Age,Email,GroupName,ProjectName,CustomFieldValue,Remark,RefundOrderId,
|
||||
DeleteMark,CreatedUserId,CreatedTime,UpdatedUserId,UpdatedTime)
|
||||
SELECT 9402,RegistrationId,9302,ProjectId,EventProjectGroupId,PersonType,UserId,Name,Gender,
|
||||
IdCard,BirthDate,Phone,Age,Email,GroupName,ProjectName,CustomFieldValue,N'交互绳端到端QA-出场2',NULL,
|
||||
0,0,GETDATE(),NULL,NULL
|
||||
FROM dbo.EventRegistrationPerson WHERE Id = 466885642182661;
|
||||
END;
|
||||
|
||||
UPDATE dbo.EventSessionEntry SET RegistrationItemId = 9301, UpdatedUserId = 0, UpdatedTime = GETDATE()
|
||||
WHERE Id = 468424869007365 AND RegistrationItemId <> 9301;
|
||||
UPDATE dbo.EventSessionEntry SET RegistrationItemId = 9302, UpdatedUserId = 0, UpdatedTime = GETDATE()
|
||||
WHERE Id = 468424869011461 AND RegistrationItemId <> 9302;
|
||||
|
||||
IF (SELECT COUNT(*) FROM dbo.EventRegistrationPerson WHERE RegistrationItemId IN (9301,9302) AND DeleteMark = 0) <> 2
|
||||
THROW 51103, N'QA 出场报名人员校验失败。', 1;
|
||||
|
||||
COMMIT TRANSACTION;
|
||||
|
||||
SELECT e.Id,e.EntryNo,e.RegistrationItemId,p.Id RegistrationPersonId,p.Name
|
||||
FROM dbo.EventSessionEntry e
|
||||
JOIN dbo.EventRegistrationPerson p ON p.RegistrationItemId = e.RegistrationItemId AND p.DeleteMark = 0
|
||||
WHERE e.Id IN (468424869007365,468424869011461)
|
||||
ORDER BY e.PlayOrder;
|
||||
Loading…
x
Reference in New Issue
Block a user