修复执行bug

main
潘建东 6 months ago
parent de831eba9d
commit 64d3742833

@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq; using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
@ -146,21 +147,7 @@ namespace ZKLT.Hadoop.Model
/// <param name="data">数据</param> /// <param name="data">数据</param>
/// <returns></returns> /// <returns></returns>
public static JObject Class2JObject(object data) { public static JObject Class2JObject(object data) {
var _result = new JObject(); return JsonConvert.DeserializeObject<JObject>(JsonConvert.SerializeObject(data)!)!;
Type _type = data.GetType();
var _properties = _type.GetProperties();
foreach (var _property in _properties)
{
if (_property.GetValue(data) != null)
{
_result.Add(new JProperty(_property.Name, _property.GetValue(data)!));
}
}
return _result;
} }
} }
} }

@ -483,7 +483,7 @@ namespace ZKLT.Hadoop
_result += _connection.Execute(_command.ToString(), _params); _result += _connection.Execute(_command.ToString(), _params);
} }
_connection.Close(); _connection.Close();
if (_result == _data.Count) if (_result >= _data.Count)
{ {
_scope.Complete(); _scope.Complete();
return true; return true;
@ -581,7 +581,7 @@ namespace ZKLT.Hadoop
_result += _connection.Execute(_command.ToString(), _params); _result += _connection.Execute(_command.ToString(), _params);
} }
_connection.Close(); _connection.Close();
if (_result == _data.Count) if (_result >= _data.Count)
{ {
_scope.Complete(); _scope.Complete();
return true; return true;
@ -657,7 +657,7 @@ namespace ZKLT.Hadoop
_result += _connection.Execute(_command.ToString(), _params); _result += _connection.Execute(_command.ToString(), _params);
} }
_connection.Close(); _connection.Close();
if (_result == _data.Count) if (_result >= _data.Count)
{ {
_scope.Complete(); _scope.Complete();
return true; return true;

Loading…
Cancel
Save