Browse Source

知识库

田爽 6 months ago
parent
commit
40ec8e0110
4 changed files with 243 additions and 221 deletions
  1. 160 147
      Form1.Designer.cs
  2. 71 69
      Form1.cs
  3. 2 2
      Form1.resx
  4. 10 3
      Joint/Knowledge.cs

+ 160 - 147
Form1.Designer.cs

@@ -20,155 +20,167 @@
 			base.Dispose(disposing);
 		}
 
-        #region Windows Form Designer generated code
+		#region Windows Form Designer generated code
 
-        /// <summary>
-        ///  Required method for Designer support - do not modify
-        ///  the contents of this method with the code editor.
-        /// </summary>
-        private void InitializeComponent()
-        {
-            st_time = new DateTimePicker();
-            end_time = new DateTimePicker();
-            label1 = new Label();
-            label2 = new Label();
-            btn_tb = new Button();
-            cb_order = new CheckBox();
-            cb_zsk = new CheckBox();
-            cb_user = new CheckBox();
-            cb_jg = new CheckBox();
-            cb_tz = new CheckBox();
-            cb_opp = new CheckBox();
-            SuspendLayout();
-            // 
-            // st_time
-            // 
-            st_time.CustomFormat = "yyyy-MM-dd hh:mm:ss";
-            st_time.Location = new Point(141, 56);
-            st_time.Name = "st_time";
-            st_time.Size = new Size(200, 23);
-            st_time.TabIndex = 0;
-            // 
-            // end_time
-            // 
-            end_time.Location = new Point(141, 110);
-            end_time.Name = "end_time";
-            end_time.Size = new Size(200, 23);
-            end_time.TabIndex = 1;
-            // 
-            // label1
-            // 
-            label1.AutoSize = true;
-            label1.Location = new Point(67, 59);
-            label1.Name = "label1";
-            label1.Size = new Size(68, 17);
-            label1.TabIndex = 2;
-            label1.Text = "开始时间:";
-            // 
-            // label2
-            // 
-            label2.AutoSize = true;
-            label2.Location = new Point(67, 113);
-            label2.Name = "label2";
-            label2.Size = new Size(68, 17);
-            label2.TabIndex = 3;
-            label2.Text = "结束时间:";
-            // 
-            // btn_tb
-            // 
-            btn_tb.Location = new Point(160, 266);
-            btn_tb.Name = "btn_tb";
-            btn_tb.Size = new Size(75, 23);
-            btn_tb.TabIndex = 4;
-            btn_tb.Text = "同步数据";
-            btn_tb.UseVisualStyleBackColor = true;
-            btn_tb.Click += btn_tb_Click;
-            // 
-            // cb_order
-            // 
-            cb_order.AutoSize = true;
-            cb_order.Location = new Point(94, 163);
-            cb_order.Name = "cb_order";
-            cb_order.Size = new Size(75, 21);
-            cb_order.TabIndex = 5;
-            cb_order.Text = "同步工单";
-            cb_order.UseVisualStyleBackColor = true;
-            // 
-            // cb_zsk
-            // 
-            cb_zsk.AutoSize = true;
-            cb_zsk.Location = new Point(236, 163);
-            cb_zsk.Name = "cb_zsk";
-            cb_zsk.Size = new Size(87, 21);
-            cb_zsk.TabIndex = 6;
-            cb_zsk.Text = "同步知识库";
-            cb_zsk.UseVisualStyleBackColor = true;
-            // 
-            // cb_user
-            // 
-            cb_user.AutoSize = true;
-            cb_user.Location = new Point(93, 201);
-            cb_user.Name = "cb_user";
-            cb_user.Size = new Size(75, 21);
-            cb_user.TabIndex = 7;
-            cb_user.Text = "同步用户";
-            cb_user.UseVisualStyleBackColor = true;
-            // 
-            // cb_jg
-            // 
-            cb_jg.AutoSize = true;
-            cb_jg.Location = new Point(236, 201);
-            cb_jg.Name = "cb_jg";
-            cb_jg.Size = new Size(75, 21);
-            cb_jg.TabIndex = 8;
-            cb_jg.Text = "同步机构";
-            cb_jg.UseVisualStyleBackColor = true;
-            // 
-            // cb_tz
-            // 
-            cb_tz.AutoSize = true;
-            cb_tz.Location = new Point(93, 239);
-            cb_tz.Name = "cb_tz";
-            cb_tz.Size = new Size(75, 21);
-            cb_tz.TabIndex = 9;
-            cb_tz.Text = "同步通知";
-            cb_tz.UseVisualStyleBackColor = true;
-            // 
-            // cb_opp
-            // 
-            cb_opp.AutoSize = true;
-            cb_opp.Location = new Point(236, 239);
-            cb_opp.Name = "cb_opp";
-            cb_opp.Size = new Size(99, 21);
-            cb_opp.TabIndex = 10;
-            cb_opp.Text = "同步发布数据";
-            cb_opp.UseVisualStyleBackColor = true;
-            // 
-            // Form1
-            // 
-            AutoScaleDimensions = new SizeF(7F, 17F);
-            AutoScaleMode = AutoScaleMode.Font;
-            ClientSize = new Size(403, 301);
-            Controls.Add(cb_opp);
-            Controls.Add(cb_tz);
-            Controls.Add(cb_jg);
-            Controls.Add(cb_user);
-            Controls.Add(cb_zsk);
-            Controls.Add(cb_order);
-            Controls.Add(btn_tb);
-            Controls.Add(label2);
-            Controls.Add(label1);
-            Controls.Add(end_time);
-            Controls.Add(st_time);
-            Name = "Form1";
-            Text = "同步程序";
-            ResumeLayout(false);
-            PerformLayout();
-        }
+		/// <summary>
+		///  Required method for Designer support - do not modify
+		///  the contents of this method with the code editor.
+		/// </summary>
+		private void InitializeComponent()
+		{
+			st_time = new DateTimePicker();
+			end_time = new DateTimePicker();
+			label1 = new Label();
+			label2 = new Label();
+			btn_tb = new Button();
+			cb_order = new CheckBox();
+			cb_zsk = new CheckBox();
+			cb_user = new CheckBox();
+			cb_jg = new CheckBox();
+			cb_tz = new CheckBox();
+			cb_opp = new CheckBox();
+			cb_zsklx = new CheckBox();
+			SuspendLayout();
+			// 
+			// st_time
+			// 
+			st_time.CustomFormat = "yyyy-MM-dd hh:mm:ss";
+			st_time.Location = new Point(141, 56);
+			st_time.Name = "st_time";
+			st_time.Size = new Size(200, 23);
+			st_time.TabIndex = 0;
+			// 
+			// end_time
+			// 
+			end_time.Location = new Point(141, 110);
+			end_time.Name = "end_time";
+			end_time.Size = new Size(200, 23);
+			end_time.TabIndex = 1;
+			// 
+			// label1
+			// 
+			label1.AutoSize = true;
+			label1.Location = new Point(67, 59);
+			label1.Name = "label1";
+			label1.Size = new Size(68, 17);
+			label1.TabIndex = 2;
+			label1.Text = "开始时间:";
+			// 
+			// label2
+			// 
+			label2.AutoSize = true;
+			label2.Location = new Point(67, 113);
+			label2.Name = "label2";
+			label2.Size = new Size(68, 17);
+			label2.TabIndex = 3;
+			label2.Text = "结束时间:";
+			// 
+			// btn_tb
+			// 
+			btn_tb.Location = new Point(157, 318);
+			btn_tb.Name = "btn_tb";
+			btn_tb.Size = new Size(75, 23);
+			btn_tb.TabIndex = 4;
+			btn_tb.Text = "同步数据";
+			btn_tb.UseVisualStyleBackColor = true;
+			btn_tb.Click += btn_tb_Click;
+			// 
+			// cb_order
+			// 
+			cb_order.AutoSize = true;
+			cb_order.Location = new Point(94, 163);
+			cb_order.Name = "cb_order";
+			cb_order.Size = new Size(75, 21);
+			cb_order.TabIndex = 5;
+			cb_order.Text = "同步工单";
+			cb_order.UseVisualStyleBackColor = true;
+			// 
+			// cb_zsk
+			// 
+			cb_zsk.AutoSize = true;
+			cb_zsk.Location = new Point(235, 201);
+			cb_zsk.Name = "cb_zsk";
+			cb_zsk.Size = new Size(87, 21);
+			cb_zsk.TabIndex = 6;
+			cb_zsk.Text = "同步知识库";
+			cb_zsk.UseVisualStyleBackColor = true;
+			// 
+			// cb_user
+			// 
+			cb_user.AutoSize = true;
+			cb_user.Location = new Point(93, 201);
+			cb_user.Name = "cb_user";
+			cb_user.Size = new Size(75, 21);
+			cb_user.TabIndex = 7;
+			cb_user.Text = "同步用户";
+			cb_user.UseVisualStyleBackColor = true;
+			// 
+			// cb_jg
+			// 
+			cb_jg.AutoSize = true;
+			cb_jg.Location = new Point(235, 239);
+			cb_jg.Name = "cb_jg";
+			cb_jg.Size = new Size(75, 21);
+			cb_jg.TabIndex = 8;
+			cb_jg.Text = "同步机构";
+			cb_jg.UseVisualStyleBackColor = true;
+			// 
+			// cb_tz
+			// 
+			cb_tz.AutoSize = true;
+			cb_tz.Location = new Point(93, 239);
+			cb_tz.Name = "cb_tz";
+			cb_tz.Size = new Size(75, 21);
+			cb_tz.TabIndex = 9;
+			cb_tz.Text = "同步通知";
+			cb_tz.UseVisualStyleBackColor = true;
+			// 
+			// cb_opp
+			// 
+			cb_opp.AutoSize = true;
+			cb_opp.Location = new Point(235, 277);
+			cb_opp.Name = "cb_opp";
+			cb_opp.Size = new Size(99, 21);
+			cb_opp.TabIndex = 10;
+			cb_opp.Text = "同步发布数据";
+			cb_opp.UseVisualStyleBackColor = true;
+			// 
+			// cb_zsklx
+			// 
+			cb_zsklx.AutoSize = true;
+			cb_zsklx.Location = new Point(235, 163);
+			cb_zsklx.Name = "cb_zsklx";
+			cb_zsklx.Size = new Size(111, 21);
+			cb_zsklx.TabIndex = 11;
+			cb_zsklx.Text = "同步知识库类型";
+			cb_zsklx.UseVisualStyleBackColor = true;
+			// 
+			// Form1
+			// 
+			AutoScaleDimensions = new SizeF(7F, 17F);
+			AutoScaleMode = AutoScaleMode.Font;
+			ClientSize = new Size(403, 353);
+			Controls.Add(cb_zsklx);
+			Controls.Add(cb_opp);
+			Controls.Add(cb_tz);
+			Controls.Add(cb_jg);
+			Controls.Add(cb_user);
+			Controls.Add(cb_zsk);
+			Controls.Add(cb_order);
+			Controls.Add(btn_tb);
+			Controls.Add(label2);
+			Controls.Add(label1);
+			Controls.Add(end_time);
+			Controls.Add(st_time);
+			Name = "Form1";
+			Text = "同步程序";
+			ResumeLayout(false);
+			PerformLayout();
+		}
 
