Browse Source

Merge branch 'master' of http://110.188.24.182:10023/Fengwo/data-transfer

田爽 4 months ago
parent
commit
29088991fd
1 changed files with 27 additions and 15 deletions
  1. 27 15
      Joint/Notice.cs

+ 27 - 15
Joint/Notice.cs

@@ -14,11 +14,11 @@ namespace DataTransmission.Joint
 
         public DataTable GetOldNotice(string st_time, string end_time)
         {
-            st_time = "2024-08-26 15:42:22";
+            //  st_time = "2024-08-26 15:42:22";
             var conn = tool.GetConSqlServer();
-            var sql = $@"select WNLT_Title AS  Title,WNCT_Content AS Content,WNLT_TypeID AS BulletinTypeId,WNT_TypeName AS BulletinTypeName,
+            var sql = $@"select WNLT_NoticeID as Id, WNLT_Title AS  Title,WNCT_Content AS Content,WNLT_TypeID AS BulletinTypeId,WNT_TypeName AS BulletinTypeName,
                     WNED_ReadCount AS ReadedNum,WNLT_CreateDate AS BulletinTime ,2 AS BulletinState,WNED_WebPubFlag AS WebPub,WNED_WeChat AS WeChat,
-                    '001' AS SourceOrgId,'市民热线服务系统' AS SourceOrgName,WNLT_CreateDate AS CommitTime,WNLT_AuditUserID AS AuditUserID,WNLT_AuditDate AS AuditDate
+                    '001' AS SourceOrgId,'热线中心' AS SourceOrgName,WNLT_CreateDate AS CommitTime,WNLT_AuditUserID AS AuditUserID,WNLT_AuditDate AS AuditDate
 ,WNLT_UserID as UserID,
 WNLT_UserName as UserName  ,WNED_WinFlag as WinFlag  ,   WNED_UpFlag as UpFlag  
 from Web04_NoticeList nl
@@ -35,18 +35,24 @@ from Web04_NoticeList nl
             var noticeSql = $@"INSERT INTO ""public"".""bulletin"" (""Id"", ""Title"", ""Content"", ""BulletinTypeId"", ""BulletinTypeName"", ""ReadedNum"", ""BulletinTime"", 
 ""LoseEfficacyTime"", ""BulletinState"", ""PushRanges"", ""SourceOrgId"", ""SourceOrgName"", ""CreationTime"", ""CreatorId"", ""CreatorName"",
 ""CreatorOrgId"", ""CreatorOrgName"", ""CreatorOrgLevel"", ""AreaId"", ""CommitTime"", ""ExaminOpinion"", ""ExaminManId"", ""ExaminTime"", 
-""IsArrive"",""DisplayLocation"")  VALUES";
+""IsArrive"",""DisplayLocation"",""OldNoticeId"")  VALUES";
 
-            var PushRanges = "[";
+            var PushRanges = "";
             if (item["WebPub"].ToString() == "1")
             {
-                PushRanges += $@"{{""Key"":""2"",""Value"":""门户网站""}}";
+                if (string.IsNullOrEmpty(PushRanges))
+                    PushRanges += $@"{{""Key"":""2"",""Value"":""门户网站""}}";
+                else
+                    PushRanges += $@",{{""Key"":""2"",""Value"":""门户网站""}}";
             }
             if (item["WeChat"].ToString() == "1")
             {
-                PushRanges += $@",{{""Key"":""1"",""Value"":""微信小程序""}}";
+                if (string.IsNullOrEmpty(PushRanges))
+                    PushRanges += $@"{{""Key"":""1"",""Value"":""微信小程序""}}";
+                else
+                    PushRanges += $@",{{""Key"":""1"",""Value"":""微信小程序""}}";
             }
-            PushRanges += "]";
+            PushRanges = "[" + PushRanges + "]";
             var noticeId = SequentialGuidGenerator.Instance.Create().ToString("D");
             var cretuser = GetPgUser(item["UserID"].ToString());
             string cretuserid = "";
@@ -61,20 +67,26 @@ from Web04_NoticeList nl
             {
                 caduuserid = aduuser.Rows[0]["Id"].ToString();
             }
-            var displayLocation = "[";
+            var displayLocation = "";
             if (item["WinFlag"].ToString() == "1")//飘窗 [{"Key":"1","Value":"是否置顶"},{"Key":"2","Value":"是否飘窗 "}]
             {
-                displayLocation += $@"{{""Key"":""2"",""Value"":""是否飘窗""}}";
+                if (string.IsNullOrEmpty(displayLocation))
+                    displayLocation += $@"{{""Key"":""2"",""Value"":""是否飘窗""}}";
+                else
+                    displayLocation += $@",{{""Key"":""2"",""Value"":""是否飘窗""}}";
             }
             if (item["UpFlag"].ToString() == "1")//置顶
             {
-                displayLocation += $@",{{""Key"":""1"",""Value"":""是否置顶""}}";
+                if (string.IsNullOrEmpty(displayLocation))
+                    displayLocation += $@"{{""Key"":""1"",""Value"":""是否置顶""}}";
+                else
+                    displayLocation += $@",{{""Key"":""1"",""Value"":""是否置顶""}}";
             }
-            displayLocation += "]";
+            displayLocation = "[" + displayLocation + "]";
             noticeSql += $@"('{noticeId}', '{item["Title"]}', '{item["Content"]}', '{item["BulletinTypeId"]}', '{item["BulletinTypeName"]}', 
-                {item["ReadedNum"]}, '{item["BulletinTime"]}', '2050-06-07 00:00:00', 2, '{PushRanges}', '001', '市民热线服务中心',
-                '{item["BulletinTime"]}', '{cretuserid}', '{item["UserName"]}', '001', '市民热线服务中心', 1, '001', '{item["CommitTime"]}', 
-                '同意', '{caduuserid}', '{item["AuditDate"]}', 't','{displayLocation}')";
+                {item["ReadedNum"]}, '{item["BulletinTime"]}', '2050-06-07 01:11:11', 2, '{PushRanges}', '001', '热线中心',
+                '{item["BulletinTime"]}', '{cretuserid}', '{item["UserName"]}', '001', '热线中心', 1, '001', '{item["CommitTime"]}', 
+                '同意', '{caduuserid}', '{item["AuditDate"]}', 't','{displayLocation}','{item["Id"]}')";
 
             return noticeSql;