From ba60504e1069372202be948e054bb19c21dea5ca Mon Sep 17 00:00:00 2001
From: smartwyy <645583145@qq.com>
Date: Thu, 30 May 2024 18:45:02 +0800
Subject: [PATCH] =?UTF-8?q?=E5=85=85=E7=94=B5=E8=AE=A2=E5=8D=95=E4=B8=8A?=
=?UTF-8?q?=E4=BC=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Entity/DbModel/Station/ChargeOrder.cs | 68 +++++++++++--------
HybirdFrameworkCore/Utils/ObjUtils.cs | 24 +++++++
Service/Cloud/Client/CloudClient.cs | 41 +++++++----
.../Client/MyTask/ChargeOrderUploadTask.cs | 9 ++-
.../Handler/ChargeRecordUploadResHandler.cs | 2 +-
Service/Station/ChargeOrderService.cs | 15 ++--
6 files changed, 105 insertions(+), 54 deletions(-)
diff --git a/Entity/DbModel/Station/ChargeOrder.cs b/Entity/DbModel/Station/ChargeOrder.cs
index d516fcc..339c531 100644
--- a/Entity/DbModel/Station/ChargeOrder.cs
+++ b/Entity/DbModel/Station/ChargeOrder.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Linq;
-using System.Text;
-using SqlSugar;
+using SqlSugar;
namespace Entity.DbModel.Station
{
@@ -13,9 +10,8 @@ namespace Entity.DbModel.Station
{
public ChargeOrder()
{
-
-
}
+
///
/// Desc:id
/// Default:
@@ -63,12 +59,14 @@ namespace Entity.DbModel.Station
///
[SugarColumn(ColumnName = "charger_gun_no")]
public string ChargerGunNo { get; set; }
+
///
/// 0:站内充电 1:站外充电
///
[SugarColumn(ColumnName = "charge_mode")]
public int ChargeMode { get; set; }
+
///
/// 1:站控启动 2:本地启动
///
@@ -108,13 +106,13 @@ namespace Entity.DbModel.Station
[SugarColumn(ColumnName = "stop_soc")]
public int? StopSoc { get; set; }
- ///
- /// Desc:充电时长
- /// Default:
- /// Nullable:True
- ///
- [SugarColumn(ColumnName="charge_time_count")]
- public int? ChargeTimeCount {get;set;}
+ ///
+ /// Desc:充电时长
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName = "charge_time_count")]
+ public int? ChargeTimeCount { get; set; }
///
/// Desc:充电电量
@@ -124,21 +122,21 @@ namespace Entity.DbModel.Station
[SugarColumn(ColumnName = "elec_count")]
public decimal? ElecCount { get; set; }
- ///
- /// Desc:交流电表量
- /// Default:
- /// Nullable:True
- ///
- [SugarColumn(ColumnName="ac_elec_count")]
- public decimal? AcElecCount {get;set;}
+ ///
+ /// Desc:交流电表量
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName = "ac_elec_count")]
+ public decimal? AcElecCount { get; set; }
- ///
- /// Desc:充电开始交流表电量
- /// Default:
- /// Nullable:True
- ///
- [SugarColumn(ColumnName="start_ac_elec")]
- public decimal? StartAcElec {get;set;}
+ ///
+ /// Desc:充电开始交流表电量
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName = "start_ac_elec")]
+ public decimal? StartAcElec { get; set; }
///
/// Desc:充电结束交流表电量
@@ -298,6 +296,20 @@ namespace Entity.DbModel.Station
[SugarColumn(ColumnName = "cloud_sn")]
public string? CloudSn { get; set; }
+ ///
+ /// Desc:云平台订单编号
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName = "cloud_charge_order")]
+ public string CloudChargeOrder { get; set; }
+ ///
+ /// Desc:是否可以上传云平台 0-不可用;1-可以
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName = "can_upload")]
+ public int? CanUpload { get; set; }
}
-}
+}
\ No newline at end of file
diff --git a/HybirdFrameworkCore/Utils/ObjUtils.cs b/HybirdFrameworkCore/Utils/ObjUtils.cs
index 5ccb25c..fb39f97 100644
--- a/HybirdFrameworkCore/Utils/ObjUtils.cs
+++ b/HybirdFrameworkCore/Utils/ObjUtils.cs
@@ -25,6 +25,28 @@ public static class ObjUtils
return o != null;
}
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static bool IsEmpty(List? list)
+ {
+ return list == null || list.Count == 0;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static bool IsNotEmpty(List? list)
+ {
+ return list is { Count: >= 0 };
+ }
+
///
///
///
@@ -44,4 +66,6 @@ public static class ObjUtils
{
return !string.IsNullOrWhiteSpace(o);
}
+
+ public static readonly List
///
///
- public async Task> Upload2Cloud(int id)
+ public Result Upload2Cloud(string cloudChargerOrder)
{
- ChargeOrder? order = await BaseDal.QueryByIdAsync(id);
- if (ObjUtils.IsNull(order))
+ List orders = BaseDal.QueryListByClause(it => it.CloudChargeOrder == cloudChargerOrder);
+ if (ObjUtils.IsEmpty(orders))
{
return Result.Fail("数据不存在");
}
- if (order.CloudReportStatus == 1)
+ if ( orders[0].CloudReportStatus == 1)
{
return Result.Success("已经上传到云平台");
}
- CloudClientMgr.CloudClient?.PublishChargeOrder(order, 2);
+ CloudClientMgr.CloudClient?.PublishChargeOrder(orders, 2);
return Result.Success();
}
}
\ No newline at end of file