jiahailin 2 years ago
parent
commit
5509a4d599

+ 22 - 0
TimedUpload.sln

@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26430.14
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TimedUpload", "TimedUpload\TimedUpload.csproj", "{54D76C85-4B6F-44D6-9B95-8B4BB411FC4D}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{54D76C85-4B6F-44D6-9B95-8B4BB411FC4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{54D76C85-4B6F-44D6-9B95-8B4BB411FC4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{54D76C85-4B6F-44D6-9B95-8B4BB411FC4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{54D76C85-4B6F-44D6-9B95-8B4BB411FC4D}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

+ 41 - 0
TimedUpload/Program.cs

@@ -0,0 +1,41 @@
+ using Quartz;
+using Quartz.Impl; 
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Security.Permissions;
+using System.Text;
+using Topshelf;
+
+namespace TimedUpload
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "log4net.config"));
+            try
+            {
+                HostFactory.Run(x =>
+                {
+                    x.UseLog4Net();
+                    x.Service<ServiceRunner>();
+                    x.SetDescription("SetDescription");
+                    x.SetDisplayName("SetDisplayName");
+                    x.SetServiceName("SetServiceName");
+                    x.EnablePauseAndContinue();
+                }); 
+
+            }
+            catch (Exception ex)
+            {
+                Console.Write(ex.Message);
+            }
+
+        }
+    }
+
+}

+ 36 - 0
TimedUpload/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("TimedUpload")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("TimedUpload")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2017")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("54d76c85-4b6f-44d6-9b95-8b4bb411fc4d")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 123 - 0
TimedUpload/QuartzJobs/GISjob.cs

@@ -0,0 +1,123 @@
+using log4net;
+using Quartz;
+using SuperMap.Data;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+
+namespace TimedUpload.QuartzJobs
+{
+	class GISjob : IJob
+	{
+		private readonly ILog log = LogManager.GetLogger(typeof(GISjob));
+		private readonly static string selectGX = "SELECT  gx.objectid as pipeLineId,cd as realLength,gx.gj as pipeCaliber,gdbh as pipeLineNo,gx.cz as pipeMaterial,gx.msrq as buidTime,gx.enabled as useState,qsdh,zddh,gdqs.smx as qsdhsmx,gdqs.smy as qsdhsmy,gdzd.smx as zddhsmx,gdzd.smy as zddhsmy from SMDTV_5 as gx INNER JOIN SMDTV_6 as gdqs on gdqs.bsm=gx.qsdh INNER JOIN SMDTV_6 as gdzd on gdzd.bsm=gx.zddh";
+
+		public void Execute(IJobExecutionContext context)
+		{
+			try
+			{
+				GISdata();
+			}
+			catch (Exception ex)
+			{
+				log.Error("执行Execute异常:" + ex.Message);
+			}
+		}
+		private void GISdata()
+		{
+			DataTable drPipeArea = MysqlHelper.Query("select * from bs_pipearea where PipeName='GIS定时任务'").Tables[0];
+			if (drPipeArea.Rows.Count != 1)
+			{
+				MysqlHelper.ExecuteSql("DELETE from bs_pipearea where PipeName='GIS定时任务'");
+				MysqlHelper.ExecuteSql("INSERT INTO bs_pipearea(PipeAreaId, PipeName) VALUES(1,'GIS定时任务')");
+			}
+			MysqlHelper.ExecuteSql("DELETE from bs_pipeline where PipeAreaId=1");
+			DataTable dt = NpgsqlHelper.ExecuteQuery(selectGX).Tables[0];
+			PrjCoordSys showPJcoordSys = new PrjCoordSys(PrjCoordSysType.China20003DegreeGk40N);
+			int insertPipeline = 0;
+			int baiduAPI = 0;
+			int chaotuAPI = 0;
+			Point2Ds point2Ds = new Point2Ds();
+			foreach (DataRow dr in dt.Rows)
+			{
+				point2Ds.Clear();
+				point2Ds.Add(new Point2D(StringToDouble(dr["qsdhsmx"]), StringToDouble(dr["qsdhsmy"])));
+				point2Ds.Add(new Point2D(StringToDouble(dr["zddhsmx"]), StringToDouble(dr["zddhsmy"])));
+				if (CoordSysTranslator.Inverse(point2Ds, showPJcoordSys))
+				{
+					string baiduURL = string.Format("https://api.map.baidu.com/geoconv/v1/?coords={0},{1};{2},{3}&from=1&to=5&ak=Gtjd2sKDSMYBSEGqj3KEZaM8axOQgGnA", point2Ds[0].X, point2Ds[0].Y, point2Ds[1].X, point2Ds[1].Y);
+					HttpWebRequest requestbd = (HttpWebRequest)WebRequest.Create(baiduURL);
+					requestbd.Method = "GET";
+					HttpWebResponse responsebd = (HttpWebResponse)requestbd.GetResponse();
+					Stream responseStreambd = responsebd.GetResponseStream();
+					StreamReader streamReaderbd = new StreamReader(responseStreambd, Encoding.UTF8);
+					dynamic responseJson = Newtonsoft.Json.JsonConvert.DeserializeObject(streamReaderbd.ReadToEnd());
+					if (responseJson.status == 0)
+					{
+						//log.Info("坐标转换成功 管线objectid=" + dr["pipeLineId"]);
+						#region HttpWebRequest
+						//log.Info(string.Format("成功 坐标由WGS84({0},{1}|{2},{3})转换为BD09II({4},{5}|{6},{7})", point2Ds[0].X, point2Ds[0].Y, point2Ds[1].X, point2Ds[1].Y, responseJson.result[0].x.Value, responseJson.result[0].y.Value, responseJson.result[1].x.Value, responseJson.result[1].y.Value));
+						//responseJson.result[0].x.Value, responseJson.result[0].y.Value, responseJson.result[1].x.Value, responseJson.result[1].y.Value
+						//string coordinates = string.Format("{0},{1}|{2},{3}", responseJson.result[0].x.Value, responseJson.result[0].y.Value, responseJson.result[1].x.Value, responseJson.result[1].y.Value);
+						//HttpWebRequest req = (HttpWebRequest)WebRequest.Create(doURL);
+						//req.Method = "POST";
+						//req.ContentType = "application/json";
+						//string JSONData = string.Format(addPipeLineJsonData, dr["pipeLineId"], dr["realLength"], coordinates);
+						//byte[] bytes = Encoding.UTF8.GetBytes(JSONData); 
+						//req.GetRequestStream().Write(bytes, 0, bytes.Length);
+
+						//HttpWebResponse rsp = (HttpWebResponse)req.GetResponse();
+						//Stream streamReceive = rsp.GetResponseStream();
+						//StreamReader streamReader = new StreamReader(streamReceive, Encoding.UTF8); 
+						//dynamic rspJson = Newtonsoft.Json.JsonConvert.DeserializeObject(streamReader.ReadToEnd());
+						//if (rspJson.success == true)
+						//{
+						//	log.Info("写入成功 {0}", rspJson.data);
+						//}
+						//else
+						//{
+						//	log.Error("写入失败 {0}", rspJson.errorMessage);
+						//}
+						#endregion
+						string coordinates = string.Format("{0},{1}|{2},{3}", responseJson.result[0].x.Value, responseJson.result[0].y.Value, responseJson.result[1].x.Value, responseJson.result[1].y.Value);
+						string sql = string.Format("INSERT INTO bs_pipeline(PipeLineId,PipeAreaId,pipeLineNo,realLength,coordinates,pipeCaliber,PipeLineName) VALUES({0},1,'{0}',{1},'{2}',{3},'{4}')", dr["pipeLineId"], dr["realLength"], coordinates, dr["pipeCaliber"], "导入" + dr["pipeLineId"]);
+						int r = MysqlHelper.ExecuteSql(sql);
+						if (r == 1)
+						{
+							insertPipeline++;
+							log.Info("写入成功 管线objectid=" + dr["pipeLineId"]);
+						}
+						else
+						{
+							log.Error("写入失败 管线objectid=" + dr["pipeLineId"]);
+						}
+					}
+					else
+					{
+						baiduAPI++;
+						log.Error("坐标转换失败 管线objectid=" + dr["pipeLineId"]);
+					}
+				}
+				else
+				{
+					chaotuAPI++;
+					log.Info(string.Format("超图接口转换失败,管线objectid={0}", dr["pipeLineId"]));
+				}
+			}
+			log.Info(string.Format("数据总量{0}条,写入成功{1}条,百度坐标转换失败{2}条,超图转换失败{3}条", dt.Rows.Count, insertPipeline, baiduAPI, chaotuAPI));
+			MysqlHelper.ExecuteSql("UPDATE bs_pipearea set PipeLineNum = " + insertPipeline + " WHERE PipeAreaId = 1");
+
+		}
+		public static double StringToDouble(object str)
+		{
+			if (str is null) return 0;
+			double result = 0.0D;
+			bool r = double.TryParse(str.ToString(), out result);
+			return result;
+		}
+	}
+}

