XMTT 6 gadi atpakaļ
vecāks
revīzija
fce377d07e

+ 43 - 0
src/main/java/com/ekexiu/project/bridge/collect/CollectService.java

@ -136,6 +136,49 @@ public class CollectService {
136 136
		return ret;
137 137
	}
138 138

139
    @Get
140
    @Path("/wave/server/dayTime")
141
    public List<WaveDataItem> waveByDayTime(@JdbcConn Connection con, String[] seq, String begin,String end) throws SQLException, IOException {
142
        List<WaveDataItem> ret = new LinkedList<WaveDataItem>();
143
        for (String s : seq) {
144
            File path = new File(this.backupPath, s);
145
            if (path.exists() && path.isDirectory()) {
146
                File file = new File(path, begin.substring(0,8) + ".wave");
147
                if (file.exists() && file.isFile()) {
148
                    InputStream in = null;
149
                    try {
150
                        in = new FileInputStream(file);
151
                        BufferedReader reader = new BufferedReader(new InputStreamReader(in, ConstData.UTF8));
152
                        String line;
153
                        while ((line = reader.readLine()) != null) {
154
                            List<String> ls = ListUtil.splitTrimExcludeEmpty(line, ',');
155
                            if (ls.size() != 5) {
156
                                throw new IOException("invalid context:line===>" + line);
157
                            }
158
                            WaveDataItem wdi = new WaveDataItem();
159
                            wdi.setSeq(s);
160
                            wdi.setHvalue(Integer.parseInt(ls.get(0)));
161
                            wdi.setLvalue(Integer.parseInt(ls.get(1)));
162
                            wdi.setCid(Integer.parseInt(ls.get(2)));
163
                            wdi.setDid(Integer.parseInt(ls.get(3)));
164
                            wdi.setCtime(ls.get(4));
165
                            String time = wdi.getCtime();
166
                            if((time.compareTo(begin)>=0)&&(time.compareTo(end)<=0)) {
167
                                ret.add(wdi);
168
                            }
169
                        }
170
                        reader.close();
171
                    } finally {
172
                        if (in != null) {
173
                            IoUtil.close(in);
174
                        }
175
                    }
176
                }
177
            }
178
        }
179
        return ret;
180
    }
181

139 182
	@Get
140 183
	@Path("/wave/server/time")
141 184
	public List<WaveDataItem> waveByDay(@JdbcConn Connection con, String[] seq, String begin, String end) throws SQLException {