123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- package com.warewms.service.impl;
- import com.warewms.common.utils.HttpRequest;
- import com.warewms.common.utils.JsonUtils;
- import com.warewms.model.HeXunAlarmData;
- import com.warewms.model.MachAlarmRecords;
- import com.warewms.service.HeXunDataService;
- import com.warewms.service.MachAlarmRecordsService;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.util.List;
- /**
- * PackageName:com.warewms.service.impl
- * Description:
- * Author:Gizmo
- * Date:2022/9/30
- */
- @Slf4j
- @Service
- public class HeXunDataServiceImpl implements HeXunDataService {
- @Autowired
- private MachAlarmRecordsService machAlarmRecordsService;
- @Override
- public void uploadAlarmData() {
- MachAlarmRecords queryRecord = new MachAlarmRecords();
- queryRecord.setUploadFlag("0");
- List<MachAlarmRecords> machAlarmRecordsList = machAlarmRecordsService.findByModel(queryRecord);
- for (MachAlarmRecords machAlarmRecords : machAlarmRecordsList) {
- HeXunAlarmData heXunAlarmData = new HeXunAlarmData();
- heXunAlarmData.setPrivate_key("E46C9E1EB7");
- heXunAlarmData.setRobotCode(machAlarmRecords.getMachNo());
- heXunAlarmData.setMapOrientation(machAlarmRecords.getAlarmMark());
- heXunAlarmData.setXCoord(machAlarmRecords.getXCoordinate());
- heXunAlarmData.setYCoord(machAlarmRecords.getYCoordinate());
- heXunAlarmData.setAddTime(machAlarmRecords.getTimestamp());
- heXunAlarmData.setVideoAddress(machAlarmRecords.getVideoUrl());
- heXunAlarmData.setAlarmType(machAlarmRecords.getDeviceType());
- heXunAlarmData.setAlarmLevel(machAlarmRecords.getAlarmLevel());
- heXunAlarmData.setAlarmContent(machAlarmRecords.getAlarmMsg());
- heXunAlarmData.setSystemType(machAlarmRecords.getSysType());
- heXunAlarmData.setDeviceCode(machAlarmRecords.getDeviceName());
- heXunAlarmData.setAlarmImg(machAlarmRecords.getImgUrl());
- try {
- String response = HttpRequest.postData("http://hxetm.com:20974/Interface_JCHGJT/info/addAlarm.do", JsonUtils.toJson(heXunAlarmData));
- log.info("http response:" + response);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
|