+ 143 - 0
TimedUpload/QuartzTopshelf.csproj

@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{54D76C85-4B6F-44D6-9B95-8B4BB411FC4D}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>QuartzTopshelf</RootNamespace>
+    <AssemblyName>waterWellDataUpdate</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Common.Logging, Version=3.3.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
+      <HintPath>..\packages\Common.Logging.3.3.1\lib\net40\Common.Logging.dll</HintPath>
+    </Reference>
+    <Reference Include="Common.Logging.Core, Version=3.3.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
+      <HintPath>..\packages\Common.Logging.Core.3.3.1\lib\net40\Common.Logging.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
+      <HintPath>..\packages\log4net.2.0.8\lib\net40-full\log4net.dll</HintPath>
+    </Reference>
+    <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="Quartz, Version=2.6.0.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
+      <HintPath>..\packages\Quartz.2.6.0\lib\net40\Quartz.dll</HintPath>
+    </Reference>
+    <Reference Include="RDIFramework.Utilities">
+      <HintPath>..\..\SmartCityForFY\Plugin\RDIFramework.Utilities.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.configuration" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Web.Extensions" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+    <Reference Include="Topshelf">
+      <HintPath>F:\插件\C#\Topshelf\net-4.0-full\Topshelf.dll</HintPath>
+    </Reference>
+    <Reference Include="Topshelf.Log4Net">
+      <HintPath>F:\插件\C#\Topshelf\net-4.0-full\Topshelf.Log4Net.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="QuartzJobs\GISjob.cs" />
+    <Compile Include="ServiceRunner.cs" />
+    <Compile Include="utils\SystemConfig.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config">
+      <SubType>Designer</SubType>
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="job_scheduling_data_2_0.xsd">
+      <SubType>Designer</SubType>
+    </None>
+    <None Include="log4net.config">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      <SubType>Designer</SubType>
+    </None>
+    <None Include="packages.config" />
+    <None Include="quartz.config">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      <SubType>Designer</SubType>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="quartz_jobs.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      <SubType>Designer</SubType>
+    </Content>
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.0">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4 %28x86 和 x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.4.5">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 4.5</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <ItemGroup>
+    <WCFMetadata Include="Connected Services\" />
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Model\" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 45 - 0
TimedUpload/ServiceRunner.cs

@@ -0,0 +1,45 @@
+using Quartz;
+using Quartz.Impl;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Topshelf;
+
+namespace TimedUpload
+{
+    public class ServiceRunner : ServiceControl, ServiceSuspend
+    {
+        private readonly IScheduler scheduler;
+
+        public ServiceRunner()
+        {
+            scheduler = StdSchedulerFactory.GetDefaultScheduler();
+        }
+
+        public bool Start(HostControl hostControl)
+        {
+            scheduler.Start();
+            return true;
+        }
+
+        public bool Stop(HostControl hostControl)
+        {
+            scheduler.Shutdown(false);
+            return true;
+        }
+
+        public bool Continue(HostControl hostControl)
+        {
+            scheduler.ResumeAll();
+            return true;
+        }
+
+        public bool Pause(HostControl hostControl)
+        {
+            scheduler.PauseAll();
+            return true;
+        }
+
+    }
+}

