监测平台系统电子围栏添加逻辑,场景设备的显示时间及其余页面接口处理

breach-zhy
马雪伟 2 months ago
parent 50ddc52925
commit 500d6cea99

@ -58,4 +58,6 @@ public interface HwFenceTargetMapper
* @return
*/
public int deleteHwFenceTargetByTargetIds(Long[] targetIds);
public int deleteHwFenceTargetByFenceId(Long[] electronicFenceIds);
}

@ -139,6 +139,7 @@ public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService {
hwAlarmRule.setCreateTime(DateUtils.getNowDate());
hwAlarmRule.setTenantId(SecurityUtils.getTenantId());
hwAlarmRule.setCreateBy(SecurityUtils.getUsername());
hwAlarmRule.setAlarmLevelId(hwAlarmRule.getAlarmTypeId());
int rowsAdd = hwAlarmRuleMapper.insertHwAlarmRule(hwAlarmRule);
insertHwAlarmRuleLink(hwAlarmRule);
rows += rowsAdd;

@ -37,6 +37,10 @@ import sun.reflect.generics.tree.Tree;
import javax.annotation.Resource;
import java.io.File;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@ -421,6 +425,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
String databaseName = TdEngineConstants.getDatabaseName();
List<HwDevice> hwDevices = hwDeviceMapper.selectHwDeviceListByMonitor(queryHwDevice);
if (hwDevices.size()>0){
hwDevices.forEach(hwDevice -> {
Long deviceId = hwDevice.getDeviceId();
HwDeviceModeFunction queryDeviceModeFunction = new HwDeviceModeFunction();
@ -517,9 +522,17 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
hwDeviceVo.setDevicePic(hwDevice.getDevicePic());
hwDeviceVo.setDeviceType(HwDictConstants.ACQUISITION_DEVICE);
hwDeviceVo.setDeviceDataMap(ddValueMap);
if (deviceLatestDataMapList.size()>0){
String ts = deviceLatestDataMapList.get(0).get("ts").toString();
DateTimeFormatter dateTime = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
ZonedDateTime parse = ZonedDateTime.parse(ts, dateTime);
Date updateTime = Date.from(parse.toInstant());
hwDeviceVo.setUpdateTime(updateTime);
}
acquisitionDeviceVos.add(hwDeviceVo);
});
}
devicesMap.put(HwDictConstants.CONTROL_DEVICE_NAME, controlDeviceVos);
devicesMap.put(HwDictConstants.ACQUISITION_DEVICE_NAME, acquisitionDeviceVos);
@ -1170,20 +1183,41 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
String substring = s.substring(1, s.length() - 1);
if (!substring.isEmpty()){
Map map = JSONObject.parseObject(substring, Map.class);
if (map.size()==2){
if (map.size()>0){
// BeaconDevice beaconDevice = new BeaconDevice();
// beaconDevice.setDeviceId(hwDevices.get(i).getDeviceId());
// beaconDevice.setDeviceName(hwDevices.get(i).getDeviceName());
// beaconDevice.setLatitude(Double.valueOf( map.get("latitude").toString()));
// beaconDevice.setLongitude(Double.valueOf( map.get("longitude").toString()));
// beaconDevice.setRemark(hwDevices.get(i).getRemark());
// beaconDevice.setDeviceLocation(hwDevices.get(i).getDeviceLocation());
// beaconDevice.setDeviceLocation("白银市");
// beaconDevice.setDeviceModeId(hwDevices.get(i).getDeviceModeId());
// beaconDevice.setMonitorUnitName(hwDevices.get(i).getMonitorUnitName());
// //查询是否报警
// Long integer = hwDeviceMapper.selectDeviceIfAlarm(hwDevices.get(i).getDeviceId());
// Long integer1 = hwDeviceMapper.selectDeviceIfAlarmElectronFence(hwDevices.get(i).getDeviceId());
String tableName = tdSelectDto.getTableName();
int underscoreIndex = tableName.lastIndexOf('_');
int deviceId = Integer.parseInt(tableName.substring(underscoreIndex + 1));
HwDevice hwDevice = hwDevices.stream().filter(x -> x.getDeviceId() == deviceId).findFirst().get();
if(hwDevice == null){
continue;
}
BeaconDevice beaconDevice = new BeaconDevice();
beaconDevice.setDeviceId(hwDevices.get(i).getDeviceId());
beaconDevice.setDeviceName(hwDevices.get(i).getDeviceName());
beaconDevice.setDeviceId(hwDevice.getDeviceId());
beaconDevice.setDeviceName(hwDevice.getDeviceName());
beaconDevice.setLatitude(Double.valueOf( map.get("latitude").toString()));
beaconDevice.setLongitude(Double.valueOf( map.get("longitude").toString()));
beaconDevice.setRemark(hwDevices.get(i).getRemark());
beaconDevice.setDeviceLocation(hwDevices.get(i).getDeviceLocation());
beaconDevice.setRemark(hwDevice.getRemark());
beaconDevice.setDeviceLocation(hwDevice.getDeviceLocation());
beaconDevice.setDeviceLocation("白银市");
beaconDevice.setDeviceModeId(hwDevices.get(i).getDeviceModeId());
beaconDevice.setMonitorUnitName(hwDevices.get(i).getMonitorUnitName());
beaconDevice.setDeviceModeId(hwDevice.getDeviceModeId());
beaconDevice.setMonitorUnitName(hwDevice.getMonitorUnitName());
//查询是否报警
Long integer = hwDeviceMapper.selectDeviceIfAlarm(hwDevices.get(i).getDeviceId());
Long integer1 = hwDeviceMapper.selectDeviceIfAlarmElectronFence(hwDevices.get(i).getDeviceId());
Long integer = hwDeviceMapper.selectDeviceIfAlarm(hwDevice.getDeviceId());
Long integer1 = hwDeviceMapper.selectDeviceIfAlarmElectronFence(hwDevice.getDeviceId());
Boolean alarmElectronFence = false;
String ifAlarm = new String();
if (integer>0){

@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.ruoyi.business.domain.HwAlarmInfo;
import com.ruoyi.business.domain.HwElectronicFence;
import com.ruoyi.business.domain.HwFenceArea;
import com.ruoyi.business.domain.HwFenceTarget;
import com.ruoyi.business.domain.VO.AlarmInfoVo;
import com.ruoyi.business.domain.VO.ElectronicFenceVo;
import com.ruoyi.business.mapper.HwAlarmInfoMapper;
@ -218,7 +219,12 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService {
hwElectronicFence.setFencePushFlag(HwDictConstants.FENCE_PUSH_FLAG_NO);
hwElectronicFence.setFenceType(HwDictConstants.FENCE_TYPE_SCENE);
hwElectronicFence.setCreateTime(DateUtils.getNowDate());
HwFenceTarget hwFenceTarget = new HwFenceTarget();
int rows = hwElectronicFenceMapper.insertHwElectronicFence(hwElectronicFence);
hwFenceTarget.setElectronicFenceId(hwElectronicFence.getElectronicFenceId());
hwFenceTarget.setTargetId(hwElectronicFence.getDeviceId());
hwFenceTarget.setTargetType("1");
hwFenceTargetMapper.insertHwFenceTarget(hwFenceTarget);
this.batchInsertFenceArea(hwElectronicFence);
return rows;
}
@ -331,6 +337,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService {
public int deleteHwElectronicFenceByElectronicFenceIds(Long[] electronicFenceIds) {
//逻辑删除修改触发状态为9
int rows = hwElectronicFenceMapper.deleteHwElectronicFenceByElectronicFenceIds(electronicFenceIds);
int targetRows = hwFenceTargetMapper.deleteHwFenceTargetByFenceId(electronicFenceIds);
// hwElectronicFenceMapper.deleteHwFenceAreaByElectronicFenceIds(electronicFenceIds);
return rows;
}

Loading…
Cancel
Save