コード例 #1
0
 @Override
 @SuppressWarnings("unchecked")
 public List<Transaction> getTransactions(TransactionQueryForm form) {
   return getInternal(form)
       .fetch()
       .map(
           r ->
               Transaction.builder()
                   .id(r.value1())
                   .chargeBoxId(r.value2())
                   .connectorId(r.value3())
                   .ocppIdTag(r.value4())
                   .startTimestamp(DateTimeUtils.humanize(r.value5()))
                   .startValue(r.value6())
                   .stopTimestamp(DateTimeUtils.humanize(r.value7()))
                   .stopValue(r.value8())
                   .chargeBoxPk(r.value9())
                   .ocppTagPk(r.value10())
                   .build());
 }
コード例 #2
0
 @Override
 public List<ChargePoint.Overview> getOverview(ChargePointQueryForm form) {
   return getOverviewInternal(form)
       .map(
           r ->
               ChargePoint.Overview.builder()
                   .chargeBoxPk(r.value1())
                   .chargeBoxId(r.value2())
                   .description(r.value3())
                   .ocppProtocol(r.value4())
                   .lastHeartbeatTimestamp(DateTimeUtils.humanize(r.value5()))
                   .build());
 }
コード例 #3
0
  @Override
  public List<ConnectorStatus> getChargePointConnectorStatus() {
    // Prepare for the inner select of the second join
    Field<Integer> t1Pk = CONNECTOR_STATUS.CONNECTOR_PK.as("t1_pk");
    Field<DateTime> t1Max = DSL.max(CONNECTOR_STATUS.STATUS_TIMESTAMP).as("t1_max");
    TableLike<?> t1 =
        ctx.select(t1Pk, t1Max)
            .from(CONNECTOR_STATUS)
            .groupBy(CONNECTOR_STATUS.CONNECTOR_PK)
            .asTable("t1");

    return ctx.select(
            CHARGE_BOX.CHARGE_BOX_PK,
            CONNECTOR.CHARGE_BOX_ID,
            CONNECTOR.CONNECTOR_ID,
            CONNECTOR_STATUS.STATUS_TIMESTAMP,
            CONNECTOR_STATUS.STATUS,
            CONNECTOR_STATUS.ERROR_CODE)
        .from(CONNECTOR_STATUS)
        .join(CONNECTOR)
        .onKey()
        .join(CHARGE_BOX)
        .on(CHARGE_BOX.CHARGE_BOX_ID.eq(CONNECTOR.CHARGE_BOX_ID))
        .join(t1)
        .on(CONNECTOR_STATUS.CONNECTOR_PK.equal(t1.field(t1Pk)))
        .and(CONNECTOR_STATUS.STATUS_TIMESTAMP.equal(t1.field(t1Max)))
        .orderBy(CONNECTOR_STATUS.STATUS_TIMESTAMP.desc())
        .fetch()
        .map(
            r ->
                ConnectorStatus.builder()
                    .chargeBoxPk(r.value1())
                    .chargeBoxId(r.value2())
                    .connectorId(r.value3())
                    .timeStamp(DateTimeUtils.humanize(r.value4()))
                    .status(r.value5())
                    .errorCode(r.value6())
                    .build());
  }