+ 244 - 0
TimedUpload/TimedUpload.csproj

@@ -0,0 +1,244 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{54D76C85-4B6F-44D6-9B95-8B4BB411FC4D}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>TimedUpload</RootNamespace>
+    <AssemblyName>waterWellDataUpdate</AssemblyName>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <TargetFrameworkProfile />
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>1</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <PublishWizardCompleted>true</PublishWizardCompleted>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>x64</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup>
+    <ManifestCertificateThumbprint>E3D20C7275D300DC8AFEC1F0AA3ECE823FCB5A6F</ManifestCertificateThumbprint>
+  </PropertyGroup>
+  <PropertyGroup>
+    <ManifestKeyFile>TimedUpload_TemporaryKey.pfx</ManifestKeyFile>
+  </PropertyGroup>
+  <PropertyGroup>
+    <GenerateManifests>true</GenerateManifests>
+  </PropertyGroup>
+  <PropertyGroup>
+    <SignManifests>true</SignManifests>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
+      <HintPath>..\packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll</HintPath>
+    </Reference>
+    <Reference Include="Common.Logging, Version=3.3.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
+      <HintPath>..\packages\Common.Logging.3.3.1\lib\net40\Common.Logging.dll</HintPath>
+    </Reference>
+    <Reference Include="Common.Logging.Core, Version=3.3.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
+      <HintPath>..\packages\Common.Logging.Core.3.3.1\lib\net40\Common.Logging.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Protobuf, Version=3.14.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.Protobuf.3.14.0\lib\net45\Google.Protobuf.dll</HintPath>
+    </Reference>
+    <Reference Include="K4os.Compression.LZ4, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
+      <HintPath>..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll</HintPath>
+    </Reference>
+    <Reference Include="K4os.Compression.LZ4.Streams, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
+      <HintPath>..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll</HintPath>
+    </Reference>
+    <Reference Include="K4os.Hash.xxHash, Version=1.0.6.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
+      <HintPath>..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll</HintPath>
+    </Reference>
+    <Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
+      <HintPath>..\packages\log4net.2.0.8\lib\net40-full\log4net.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Bcl.HashCode.1.1.1\lib\net461\Microsoft.Bcl.HashCode.dll</HintPath>
+    </Reference>
+    <Reference Include="MySql.Data, Version=8.0.28.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
+      <HintPath>..\packages\MySql.Data.8.0.28\lib\net452\MySql.Data.dll</HintPath>
+    </Reference>
+    <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="Npgsql, Version=6.0.3.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL">
+      <HintPath>..\packages\Npgsql.6.0.3\lib\netstandard2.0\Npgsql.dll</HintPath>
+    </Reference>
+    <Reference Include="Quartz, Version=2.6.0.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
+      <HintPath>..\packages\Quartz.2.6.0\lib\net40\Quartz.dll</HintPath>
+    </Reference>
+    <Reference Include="SuperMap.Data, Version=7.0.0.0, Culture=neutral, PublicKeyToken=0635c574ea890381, processorArchitecture=AMD64">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\ChinaWeiWei GIS\supermap-iobjectsdotnet-10.2.0-20128-90283-all\Bin_x64\SuperMap.Data.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Collections.Immutable.6.0.0\lib\net461\System.Collections.Immutable.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ComponentModel, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+    <Reference Include="System.ComponentModel.DataAnnotations" />
+    <Reference Include="System.configuration" />
+    <Reference Include="System.Configuration.Install" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Diagnostics.DiagnosticSource, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Diagnostics.DiagnosticSource.6.0.0\lib\net461\System.Diagnostics.DiagnosticSource.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Management" />
+    <Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Numerics" />
+    <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Text.Encodings.Web, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Text.Encodings.Web.6.0.0\lib\net461\System.Text.Encodings.Web.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Text.Json.6.0.0\lib\net461\System.Text.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Threading.Channels, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Threading.Channels.6.0.0\lib\net461\System.Threading.Channels.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Transactions" />
+    <Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Web.Extensions" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+    <Reference Include="Topshelf">
+      <HintPath>F:\插件\C#\Topshelf\net-4.0-full\Topshelf.dll</HintPath>
+    </Reference>
+    <Reference Include="Topshelf.Log4Net">
+      <HintPath>F:\插件\C#\Topshelf\net-4.0-full\Topshelf.Log4Net.dll</HintPath>
+    </Reference>
+    <Reference Include="Ubiety.Dns.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
+      <HintPath>..\packages\MySql.Data.8.0.28\lib\net452\Ubiety.Dns.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="ZstdNet, Version=1.4.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
+      <HintPath>..\packages\MySql.Data.8.0.28\lib\net452\ZstdNet.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="QuartzJobs\GISjob.cs" />
+    <Compile Include="ServiceRunner.cs" />
+    <Compile Include="utils\MysqlHelper.cs" />
+    <Compile Include="utils\NpgsqlHelper.cs" />
+    <Compile Include="utils\SystemConfig.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config">
+      <SubType>Designer</SubType>
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="job_scheduling_data_2_0.xsd">
+      <SubType>Designer</SubType>
+    </None>
+    <None Include="log4net.config">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      <SubType>Designer</SubType>
+    </None>
+    <None Include="packages.config" />
+    <None Include="quartz.config">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      <SubType>Designer</SubType>
+    </None>
+    <None Include="TimedUpload_TemporaryKey.pfx" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="quartz_jobs.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      <SubType>Designer</SubType>
+    </Content>
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.0">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4 %28x86 和 x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.4.5">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 4.5</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <ItemGroup>
+    <WCFMetadata Include="Connected Services\" />
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Model\" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Import Project="..\packages\System.Text.Json.6.0.0\build\System.Text.Json.targets" Condition="Exists('..\packages\System.Text.Json.6.0.0\build\System.Text.Json.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\System.Text.Json.6.0.0\build\System.Text.Json.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Text.Json.6.0.0\build\System.Text.Json.targets'))" />
+  </Target>
+</Project>