-        #endregion
+		#endregion
 
-        private DateTimePicker st_time;
+		private DateTimePicker st_time;
 		private DateTimePicker end_time;
 		private Label label1;
 		private Label label2;
@@ -179,5 +191,6 @@
 		private CheckBox cb_jg;
         private CheckBox cb_tz;
         private CheckBox cb_opp;
-    }
+		private CheckBox cb_zsklx;
+	}
 }

+ 71 - 69
Form1.cs

@@ -5,82 +5,84 @@ using System.Data;
 
 namespace DataTransmission
 {
-    public partial class Form1 : Form
-    {
-        private readonly Order order = new Order();
-        private readonly Execute execute = new Execute();
-        private readonly CommonTool tool = new CommonTool();
-        private readonly Knowledge knowledge = new Knowledge();
+	public partial class Form1 : Form
+	{
+		private readonly Order order = new Order();
+		private readonly Execute execute = new Execute();
+		private readonly CommonTool tool = new CommonTool();
+		private readonly Knowledge knowledge = new Knowledge();
 
-        public Form1()
-        {
-            InitializeComponent();
-        }
+		public Form1()
+		{
+			InitializeComponent();
+		}
 
-        private void btn_tb_Click(object sender, EventArgs e)
-        {
-            btn_tb.Enabled = false;
-            if (cb_opp.Checked)
-            {//同步工单发布公开数据ExecuteInsertOrderPublic
-                execute.ExecuteInsertOrderPublic(st_time.Value.ToString("yyyy-MM-dd") + " 00:00:00", end_time.Value.ToString("yyyy-MM-dd") + " 23:59:59");
-            }
+		private void btn_tb_Click(object sender, EventArgs e)
+		{
+			btn_tb.Enabled = false;
+			if (cb_opp.Checked)
+			{//同步工单发布公开数据ExecuteInsertOrderPublic
+				execute.ExecuteInsertOrderPublic(st_time.Value.ToString("yyyy-MM-dd") + " 00:00:00", end_time.Value.ToString("yyyy-MM-dd") + " 23:59:59");
+			}
 
-            if (cb_tz.Checked)
-            {
-                execute.ExecuteInsertNotice(st_time.Value.ToString("yyyy-MM-dd") + " 00:00:00", end_time.Value.ToString("yyyy-MM-dd") + " 23:59:59");
-            }
-            if (cb_zsk.Checked)
-            {
-                execute.ExecuteInsertKnowledge(st_time.Value.ToString("yyyy-MM-dd") + " 00:00:00", end_time.Value.ToString("yyyy-MM-dd") + " 23:59:59");
-                //知识库类型
-                //execute.ExecuteTypeSql();
-            }
-            if (cb_order.Checked)
-            {
-                ExecuteInsert();
-            }
-            if (cb_jg.Checked)
-            {
-                execute.ExecuteOrganizeSql();
-            }
-            if (cb_user.Checked)
-            {
-                execute.ExecuteUserSql();
-                //工号
-                //execute.ExecuteStaffSql();
-            }
-            MessageBox.Show("同步完成!请先别关闭程序!");
-            btn_tb.Enabled = true;
-        }
+			if (cb_tz.Checked)
+			{
+				execute.ExecuteInsertNotice(st_time.Value.ToString("yyyy-MM-dd") + " 00:00:00", end_time.Value.ToString("yyyy-MM-dd") + " 23:59:59");
+			}
+			if (cb_zsk.Checked)
+			{
+				execute.ExecuteInsertKnowledge(st_time.Value.ToString("yyyy-MM-dd") + " 00:00:00", end_time.Value.ToString("yyyy-MM-dd") + " 23:59:59");
+			}
+			if (cb_zsklx.Checked)
+			{
+				//知识库类型
+				execute.ExecuteTypeSql();
+			}
+			if (cb_order.Checked)
+			{
+				ExecuteInsert();
+			}
+			if (cb_jg.Checked)
+			{
+				execute.ExecuteOrganizeSql();
+			}
+			if (cb_user.Checked)
+			{
+				execute.ExecuteUserSql();
+				//工号
+				//execute.ExecuteStaffSql();
+			}
+			MessageBox.Show("同步完成!请先别关闭程序!");
+			btn_tb.Enabled = true;
+		}
 
-        private void ExecuteInsert()
-        {
-            var orderTable = order.GetOrder(st_time.Value.ToString("yyyy-MM-dd") + " 00:00:00", end_time.Value.ToString("yyyy-MM-dd") + " 23:59:59");
+		private void ExecuteInsert()
+		{
+			var orderTable = order.GetOrder(st_time.Value.ToString("yyyy-MM-dd") + " 00:00:00", end_time.Value.ToString("yyyy-MM-dd") + " 23:59:59");
 
-            var count = orderTable.Rows.Count;
+			var count = orderTable.Rows.Count;
 
-            var exNum = 0;
-            var threadNum = 100;
+			var exNum = 0;
+			var threadNum = 100;
 
-            var divisor = count / threadNum;
-            var remainder = count % threadNum;
-            for (int i = 0; i < divisor; i++)
-            {
-                var stNum = exNum;
-                var enNum = exNum + threadNum;
+			var divisor = count / threadNum;
+			var remainder = count % threadNum;
+			for (int i = 0; i < divisor; i++)
+			{
+				var stNum = exNum;
+				var enNum = exNum + threadNum;
 
-                var data = orderTable.AsEnumerable().Where(x => ((int)x.Field<long>("Serial")) > stNum && ((int)x.Field<long>("Serial")) <= enNum).CopyToDataTable();
-                execute.ExecuteSql(data);
-                exNum += threadNum;
-            }
+				var data = orderTable.AsEnumerable().Where(x => ((int)x.Field<long>("Serial")) > stNum && ((int)x.Field<long>("Serial")) <= enNum).CopyToDataTable();
+				execute.ExecuteSql(data);
+				exNum += threadNum;
+			}
 
-            if (remainder > 0)
-            {
-                var stNum = divisor * threadNum;
-                var data = orderTable.AsEnumerable().Where(x => ((int)x.Field<long>("Serial")) >= stNum).CopyToDataTable();
-                execute.ExecuteSql(data);
-            }
-        }
-
-    }
+			if (remainder > 0)
+			{
+				var stNum = divisor * threadNum;
+				var data = orderTable.AsEnumerable().Where(x => ((int)x.Field<long>("Serial")) >= stNum).CopyToDataTable();
+				execute.ExecuteSql(data);
+			}
+		}
+	}
 }

