public String call() throws SQLException {
			Connection conn = null;
			ResultSet rSet = null;
			Timestamp lastDate = getLastDay(new Date(startTimestamp.getTime()));
			try {
				conn = DriverManager.getConnection(Utils.CONNECT_STRING);
				PreparedStatement LastSumStatement = conn
						.prepareStatement(LastSql);
				PreparedStatement MeterLogStatement = conn
						.prepareStatement(getMeterLogSql);
				PreparedStatement DevInsertStatement = conn
						.prepareStatement(deviceSql);
				LastSumStatement.setLong(1, startId);
				LastSumStatement.setLong(2, endId);
				LastSumStatement.setTimestamp(3, lastDate);
				LastSumStatement.setTimestamp(4, startTimestamp);
				rSet = LastSumStatement.executeQuery();
				while (rSet != null && rSet.next()) {
					Long devId = rSet.getLong(1);
					float LastSum = rSet.getFloat(2);
					lastUpdateSum.put(devId, LastSum);
				}
				rSet.close();
				MeterLogStatement.setLong(1, startId);
				MeterLogStatement.setLong(2, endId);
				MeterLogStatement.setTimestamp(3, startTimestamp);
				MeterLogStatement.setTimestamp(4, endTimestamp);
				rSet = MeterLogStatement.executeQuery();
				int i=1;
				while (rSet != null && rSet.next()) {
					Long devId = rSet.getLong(1);
					Timestamp time = rSet.getTimestamp(2);
					float Sum = rSet.getFloat(3);
					Float lastSum = lastUpdateSum.get(devId);
					float usage;
					if (lastSum == null)
						usage = Sum;
					else
						usage = Sum - lastSum;
					lastUpdateSum.put(devId, Sum);
					RealTimePrice lastHappenPrice = RealTimePrice.lower_bound(
							priceList, time);

					float cost = usage * lastHappenPrice.price;

					DevInsertStatement.setLong(1, devId);
					DevInsertStatement.setTimestamp(2, time);
					DevInsertStatement.setFloat(3, usage);
					DevInsertStatement.setFloat(4, cost);
					DevInsertStatement.execute();
					/*System.out.println("devid:" + devId + "----time:" + time
							+ "----usage:" + usage + "----cost:" + cost);*/
					if(i++%5000==0)
						conn.commit();
				}
				conn.commit();

			} catch (Exception e) {
				e.printStackTrace();
			} finally {
				if (!conn.isClosed()) {
					conn.close();
				}
				if (!rSet.isClosed()) {
					rSet.close();
				}
			}
			return "success";
		}