+ 42 - 0
TimedUpload/app.config

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <appSettings>
+    <add key="dbMysql" value="server=39.99.237.110;database=smartwater_daan;uid=root;pwd=wwkj@2136807;" />
+    <add key="dbNpgsql" value="HOST=39.99.237.110;PORT=5432;DATABASE=weiweiGIS110;USER ID=postgres;PASSWORD=wwkj@2136807;" />
+  </appSettings>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+  <system.web>
+    <membership defaultProvider="ClientAuthenticationMembershipProvider">
+      <providers>
+        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
+      </providers>
+    </membership>
+    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
+      <providers>
+        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
+      </providers>
+    </roleManager>
+  </system.web>
+<startup>
+  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
+</startup>
+</configuration>

File diff suppressed because it is too large
+ 364 - 0
TimedUpload/job_scheduling_data_2_0.xsd


+ 53 - 0
TimedUpload/log4net.config

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+  <configSections>
+    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
+  </configSections>
+
+  <log4net>
+    <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
+      <!--日志路径-->
+      <param name= "File" value= "Logs\"/>
+      <!--是否是向文件中追加日志-->
+      <param name= "AppendToFile" value= "true"/>
+      <!--log保留天数-->
+      <param name= "MaxSizeRollBackups" value= "10"/>
+      <!--日志文件名是否是固定不变的-->
+      <param name= "StaticLogFileName" value= "false"/>
+      <!--日志文件名格式为:2008-08-31.log-->
+      <param name= "DatePattern" value= "yyyy-MM-dd&quot;.read.log&quot;"/>
+      <!--日志根据日期滚动-->
+      <param name= "RollingStyle" value= "Date"/>
+      <layout type="log4net.Layout.PatternLayout">
+        <param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n %loggername" />
+      </layout>
+    </appender>
+
+    <!-- 控制台前台显示日志 -->
+    <appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
+      <mapping>
+        <level value="ERROR" />
+        <foreColor value="Red, HighIntensity" />
+      </mapping>
+      <mapping>
+        <level value="Info" />
+        <foreColor value="Green" />
+      </mapping>
+      <layout type="log4net.Layout.PatternLayout">
+        <conversionPattern value="%n%date{HH:mm:ss,fff} [%-5level] %m" />
+      </layout>
+
+      <filter type="log4net.Filter.LevelRangeFilter">
+        <param name="LevelMin" value="Info" />
+        <param name="LevelMax" value="Fatal" />
+      </filter>
+    </appender>
+
+    <root>
+      <!--(高) OFF > FATAL > ERROR > WARN > INFO > DEBUG > ALL (低) -->
+      <level value="all" />
+      <appender-ref ref="ColoredConsoleAppender"/>
+      <appender-ref ref="RollingLogFileAppender"/>
+    </root>
+  </log4net>
+</configuration>

+ 28 - 0
TimedUpload/packages.config

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="BouncyCastle" version="1.8.5" targetFramework="net461" />
+  <package id="Common.Logging" version="3.3.1" targetFramework="net40" />
+  <package id="Common.Logging.Core" version="3.3.1" targetFramework="net40" />
+  <package id="Google.Protobuf" version="3.14.0" targetFramework="net461" />
+  <package id="K4os.Compression.LZ4" version="1.2.6" targetFramework="net461" />
+  <package id="K4os.Compression.LZ4.Streams" version="1.2.6" targetFramework="net461" />
+  <package id="K4os.Hash.xxHash" version="1.0.6" targetFramework="net461" />
+  <package id="log4net" version="2.0.8" targetFramework="net40" requireReinstallation="true" />
+  <package id="Microsoft.Bcl.AsyncInterfaces" version="6.0.0" targetFramework="net461" />
+  <package id="Microsoft.Bcl.HashCode" version="1.1.1" targetFramework="net461" />
+  <package id="MySql.Data" version="8.0.28" targetFramework="net461" />
+  <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net40" requireReinstallation="true" />
+  <package id="Npgsql" version="6.0.3" targetFramework="net461" />
+  <package id="Quartz" version="2.6.0" targetFramework="net40" />
+  <package id="System.Buffers" version="4.5.1" targetFramework="net461" />
+  <package id="System.Collections.Immutable" version="6.0.0" targetFramework="net461" />
+  <package id="System.Diagnostics.DiagnosticSource" version="6.0.0" targetFramework="net461" />
+  <package id="System.Memory" version="4.5.4" targetFramework="net461" />
+  <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net461" />
+  <package id="System.Text.Encodings.Web" version="6.0.0" targetFramework="net461" />
+  <package id="System.Text.Json" version="6.0.0" targetFramework="net461" />
+  <package id="System.Threading.Channels" version="6.0.0" targetFramework="net461" />
+  <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net461" />
+  <package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
+</packages>

+ 21 - 0
TimedUpload/quartz.config

@@ -0,0 +1,21 @@
+# You can configure your scheduler in either <quartz> configuration section
+# or in quartz properties file
+# Configuration section has precedence
+
+quartz.scheduler.instanceName = QuartzTest
+
+# configure thread pool info
+quartz.threadPool.type = Quartz.Simpl.SimpleThreadPool, Quartz
+quartz.threadPool.threadCount = 10
+quartz.threadPool.threadPriority = Normal
+
+# job initialization plugin handles our xml reading, without it defaults are used
+quartz.plugin.xml.type = Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz
+quartz.plugin.xml.fileNames = ~/quartz_jobs.xml
+
+# export this server to remoting context
+#quartz.scheduler.exporter.type = Quartz.Simpl.RemotingSchedulerExporter, Quartz
+#quartz.scheduler.exporter.port = 555
+#quartz.scheduler.exporter.bindName = QuartzScheduler
+#quartz.scheduler.exporter.channelType = tcp
+#quartz.scheduler.exporter.channelName = httpQuartz

