|
@@ -77,7 +77,8 @@ internal partial class ProfileHandler
|
|
|
//private readonly IDbContextFactory<MeterValueDBContext> metervaluedbContextFactory;
|
|
|
private readonly IBusinessServiceFactory businessServiceFactory;
|
|
|
private readonly IMainDbService mainDbService;
|
|
|
- private OuterHttpClient httpClient;
|
|
|
+ private readonly WebDbService webDbService;
|
|
|
+ private OuterHttpClient httpClient;
|
|
|
|
|
|
public ProfileHandler(
|
|
|
IConfiguration configuration,
|
|
@@ -87,7 +88,8 @@ internal partial class ProfileHandler
|
|
|
ConnectorStatusDbService connectorStatusDbService,
|
|
|
IBusinessServiceFactory businessServiceFactory,
|
|
|
IMainDbService mainDbService,
|
|
|
- ILogger<ProfileHandler> logger,
|
|
|
+ WebDbService webDbService,
|
|
|
+ ILogger<ProfileHandler> logger,
|
|
|
ServerMessageService messageService,
|
|
|
OuterHttpClient httpClient)
|
|
|
{
|
|
@@ -100,8 +102,8 @@ internal partial class ProfileHandler
|
|
|
this.meterValueDbService = meterValueDbService;
|
|
|
this.connectorStatusDbService = connectorStatusDbService;
|
|
|
this.mainDbService = mainDbService;
|
|
|
-
|
|
|
- this.businessServiceFactory = businessServiceFactory;
|
|
|
+ this.webDbService = webDbService;
|
|
|
+ this.businessServiceFactory = businessServiceFactory;
|
|
|
this.httpClient = httpClient;
|
|
|
}
|
|
|
|
|
@@ -804,7 +806,7 @@ internal partial class ProfileHandler
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- if (session.IsBilling)
|
|
|
+ if (session.IsBilling || await webDbService.GetStationIsPeriodEnergyRequired(session.ChargeBoxId))
|
|
|
{
|
|
|
await messageService.SendDataTransferRequest(
|
|
|
session.ChargeBoxId,
|
|
@@ -1011,7 +1013,20 @@ internal partial class ProfileHandler
|
|
|
var txEnergy = JsonConvert.DeserializeObject<TransactionEnergy>(_confirm.data);
|
|
|
var feedto = await db.TransactionRecord.Where(x => x.Id == txEnergy.TxId).Select(x => new { Id = x.Id, ConnectorId = x.ConnectorId, Fee = x.Fee, StopTime = x.StopTime, StartTime = x.StartTime, NotifyPnC = x.NotifyPnC }).FirstOrDefaultAsync();
|
|
|
decimal chargedEnergy = 0m;
|
|
|
- if (feedto == null || string.IsNullOrEmpty(feedto.Fee)) return result;
|
|
|
+
|
|
|
+ if (feedto == null)
|
|
|
+ return result;
|
|
|
+
|
|
|
+ if (string.IsNullOrEmpty(feedto.Fee))
|
|
|
+ {
|
|
|
+ if (feedto.StopTime != GlobalConfig.DefaultNullTime)
|
|
|
+ {
|
|
|
+ await mainDbService.InsertOrUpdateTransactionPeriodEnergy(txEnergy.TxId, txEnergy.PeriodEnergy);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (feedto == null || string.IsNullOrEmpty(feedto.Fee)) return result;
|
|
|
|
|
|
if (!feedto.NotifyPnC && !string.IsNullOrEmpty(txEnergy.EVCCID))
|
|
|
{
|