Skip to content

Commit

Permalink
While inserting convert from MUT to UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
HariharanAnantharaman committed Apr 5, 2018
1 parent 2abe37f commit 60783a9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private JSONObject getRowToFlowJson(ResultSet rs) throws SQLException{
Date date=new Date(timestamp.getTime());
SimpleDateFormat myFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
String dateVal=myFormat.format(date);

System.out.println("Date val is:"+dateVal);
JSONObject json = new JSONObject();
json.put("flow", flow);
json.put("date", dateVal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,9 @@ public void insertData(Telemetry telemetry){
}else{

Calendar date=Calendar.getInstance(TimeZone.getTimeZone(influxProperties.getDatatimezone()));

//Date inputDate=telemetry.getDate();
Calendar inputCal=Calendar.getInstance();
Calendar inputCal=Calendar.getInstance(TimeZone.getTimeZone(influxProperties.getDatatimezone()));
inputCal.setTime(telemetry.getDate());
date.set(Calendar.YEAR,inputCal.get(Calendar.YEAR));
date.set(Calendar.MONTH,inputCal.get(Calendar.MONTH));
Expand Down Expand Up @@ -889,7 +890,7 @@ public void insertTimeSeriesData(SeriesPointData pointData){

Calendar date=Calendar.getInstance(TimeZone.getTimeZone(influxProperties.getDatatimezone()));
//Date inputDate=telemetry.getDate();
Calendar inputCal=Calendar.getInstance();
Calendar inputCal=Calendar.getInstance(TimeZone.getTimeZone(influxProperties.getDatatimezone()));
inputCal.setTime(pointData.getTimestamp());
date.set(Calendar.YEAR,inputCal.get(Calendar.YEAR));
date.set(Calendar.MONTH,inputCal.get(Calendar.MONTH));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.techolution.mauritius.smartwater.notification.domain;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
Expand Down Expand Up @@ -109,5 +111,8 @@ public String getCurrentstatus() {
public void setCurrentstatus(String currentstatus) {
this.currentstatus = currentstatus;
}

@OneToMany(mappedBy="house_id")
Set<NotificationDetails> notifications;

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

Expand Down Expand Up @@ -110,8 +111,8 @@ public void setInformation(String information) {
private String information;


/*@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name="meter_id", nullable=true)
private MeterConnection connection ;*/
@ManyToOne(fetch = FetchType.EAGER)
@JoinTable(name="connection_details",joinColumns= @JoinColumn(name="meter_id", referencedColumnName = "house_id"))
private MeterConnection connection ;

}

0 comments on commit 60783a9

Please sign in to comment.