+ 2 - 2
Form1.resx

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <root>
   <!--
-    Microsoft ResX Schema 
+    Microsoft ResX Schema
 
     Version 2.0
 
@@ -48,7 +48,7 @@
     value   : The object must be serialized with
             : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
             : and then encoded with base64 encoding.
-    
+
     mimetype: application/x-microsoft.net.object.soap.base64
     value   : The object must be serialized with
             : System.Runtime.Serialization.Formatters.Soap.SoapFormatter

+ 10 - 3
Joint/Knowledge.cs

@@ -109,7 +109,10 @@ namespace DataTransmission.Joint
 		{
 			var data = GetKnowledgeType();
 			var sql = $@"INSERT INTO ""public"".""knowledge_type"" (""Id"", ""Name"", ""SpliceName"", ""IsEnable"", ""Sort"", ""ParentId"", ""LastModificationTime"", ""IsDeleted"",
-						""DeletionTime"", ""CreationTime"", ""CreatorOrgId"", ""CreatorId"", ""AreaId"", ""CreatorOrgName"", ""CreatorName"", ""CreatorOrgLevel"",""OldTypeId"") VALUES ";
+						""DeletionTime"", ""CreationTime"", ""CreatorOrgId"", ""CreatorId"", ""AreaId"", ""CreatorOrgName"", ""CreatorName"", ""CreatorOrgLevel"") VALUES ";
+
+			//var sql = $@"INSERT INTO ""public"".""knowledge_type"" (""Id"", ""Name"", ""SpliceName"", ""IsEnable"", ""Sort"", ""ParentId"", ""LastModificationTime"", ""IsDeleted"",
+			//			""DeletionTime"", ""CreationTime"", ""CreatorOrgId"", ""CreatorId"", ""AreaId"", ""CreatorOrgName"", ""CreatorName"", ""CreatorOrgLevel"",""OldTypeId"") VALUES ";
 			var num = 0;
             foreach (DataRow item in data.Rows)
             {
@@ -127,12 +130,16 @@ namespace DataTransmission.Joint
 				if (num == 0)
 				{
 					sql += $@"('{item["NewTypeId"]}', '{item["SDICT_Name"]}', '{spliceName}', 't', 0, {pid}, NULL, 'f', NULL, '2023-11-14 11:14:51.320991', '001', '08daa5f2-1878-4cfa-8764-1244f0229994',
-						'001', '12345政务服务便民热线', '初始系统管理账号', 1,'{item["SDICT_ID"]}')";
+						'001', '12345政务服务便民热线', '初始系统管理账号', 1)";
+					//sql += $@"('{item["NewTypeId"]}', '{item["SDICT_Name"]}', '{spliceName}', 't', 0, {pid}, NULL, 'f', NULL, '2023-11-14 11:14:51.320991', '001', '08daa5f2-1878-4cfa-8764-1244f0229994',
+					//	'001', '12345政务服务便民热线', '初始系统管理账号', 1,'{item["SDICT_ID"]}')";
 					num++;
 					continue;
 				}
 				sql += $@",('{item["NewTypeId"]}', '{item["SDICT_Name"]}', '{spliceName}', 't', 0, {pid}, NULL, 'f', NULL, '2023-11-14 11:14:51.320991', '001', '08daa5f2-1878-4cfa-8764-1244f0229994',
-						'001', '12345政务服务便民热线', '初始系统管理账号', 1,'{item["SDICT_ID"]}')";
+						'001', '12345政务服务便民热线', '初始系统管理账号', 1)";
+				//sql += $@",('{item["NewTypeId"]}', '{item["SDICT_Name"]}', '{spliceName}', 't', 0, {pid}, NULL, 'f', NULL, '2023-11-14 11:14:51.320991', '001', '08daa5f2-1878-4cfa-8764-1244f0229994',
+				//		'001', '12345政务服务便民热线', '初始系统管理账号', 1,'{item["SDICT_ID"]}')";
 				num++;
 			}