Commit 86e6b4812079eec345d97d0311c27404c4355152

Authored by 杨鸣坤
1 parent c2987ff2

新康达设备上报

... ... @@ -257,22 +257,22 @@ public class XinkangdaDeviceReportService {
257 257 }
258 258 }
259 259
260   -// private void dataUpload(XkdDeviceInfo info) {
261   -// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
262   -// String dataBatch = simpleDateFormat.format(new Date());
263   -// XkdDeviceData data = new XkdDeviceData();
264   -// data.setDeviceId(info.getDeviceId());
265   -// data.setDataBatch(dataBatch);
266   -// ZonedDateTime now = ZonedDateTime.now();
267   -// String iso8601 = now.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
268   -// data.setCollectionTime(iso8601);
269   -// data.setStatus("RUN");
270   -// data.setAlarm(false);
271   -// data.setAlarmName("无");
272   -// data.setEfficiency(78D);
273   -//
274   -// sendDataUpload(data);
275   -// }
  260 + private void dataUpload(XkdDeviceInfo info) {
  261 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
  262 + String dataBatch = simpleDateFormat.format(new Date());
  263 + XkdDeviceData data = new XkdDeviceData();
  264 + data.setDeviceId(info.getDeviceId());
  265 + data.setDataBatch(dataBatch);
  266 + ZonedDateTime now = ZonedDateTime.now();
  267 + String iso8601 = now.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
  268 + data.setCollectionTime(iso8601);
  269 + data.setStatus("RUN");
  270 + data.setAlarm(false);
  271 + data.setAlarmName("无");
  272 + data.setEfficiency(78D);
  273 +
  274 + sendDataUpload(data);
  275 + }
276 276
277 277 private boolean sendDataUpload(XkdDeviceData data) {
278 278 String deviceId = data.getDeviceId();
... ... @@ -330,7 +330,9 @@ public class XinkangdaDeviceReportService {
330 330
331 331 // 设备注册,只需要执行一次,本地执行完成
332 332 public void devicesRegister() {
333   - String filePath = "C:\\Users\\PC\\Desktop\\xdkdevice.xlsx";
  333 +// String filePath = "C:\\Users\\PC\\Desktop\\xdkdevice.xlsx";
  334 + String filePath = "C:\\Users\\PC\\Desktop\\dcs数据.xlsx";
  335 +
334 336 try (InputStream in = new FileInputStream(new File(filePath));
335 337 // 使用 WorkbookFactory 自动根据文件格式创建合适的 Workbook
336 338 Workbook workbook = WorkbookFactory.create(in)) {
... ... @@ -339,12 +341,12 @@ public class XinkangdaDeviceReportService {
339 341 for (int index = 1; index <= lastRowNum; index++) {
340 342 Row row = sheet.getRow(index);
341 343 XkdDeviceInfo info = new XkdDeviceInfo();
342   - info.setDeviceId(row.getCell(4).getStringCellValue());
343   - info.setDeviceName(row.getCell(3).getStringCellValue());
344   - info.setDeviceType(row.getCell(5).getStringCellValue());
  344 + info.setDeviceId(row.getCell(5).getStringCellValue());
  345 + info.setDeviceName(row.getCell(1).getStringCellValue());
  346 + info.setDeviceType(row.getCell(6).getStringCellValue());
345 347 info.setLocation(row.getCell(1).getStringCellValue() + "-" + row.getCell(2).getStringCellValue());
346 348 sendReportDevice(info);
347   -// dataUpload(info);
  349 + dataUpload(info);
348 350 }
349 351 } catch (Exception e) {
350 352 e.printStackTrace();
... ...
No preview for this file type