+ 29 - 0
TimedUpload/quartz_jobs.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This file contains job definitions in schema version 2.0 format -->
+
+<job-scheduling-data xmlns="http://quartznet.sourceforge.net/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0">
+  <processing-directives>
+    <overwrite-existing-data>true</overwrite-existing-data>
+  </processing-directives>
+  <schedule>
+    <job>
+      <name>DataUploadJob</name>
+      <group>DataUpload</group>
+      <description>数据定时上传服务</description>
+      <job-type>TimedUpload.QuartzJobs.GISjob,TimedUploadSchedule</job-type>
+      <durable>true</durable>
+      <recover>false</recover>
+    </job>
+    <trigger>
+      <cron>
+        <name>GISjob</name>
+        <group>GISgroup</group>
+        <job-name>DataUploadJob</job-name>
+        <job-group>DataUpload</job-group>
+        <start-time>2022-02-22T00:00:00+08:00</start-time>
+        <cron-expression>0 0 22 * * ? </cron-expression>
+      </cron>
+    </trigger>
+  </schedule>
+</job-scheduling-data>

+ 659 - 0
TimedUpload/utils/MysqlHelper.cs

@@ -0,0 +1,659 @@
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+namespace TimedUpload
+{
+	class MysqlHelper
+	{
+		//数据库连接字符串(app.config来配置),可以动态更改connectionString支持多数据库.
+		private static string connectionString = ConfigurationManager.AppSettings["dbMysql"];
+		 
+
+		#region 公用方法
+		/// <summary>
+		/// 得到最大值
+		/// </summary>
+		/// <param name="FieldName"></param>
+		/// <param name="TableName"></param>
+		/// <returns></returns>
+		public static int GetMaxID(string FieldName, string TableName)
+		{
+			string strsql = "select max(" + FieldName + ")+1 from " + TableName;
+			object obj = GetSingle(strsql);
+			if (obj == null)
+			{
+				return 1;
+			}
+			else
+			{
+				return int.Parse(obj.ToString());
+			}
+		}
+		/// <summary>
+		/// 是否存在
+		/// </summary>
+		/// <param name="strSql"></param>
+		/// <returns></returns>
+		public static bool Exists(string strSql)
+		{
+			object obj = GetSingle(strSql);
+			int cmdresult;
+			if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
+			{
+				cmdresult = 0;
+			}
+			else
+			{
+				cmdresult = int.Parse(obj.ToString());
+			}
+			if (cmdresult == 0)
+			{
+				return false;
+			}
+			else
+			{
+				return true;
+			}
+		}
+		/// <summary>
+		/// 是否存在(基于MySqlParameter)
+		/// </summary>
+		/// <param name="strSql"></param>
+		/// <param name="cmdParms"></param>
+		/// <returns></returns>
+		public static bool Exists(string strSql, params MySqlParameter[] cmdParms)
+		{
+			object obj = GetSingle(strSql, cmdParms);
+			int cmdresult;
+			if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
+			{
+				cmdresult = 0;
+			}
+			else
+			{
+				cmdresult = int.Parse(obj.ToString());
+			}
+			if (cmdresult == 0)
+			{
+				return false;
+			}
+			else
+			{
+				return true;
+			}
+		}
+		#endregion
+
+		#region  执行简单SQL语句
+
+		/// <summary>
+		/// 执行SQL语句,返回影响的记录数
+		/// </summary>
+		/// <param name="SQLString">SQL语句</param>
+		/// <returns>影响的记录数</returns>
+		public static int ExecuteSql(string SQLString)
+		{
+			using (MySqlConnection connection = new MySqlConnection(connectionString))
+			{
+				using (MySqlCommand cmd = new MySqlCommand(SQLString, connection))
+				{
+					try
+					{
+						connection.Open();
+						int rows = cmd.ExecuteNonQuery();
+						return rows;
+					}
+					catch (MySql.Data.MySqlClient.MySqlException e)
+					{
+						connection.Close();
+						throw e;
+					}
+				}
+			}
+		}
+
+		public static int ExecuteSqlByTime(string SQLString, int Times)
+		{
+			using (MySqlConnection connection = new MySqlConnection(connectionString))
+			{
+				using (MySqlCommand cmd = new MySqlCommand(SQLString, connection))
+				{
+					try
+					{
+						connection.Open();
+						cmd.CommandTimeout = Times;
+						int rows = cmd.ExecuteNonQuery();
+						return rows;
+					}
+					catch (MySql.Data.MySqlClient.MySqlException e)
+					{
+						connection.Close();
+						throw e;
+					}
+				}
+			}
+		}
+
+
+		/// <summary>
+		/// 执行多条SQL语句,实现数据库事务。
+		/// </summary>
+		/// <param name="SQLStringList">多条SQL语句</param>
+		public static int ExecuteSqlTran(List<String> SQLStringList)
+		{
+			using (MySqlConnection conn = new MySqlConnection(connectionString))
+			{
+				conn.Open();
+				MySqlCommand cmd = new MySqlCommand();
+				cmd.Connection = conn;
+				MySqlTransaction tx = conn.BeginTransaction();
+				cmd.Transaction = tx;
+				try
+				{
+					int count = 0;
+					for (int n = 0; n < SQLStringList.Count; n++)
+					{
+						string strsql = SQLStringList[n];
+						if (strsql.Trim().Length > 1)
+						{
+							cmd.CommandText = strsql;
+							count += cmd.ExecuteNonQuery();
+						}
+					}
+					tx.Commit();
+					return count;
+				}
+				catch
+				{
+					tx.Rollback();
+					return 0;
+				}
+			}
+		}
+		/// <summary>
+		/// 执行带一个存储过程参数的的SQL语句。
+		/// </summary>
+		/// <param name="SQLString">SQL语句</param>
+		/// <param name="content">参数内容,比如一个字段是格式复杂的文章,有特殊符号,可以通过这个方式添加</param>
+		/// <returns>影响的记录数</returns>
+		public static int ExecuteSql(string SQLString, string content)
+		{
+			using (MySqlConnection connection = new MySqlConnection(connectionString))
+			{
+				MySqlCommand cmd = new MySqlCommand(SQLString, connection);
+				MySql.Data.MySqlClient.MySqlParameter myParameter = new MySql.Data.MySqlClient.MySqlParameter("@content", SqlDbType.NText);
+				myParameter.Value = content;
+				cmd.Parameters.Add(myParameter);
+				try
+				{
+					connection.Open();
+					int rows = cmd.ExecuteNonQuery();
+					return rows;
+				}
+				catch (MySql.Data.MySqlClient.MySqlException e)
+				{
+					throw e;
+				}
+				finally
+				{
+					cmd.Dispose();
+					connection.Close();
+				}
+			}
+		}
+		/// <summary>
+		/// 执行带一个存储过程参数的的SQL语句。
+		/// </summary>
+		/// <param name="SQLString">SQL语句</param>
+		/// <param name="content">参数内容,比如一个字段是格式复杂的文章,有特殊符号,可以通过这个方式添加</param>
+		/// <returns>影响的记录数</returns>
+		public static object ExecuteSqlGet(string SQLString, string content)
+		{
+			using (MySqlConnection connection = new MySqlConnection(connectionString))
+			{
+				MySqlCommand cmd = new MySqlCommand(SQLString, connection);
+				MySql.Data.MySqlClient.MySqlParameter myParameter = new MySql.Data.MySqlClient.MySqlParameter("@content", SqlDbType.NText);
+				myParameter.Value = content;
+				cmd.Parameters.Add(myParameter);
+				try
+				{
+					connection.Open();
+					object obj = cmd.ExecuteScalar();
+					if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
+					{
+						return null;
+					}
+					else
+					{
+						return obj;
+					}
+				}
+				catch (MySql.Data.MySqlClient.MySqlException e)
+				{
+					throw e;
+				}
+				finally
+				{
+					cmd.Dispose();
+					connection.Close();
+				}
+			}
+		}
+		/// <summary>
+		/// 向数据库里插入图像格式的字段(和上面情况类似的另一种实例)
+		/// </summary>
+		/// <param name="strSQL">SQL语句</param>
+		/// <param name="fs">图像字节,数据库的字段类型为image的情况</param>
+		/// <returns>影响的记录数</returns>
+		public static int ExecuteSqlInsertImg(string strSQL, byte[] fs)
+		{
+			using (MySqlConnection connection = new MySqlConnection(connectionString))
+			{
+				MySqlCommand cmd = new MySqlCommand(strSQL, connection);
+				MySql.Data.MySqlClient.MySqlParameter myParameter = new MySql.Data.MySqlClient.MySqlParameter("@fs", SqlDbType.Image);
+				myParameter.Value = fs;
+				cmd.Parameters.Add(myParameter);
+				try
+				{
+					connection.Open();
+					int rows = cmd.ExecuteNonQuery();
+					return rows;
+				}
+				catch (MySql.Data.MySqlClient.MySqlException e)
+				{
+					throw e;
+				}
+				finally
+				{
+					cmd.Dispose();
+					connection.Close();
+				}
+			}
+		}
+
+		/// <summary>
+		/// 执行一条计算查询结果语句,返回查询结果(object)。
+		/// </summary>
+		/// <param name="SQLString">计算查询结果语句</param>
+		/// <returns>查询结果(object)</returns>
+		public static object GetSingle(string SQLString)
+		{
+			using (MySqlConnection connection = new MySqlConnection(connectionString))
+			{
+				using (MySqlCommand cmd = new MySqlCommand(SQLString, connection))
+				{
+					try
+					{
+						connection.Open();
+						object obj = cmd.ExecuteScalar();
+						if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
+						{
+							return null;
+						}
+						else
+						{
+							return obj;
+						}
+					}
+					catch (MySql.Data.MySqlClient.MySqlException e)
+					{
+						connection.Close();
+						throw e;
+					}
+				}
+			}
+		}
+		public static object GetSingle(string SQLString, int Times)
+		{
+			using (MySqlConnection connection = new MySqlConnection(connectionString))
+			{
+				using (MySqlCommand cmd = new MySqlCommand(SQLString, connection))
+				{
+					try
+					{
+						connection.Open();
+						cmd.CommandTimeout = Times;
+						object obj = cmd.ExecuteScalar();
+						if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
+						{
+							return null;
+						}
+						else
+						{
+							return obj;
+						}
+					}
+					catch (MySql.Data.MySqlClient.MySqlException e)
+					{
+						connection.Close();
+						throw e;
+					}
+				}
+			}
+		}
+		/// <summary>
+		/// 执行查询语句,返回MySqlDataReader ( 注意:调用该方法后,一定要对MySqlDataReader进行Close )
+		/// </summary>
+		/// <param name="strSQL">查询语句</param>
+		/// <returns>MySqlDataReader</returns>
+		public static MySqlDataReader ExecuteReader(string strSQL)
+		{
+			MySqlConnection connection = new MySqlConnection(connectionString);
+			MySqlCommand cmd = new MySqlCommand(strSQL, connection);
+			try
+			{
+				connection.Open();
+				MySqlDataReader myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
+				return myReader;
+			}
+			catch (MySql.Data.MySqlClient.MySqlException e)
+			{
+				throw e;
+			}
+
+		}
+		/// <summary>
+		/// 执行查询语句,返回DataSet
+		/// </summary>
+		/// <param name="SQLString">查询语句</param>
+		/// <returns>DataSet</returns>
+		public static DataSet Query(string SQLString)
+		{
+			using (MySqlConnection connection = new MySqlConnection(connectionString))
+			{
+				DataSet ds = new DataSet();
+				try
+				{
+					connection.Open();
+					MySqlDataAdapter command = new MySqlDataAdapter(SQLString, connection);
+					command.Fill(ds, "ds");
+				}
+				catch (MySql.Data.MySqlClient.MySqlException ex)
+				{
+					throw new Exception(ex.Message);
+				}
+				return ds;
+			}
+		}
+		public static DataSet Query(string SQLString, int Times)
+		{
+			using (MySqlConnection connection = new MySqlConnection(connectionString))
+			{
+				DataSet ds = new DataSet();
+				try
+				{
+					connection.Open();
+					MySqlDataAdapter command = new MySqlDataAdapter(SQLString, connection);
+					command.SelectCommand.CommandTimeout = Times;
+					command.Fill(ds, "ds");
+				}
+				catch (MySql.Data.MySqlClient.MySqlException ex)
+				{
+					throw new Exception(ex.Message);
+				}
+				return ds;
+			}
+		}
+
+
+
+		#endregion
+
+		#region 执行带参数的SQL语句
+
+		/// <summary>
+		/// 执行SQL语句,返回影响的记录数
+		/// </summary>
+		/// <param name="SQLString">SQL语句</param>
+		/// <returns>影响的记录数</returns>
+		public static int ExecuteSql(string SQLString, params MySqlParameter[] cmdParms)
+		{
+			using (MySqlConnection connection = new MySqlConnection(connectionString))
+			{
+				using (MySqlCommand cmd = new MySqlCommand())
+				{
+					try
+					{
+						PrepareCommand(cmd, connection, null, SQLString, cmdParms);
+						int rows = cmd.ExecuteNonQuery();
+						cmd.Parameters.Clear();
+						return rows;
+					}
+					catch (MySql.Data.MySqlClient.MySqlException e)
+					{
+						throw e;
+					}
+				}
+			}
+		}
+
+
+		/// <summary>
+		/// 执行多条SQL语句,实现数据库事务。
+		/// </summary>
+		/// <param name="SQLStringList">SQL语句的哈希表(key为sql语句,value是该语句的MySqlParameter[])</param>
+		public static void ExecuteSqlTran(Hashtable SQLStringList)
+		{
+			using (MySqlConnection conn = new MySqlConnection(connectionString))
+			{
+				conn.Open();
+				using (MySqlTransaction trans = conn.BeginTransaction())
+				{
+					MySqlCommand cmd = new MySqlCommand();
+					try
+					{
+						//循环
+						foreach (DictionaryEntry myDE in SQLStringList)
+						{
+							string cmdText = myDE.Key.ToString();
+							MySqlParameter[] cmdParms = (MySqlParameter[])myDE.Value;
+							PrepareCommand(cmd, conn, trans, cmdText, cmdParms);
+							int val = cmd.ExecuteNonQuery();
+							cmd.Parameters.Clear();
+						}
+						trans.Commit();
+					}
+					catch
+					{
+						trans.Rollback();
+						throw;
+					}
+				}
+			}
+		}
+
+
+		/// <summary>
+		/// 执行多条SQL语句,实现数据库事务。
+		/// </summary>
+		/// <param name="SQLStringList">SQL语句的哈希表(key为sql语句,value是该语句的MySqlParameter[])</param>
+		public static void ExecuteSqlTranWithIndentity(Hashtable SQLStringList)
+		{
+			using (MySqlConnection conn = new MySqlConnection(connectionString))
+			{
+				conn.Open();
+				using (MySqlTransaction trans = conn.BeginTransaction())
+				{
+					MySqlCommand cmd = new MySqlCommand();
+					try
+					{
+						int indentity = 0;
+						//循环
+						foreach (DictionaryEntry myDE in SQLStringList)
+						{
+							string cmdText = myDE.Key.ToString();
+							MySqlParameter[] cmdParms = (MySqlParameter[])myDE.Value;
+							foreach (MySqlParameter q in cmdParms)
+							{
+								if (q.Direction == ParameterDirection.InputOutput)
+								{
+									q.Value = indentity;
+								}
+							}
+							PrepareCommand(cmd, conn, trans, cmdText, cmdParms);
+							int val = cmd.ExecuteNonQuery();
+							foreach (MySqlParameter q in cmdParms)
+							{
+								if (q.Direction == ParameterDirection.Output)
+								{
+									indentity = Convert.ToInt32(q.Value);
+								}
+							}
+							cmd.Parameters.Clear();
+						}
+						trans.Commit();
+					}
+					catch
+					{
+						trans.Rollback();
+						throw;
+					}
+				}
+			}
+		}
+		/// <summary>
+		/// 执行一条计算查询结果语句,返回查询结果(object)。
+		/// </summary>
+		/// <param name="SQLString">计算查询结果语句</param>
+		/// <returns>查询结果(object)</returns>
+		public static object GetSingle(string SQLString, params MySqlParameter[] cmdParms)
+		{
+			using (MySqlConnection connection = new MySqlConnection(connectionString))
+			{
+				using (MySqlCommand cmd = new MySqlCommand())
+				{
+					try
+					{
+						PrepareCommand(cmd, connection, null, SQLString, cmdParms);
+						object obj = cmd.ExecuteScalar();
+						cmd.Parameters.Clear();
+						if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
+						{
+							return null;
+						}
+						else
+						{
+							return obj;
+						}
+					}
+					catch (MySql.Data.MySqlClient.MySqlException e)
+					{
+						throw e;
+					}
+				}
+			}
+		}
+
+		/// <summary>
+		/// 执行查询语句,返回MySqlDataReader ( 注意:调用该方法后,一定要对MySqlDataReader进行Close )
+		/// </summary>
+		/// <param name="strSQL">查询语句</param>
+		/// <returns>MySqlDataReader</returns>
+		public static MySqlDataReader ExecuteReader(string SQLString, params MySqlParameter[] cmdParms)
+		{
+			MySqlConnection connection = new MySqlConnection(connectionString);
+			MySqlCommand cmd = new MySqlCommand();
+			try
+			{
+				PrepareCommand(cmd, connection, null, SQLString, cmdParms);
+				MySqlDataReader myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
+				cmd.Parameters.Clear();
+				return myReader;
+			}
+			catch (MySql.Data.MySqlClient.MySqlException e)
+			{
+				throw e;
+			}
+			//            finally
+			//            {
+			//                cmd.Dispose();
+			//                connection.Close();
+			//            }
+
+		}
+
+		/// <summary>
+		/// 执行查询语句,返回DataSet
+		/// </summary>
+		/// <param name="SQLString">查询语句</param>
+		/// <returns>DataSet</returns>
+		public static DataSet Query(string SQLString, params MySqlParameter[] cmdParms)
+		{
+			using (MySqlConnection connection = new MySqlConnection(connectionString))
+			{
+				MySqlCommand cmd = new MySqlCommand();
+				PrepareCommand(cmd, connection, null, SQLString, cmdParms);
+				using (MySqlDataAdapter da = new MySqlDataAdapter(cmd))
+				{
+					DataSet ds = new DataSet();
+					try
+					{
+						da.Fill(ds, "ds");
+						cmd.Parameters.Clear();
+					}
+					catch (MySql.Data.MySqlClient.MySqlException ex)
+					{
+						throw new Exception(ex.Message);
+					}
+					return ds;
+				}
+			}
+		}
+
+
+
+		private static void PrepareCommand(MySqlCommand cmd, MySqlConnection conn, MySqlTransaction trans, string cmdText, MySqlParameter[] cmdParms)
+		{
+			if (conn.State != ConnectionState.Open)
+				conn.Open();
+			cmd.Connection = conn;
+			cmd.CommandText = cmdText;
+			if (trans != null)
+				cmd.Transaction = trans;
+			cmd.CommandType = CommandType.Text;//cmdType;
+			if (cmdParms != null)
+			{
+
+
+				foreach (MySqlParameter parameter in cmdParms)
+				{
+					if ((parameter.Direction == ParameterDirection.InputOutput || parameter.Direction == ParameterDirection.Input) &&
+						(parameter.Value == null))
+					{
+						parameter.Value = DBNull.Value;
+					}
+					cmd.Parameters.Add(parameter);
+				}
+			}
+		}
+
+		public static DataTable Fill(String sql)
+		{
+			DataTable dt = null;
+			try
+			{
+				DataSet ds = Query(sql);
+				if (ds.Tables.Count > 0)
+				{
+					dt = ds.Tables[0];
+				}
+
+
+			}
+			catch (Exception ex)
+			{
+				dt = null;
+				//throw;
+			}
+			return dt;
+		}
+
+		#endregion
+	}
+}

