Browse Source

添加执行操作

lcl 1 year ago
parent
commit
0d8cd84f9f
8 changed files with 53 additions and 5 deletions
  1. BIN
      .DS_Store
  2. 44 1
      AppStart/Helper/ExportService.cs
  3. BIN
      BLL/LitJSON.dll
  4. BIN
      BLL/MySystemLib.dll
  5. BIN
      BLL/Newtonsoft.Json.dll
  6. BIN
      BLL/ThoughtWorks.QRCode.dll
  7. 4 4
      MySystem.csproj
  8. 5 0
      global.json

BIN
.DS_Store


+ 44 - 1
AppStart/Helper/ExportService.cs

@@ -35,7 +35,16 @@ namespace MySystem
                 {
                     try
                     {
-                        StartExport(content);
+                        JsonData jsonObj = JsonMapper.ToObject(content);
+                        string FileName = jsonObj["FileName"].ToString();
+                        if(FileName == "执行")
+                        {
+                            StartExcute(content);
+                        }
+                        else
+                        {
+                            StartExport(content);
+                        }
                     }
                     catch(Exception ex)
                     {
@@ -48,6 +57,40 @@ namespace MySystem
                 }
             }
         }
+        public void StartExcute(string content)
+        {
+            function.WriteLog(DateTime.Now.ToString() + "\n" + content, "执行日志");
+            JsonData jsonObj = JsonMapper.ToObject(content);
+            string Operater = jsonObj["Operater"].ToString();
+            string SqlString = jsonObj["SqlString"].ToString();
+            string FileName = jsonObj["FileName"].ToString();
+            int pageSize = int.Parse(jsonObj["MaxCount"].ToString());
+
+            //执行
+            int page = 0;
+            bool op = true;
+            while(op)
+            {
+                int skip = page * pageSize;
+                string sql = SqlString + " limit " + skip + "," + pageSize;
+                function.WriteLog(sql, "执行日志");
+                DataTable dt = CustomerSqlConn.dtable(sql, MysqlConn.readconnstr);
+                if(dt.Rows.Count > 0)
+                {
+                    string dosql = "";
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        dosql += dr[0].ToString();
+                    }
+                    CustomerSqlConn.op(dosql, MysqlConn.connstr);
+                    page += 1;
+                }
+                else
+                {
+                    op = false;
+                }
+            }
+        }
         public void StartExport(string content)
         {
             function.WriteLog(DateTime.Now.ToString() + "\n" + content, "导出日志");

BIN
BLL/LitJSON.dll


BIN
BLL/MySystemLib.dll


BIN
BLL/Newtonsoft.Json.dll


BIN
BLL/ThoughtWorks.QRCode.dll


+ 4 - 4
MySystem.csproj

@@ -34,19 +34,19 @@
       <HintPath>BLL\aliyun-net-sdk-core.dll</HintPath>
     </Reference>
     <Reference Include="LitJSON">
-      <HintPath>..\..\MySystemLib\MySystemLib\bin\Release\netcoreapp3.0\LitJSON.dll</HintPath>
+      <HintPath>BLL\LitJSON.dll</HintPath>
     </Reference>
     <Reference Include="Newtonsoft.Json">
-      <HintPath>..\..\MySystemLib\MySystemLib\bin\Release\netcoreapp3.0\Newtonsoft.Json.dll</HintPath>
+      <HintPath>BLL\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="ThoughtWorks.QRCode">
-      <HintPath>..\..\MySystemLib\MySystemLib\bin\Release\netcoreapp3.0\ThoughtWorks.QRCode.dll</HintPath>
+      <HintPath>BLL\ThoughtWorks.QRCode.dll</HintPath>
     </Reference>
     <Reference Include="Aliyun.OSS">
       <HintPath>BLL\Aliyun.OSS.dll</HintPath>
     </Reference>
     <Reference Include="MySystemLib">
-      <HintPath>..\..\MySystemLib\MySystemLib\bin\Release\netcoreapp3.0\MySystemLib.dll</HintPath>
+      <HintPath>BLL\MySystemLib.dll</HintPath>
     </Reference>
   </ItemGroup>
   <ItemGroup>

+ 5 - 0
global.json

@@ -0,0 +1,5 @@
+{
+  "sdk": {
+    "version": "3.0.100"
+  }
+}