+ 109 - 0
TimedUpload/utils/NpgsqlHelper.cs

@@ -0,0 +1,109 @@
+using log4net;
+using Npgsql;
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace TimedUpload
+{
+	class NpgsqlHelper
+	{
+		private static readonly ILog log = LogManager.GetLogger(typeof(NpgsqlHelper));
+		private static string ConStr = ConfigurationManager.AppSettings["dbNpgsql"];
+		public static int ExecuteNonQuery(string sql)
+		{
+			int result = -1;
+			using (NpgsqlConnection connection = new NpgsqlConnection(ConStr))
+			{
+				using (NpgsqlCommand command = new NpgsqlCommand(sql, connection))
+				{
+					try
+					{
+						connection.Open();
+						result = command.ExecuteNonQuery();
+						log.Info(sql);
+					}
+					catch (NpgsqlException exception)
+					{
+						log.Error(string.Format("执行SQL[{0}]出错,详细信息为:{1}", sql, exception.Message));
+					}
+					finally
+					{
+						connection.Close();
+					}
+				}
+			}
+			return result;
+		}
+		public static object ExecuteScalar(string sql)
+		{
+			object obj = null;
+			using (NpgsqlConnection connection = new NpgsqlConnection(ConStr))
+			{
+				using (NpgsqlCommand command = new NpgsqlCommand(sql, connection))
+				{
+					try
+					{
+						connection.Open();
+						obj = command.ExecuteScalar();
+						log.Info(sql);
+					}
+					catch (NpgsqlException exception)
+					{
+						obj = -1;
+						log.Error(string.Format("执行SQL[{0}]出错,详细信息为:{1}", sql, exception.Message));
+					}
+					finally
+					{
+						connection.Close();
+					}
+				}
+			}
+			return obj;
+		}
+		public static DataSet ExecuteQuery(string sql)
+		{
+
+			DataSet result = new DataSet();
+			using (NpgsqlConnection connection = new NpgsqlConnection(ConStr))
+			{
+				using (NpgsqlDataAdapter dataAdapter = new NpgsqlDataAdapter(sql, connection))
+				{
+					try
+					{
+						connection.Open();
+						dataAdapter.Fill(result);
+						log.Info(sql);
+					}
+					catch (NpgsqlException exception)
+					{
+						log.Error(string.Format("执行SQL【{0}】出错,详细信息为:{1}", sql, exception.Message));
+					}
+					finally
+					{
+						connection.Close();
+					}
+				}
+			}
+			return result;
+		}
+		public static string DesDecrypt(string decryptString, string key)
+		{
+			byte[] keyBytes = Encoding.UTF8.GetBytes(key.Substring(0, 8));
+			byte[] keyIV = keyBytes;
+			byte[] inputByteArray = Convert.FromBase64String(decryptString);
+			DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
+			MemoryStream mStream = new MemoryStream();
+			CryptoStream cStream = new CryptoStream(mStream, provider.CreateDecryptor(keyBytes, keyIV), CryptoStreamMode.Write);
+			cStream.Write(inputByteArray, 0, inputByteArray.Length);
+			cStream.FlushFinalBlock();
+			return Encoding.UTF8.GetString(mStream.ToArray());
+		}
+	}
+}

+ 16 - 0
TimedUpload/utils/SystemConfig.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.IO;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace TimedUpload
+{
+    public class SystemConfig
+    {
+       
+		
+	}
+}

+ 1 - 0
tongbu

@@ -0,0 +1 @@
+Subproject commit 45b76cce288e0b037019e075b595419bd01d3017