change - 接口数据修改

breach-zhy
wenjy 7 months ago
parent 3040987fec
commit 035daf5a09

@ -327,11 +327,15 @@ public class HwMonitorPlatformController extends BaseController {
public TableDataInfo selectBeaconDevicesHistory(@RequestParam(required = false) Map map){
// List<BeaconDevice> beaconDevices = hwDeviceService.selectBeaconDevicesHistory(map);
List<Map<String, Object>> lists = hwDeviceService.selectBeaconDevicesHistory(map);
long total = Long.valueOf(lists.get(lists.size() - 1).get("total").toString());
lists.remove(lists.size() - 1);
TableDataInfo dataTable = getDataTable(lists);
dataTable.setTotal(total);
return dataTable;
if(lists != null){
long total = Long.valueOf(lists.get(lists.size() - 1).get("total").toString());
lists.remove(lists.size() - 1);
TableDataInfo dataTable = getDataTable(lists);
dataTable.setTotal(total);
return dataTable;
}else {
return null;
}
}
/**
* id

@ -25,6 +25,8 @@ public class BeaconDevice {
private String ifAlarm;
private String monitorUnitName;
public String getIfAlarm() {
return ifAlarm;
}
@ -97,6 +99,14 @@ public class BeaconDevice {
this.longitude = longitude;
}
public String getMonitorUnitName() {
return monitorUnitName;
}
public void setMonitorUnitName(String monitorUnitName) {
this.monitorUnitName = monitorUnitName;
}
@Override
public String toString() {
return "BeaconDevice{" +

@ -111,8 +111,8 @@ public class HwAlarmInfo extends BaseEntity {
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "实际报警时间", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "实际报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date alarmTime;
/**
@ -124,6 +124,9 @@ public class HwAlarmInfo extends BaseEntity {
private String monitorUnitName;
private String alarmLevelName;
private String alarmTypeName;
private String areaName;
private String monitorUnitTypeName;
/**
*
* */
@ -297,6 +300,22 @@ public class HwAlarmInfo extends BaseEntity {
this.alarmTypeName = alarmTypeName;
}
public String getAreaName() {
return areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public String getMonitorUnitTypeName() {
return monitorUnitTypeName;
}
public void setMonitorUnitTypeName(String monitorUnitTypeName) {
this.monitorUnitTypeName = monitorUnitTypeName;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -47,6 +47,8 @@ public class HwDevice extends BaseEntity {
@Excel(name = "所属监控单元")
private Long monitorUnitId;
private String monitorUnitName;
/**
* 123
*/
@ -189,8 +191,6 @@ public class HwDevice extends BaseEntity {
this.functionName = functionName;
}
private String monitorUnitName;
private String sceneName;
private String deviceModeName;
private String tenantName;

@ -14,9 +14,6 @@ public class AlarmInfoExportVo {
@Excel(name = "报警id")
private Long alarmInfoId;
@Excel(name = "报警区域")
private String areaName;
@Excel(name = "报警位置")
private String monitorUnitName;
@ -38,6 +35,9 @@ public class AlarmInfoExportVo {
@Excel(name = "类型")
private String monitor_unit_type_name;
@Excel(name = "报警区域")
private String areaName;
public Long getAlarmInfoId() {
return alarmInfoId;
}

@ -1180,6 +1180,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
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());
String ifAlarm = new String();
@ -1209,35 +1210,39 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
* */
@Override
public List<Map<String, Object>> selectBeaconDevicesHistory(Map map) {
TdHistorySelectDto tdHistorySelectDto = new TdHistorySelectDto();
tdHistorySelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME);
tdHistorySelectDto.setTableName(TdEngineConstants.DEFAULT_TABLE_NAME_PREFIX+map.get("deviceId"));
tdHistorySelectDto.setFirstFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME);
if (map.get("pageSize")!=null){
tdHistorySelectDto.setLimit(Integer.valueOf(map.get("pageSize").toString()));
}
if (map.get("pageSize")!=null&&map.get("pageNum")!=null){
tdHistorySelectDto.setOffset(Integer.valueOf(map.get("pageSize").toString())*(Integer.valueOf(map.get("pageNum").toString())-1));
}
tdHistorySelectDto.setOrderByFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME);
tdHistorySelectDto.setSort(TdEngineConstants.DEFAULT_ORDER_BY_MODE);
if (map.containsKey("startTime")&&map.get("startTime")!=null){
tdHistorySelectDto.setStartTime(Timestamp.valueOf(map.get("startTime").toString()).getTime());
}
if (map.containsKey("endTime")&&map.get("endTime")!=null){
tdHistorySelectDto.setEndTime(Timestamp.valueOf(map.get("endTime").toString()).getTime());
}
R<TdReturnDataVo> historyData = remoteTdEngineService.getHistoryData(tdHistorySelectDto, SecurityConstants.INNER);
System.out.println("查询历史数据"+map.get("deviceId"));
List<Map<String, Object>> dataList = historyData.getData().dataList;
for (int i = 0; i < dataList.size(); i++){
dataList.get(i).put("deviceId",map.get("deviceId"));
try{
TdHistorySelectDto tdHistorySelectDto = new TdHistorySelectDto();
tdHistorySelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME);
tdHistorySelectDto.setTableName(TdEngineConstants.DEFAULT_TABLE_NAME_PREFIX+map.get("deviceId"));
tdHistorySelectDto.setFirstFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME);
if (map.get("pageSize")!=null){
tdHistorySelectDto.setLimit(Integer.valueOf(map.get("pageSize").toString()));
}
if (map.get("pageSize")!=null&&map.get("pageNum")!=null){
tdHistorySelectDto.setOffset(Integer.valueOf(map.get("pageSize").toString())*(Integer.valueOf(map.get("pageNum").toString())-1));
}
tdHistorySelectDto.setOrderByFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME);
tdHistorySelectDto.setSort(TdEngineConstants.DEFAULT_ORDER_BY_MODE);
if (map.containsKey("startTime")&&map.get("startTime")!=null){
tdHistorySelectDto.setStartTime(Timestamp.valueOf(map.get("startTime").toString()).getTime());
}
if (map.containsKey("endTime")&&map.get("endTime")!=null){
tdHistorySelectDto.setEndTime(Timestamp.valueOf(map.get("endTime").toString()).getTime());
}
R<TdReturnDataVo> historyData = remoteTdEngineService.getHistoryData(tdHistorySelectDto, SecurityConstants.INNER);
System.out.println("查询历史数据"+map.get("deviceId"));
List<Map<String, Object>> dataList = historyData.getData().dataList;
for (int i = 0; i < dataList.size(); i++){
dataList.get(i).put("deviceId",map.get("deviceId"));
}
int count = historyData.getData().count;
Map<String, Object> map1 = new HashMap<>();
map1.put("total",count);
dataList.add(map1);
return dataList;
}catch (Exception ex){
return null;
}
int count = historyData.getData().count;
Map<String, Object> map1 = new HashMap<>();
map1.put("total",count);
dataList.add(map1);
return dataList;
}
/**

@ -29,6 +29,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="monitorUnitName" column="monitor_unit_name" />
<result property="alarmLevelName" column="alarm_level_name" />
<result property="alarmTypeName" column="alarm_type_name" />
<result property="areaName" column="area_name" />
<result property="monitorUnitTypeName" column="monitor_unit_type_name" />
</resultMap>
<resultMap type="AlarmTypeVo" id="AlarmTypeVoResult">
@ -55,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectHwAlarmInfoVo">
select hai.alarm_info_id, hai.alarm_info_type, hai.alarm_releated_id, hai.device_id,
/*select hai.alarm_info_id, hai.alarm_info_type, hai.alarm_releated_id, hai.device_id,
hai.monitor_unit_id, hai.tenant_id, hai.scene_id, hai.alarm_level_id,
hai.alarm_type_id, hai.mode_function_id, hai.function_name, hai.function_identifier,
hai.function_value, hai.trigger_status, hai.handle_status, hai.alarm_time,
@ -63,7 +65,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
hmu.monitor_unit_name,hal.alarm_level_name,hat.alarm_type_name
from hw_alarm_info hai left join hw_monitor_unit hmu on hai.monitor_unit_id = hmu.monitor_unit_id
left join hw_alarm_level hal on hai.alarm_level_id=hal.alarm_level_id
left join hw_alarm_type hat on hai.alarm_type_id=hat.alarm_type_id
left join hw_alarm_type hat on hai.alarm_type_id=hat.alarm_type_id*/
select hai.alarm_info_id,
hai.alarm_info_type,
hai.alarm_releated_id,
hai.device_id,
hai.monitor_unit_id,
hai.tenant_id,
hai.scene_id,
hai.alarm_level_id,
hai.alarm_type_id,
hai.mode_function_id,
hai.function_name,
hai.function_identifier,
hai.function_value,
hai.trigger_status,
hai.handle_status,
hai.alarm_time,
hai.create_time,
hai.update_by,
hai.update_time,
hai.alarm_info_field,
hmu.monitor_unit_name,
hal.alarm_level_name,
hat.alarm_type_name,
ha.area_name,
hmut.monitor_unit_type_name
from hw_alarm_info hai
left join hw_monitor_unit hmu on hai.monitor_unit_id = hmu.monitor_unit_id
left join hw_alarm_level hal on hai.alarm_level_id = hal.alarm_level_id
left join hw_alarm_type hat on hai.alarm_type_id = hat.alarm_type_id
left join hw_area ha on ha.area_id = hmu.area_id
left join hw_monitor_unit_type hmut on hmu.monitor_unit_type_id = hmut.monitor_unit_type_id
</sql>
<select id="selectHwAlarmInfoList" parameterType="HwAlarmInfo" resultMap="HwAlarmInfoResult">

@ -77,11 +77,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectDeviceNum" parameterType="Long" resultMap="HwDeviceResult" >
<include refid="selectHwDeviceVo"/>
where scene_id = #{sceneId}
where hd.scene_id = #{sceneId}
</select>
<select id="selectDeviceByMonitorId" parameterType="Long" resultMap="HwDeviceResult">
<include refid="selectHwDeviceVo"/>
where monitor_unit_id = #{monitorUnitId}
where hd.monitor_unit_id = #{monitorUnitId}
</select>
<select id="selectDeviceByDeviceModeBySceneId" parameterType="Long" resultMap="HwDeviceResult">
select * from hw_device where device_mode_id = (
@ -94,36 +94,67 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!--以上为监控平台接口所用-->
<sql id="selectHwDeviceVo">
select device_id, device_code, device_name, scene_id, monitor_unit_id, device_type, networking_mode, access_protocol, data_format, releated_device_id, device_mode_id, access_gw_protocol, active_status, device_status, active_time, device_pic, ip_address, area_id, device_location, current_module_version, current_singlechip_version, remark, create_by, create_time, update_by, update_time, device_field, tenant_id, online_status from hw_device hd
select hd.device_id,
hd.device_code,
hd.device_name,
hd.scene_id,
hd.monitor_unit_id,
hmu.monitor_unit_name,
hd.device_type,
hd.networking_mode,
hd.access_protocol,
hd.data_format,
hd.releated_device_id,
hd.device_mode_id,
hd.access_gw_protocol,
hd.active_status,
hd.device_status,
hd.active_time,
hd.device_pic,
hd.ip_address,
hd.area_id,
hd.device_location,
hd.current_module_version,
hd.current_singlechip_version,
hd.remark,
hd.create_by,
hd.create_time,
hd.update_by,
hd.update_time,
hd.device_field,
hd.tenant_id,
hd.online_status
from hw_device hd
left join hw_monitor_unit hmu on hmu.monitor_unit_id = hd.monitor_unit_id
</sql>
<select id="selectHwDeviceList" parameterType="HwDevice" resultMap="HwDeviceResult">
<include refid="selectHwDeviceVo"/>
<where>
and device_status !='9'
<if test="deviceCode != null and deviceCode != ''"> and device_code like concat('%', #{deviceCode}, '%')</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="sceneId != null "> and scene_id = #{sceneId}</if>
<if test="monitorUnitId != null "> and monitor_unit_id = #{monitorUnitId}</if>
<if test="deviceType != null and deviceType != ''"> and device_type = #{deviceType}</if>
<if test="networkingMode != null and networkingMode != ''"> and networking_mode = #{networkingMode}</if>
<if test="accessProtocol != null "> and access_protocol = #{accessProtocol}</if>
<if test="dataFormat != null "> and data_format = #{dataFormat}</if>
<if test="releatedDeviceId != null "> and releated_device_id = #{releatedDeviceId}</if>
<if test="deviceModeId != null "> and device_mode_id = #{deviceModeId}</if>
<if test="accessGwProtocol != null "> and access_gw_protocol = #{accessGwProtocol}</if>
<if test="activeStatus != null and activeStatus != ''"> and active_status = #{activeStatus}</if>
<if test="deviceStatus != null and deviceStatus != ''"> and device_status = #{deviceStatus}</if>
<if test="activeTime != null "> and active_time = #{activeTime}</if>
<if test="devicePic != null and devicePic != ''"> and device_pic = #{devicePic}</if>
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
<if test="areaId != null "> and area_id = #{areaId}</if>
<if test="deviceLocation != null and deviceLocation != ''"> and device_location = #{deviceLocation}</if>
<if test="currentModuleVersion != null and currentModuleVersion != ''"> and current_module_version = #{currentModuleVersion}</if>
<if test="currentSinglechipVersion != null and currentSinglechipVersion != ''"> and current_singlechip_version = #{currentSinglechipVersion}</if>
<if test="deviceField != null and deviceField != ''"> and device_field = #{deviceField}</if>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
<if test="deviceCode != null and deviceCode != ''"> and hd.device_code like concat('%', #{deviceCode}, '%')</if>
<if test="deviceName != null and deviceName != ''"> and hd.device_name like concat('%', #{deviceName}, '%')</if>
<if test="sceneId != null "> and hd.scene_id = #{sceneId}</if>
<if test="monitorUnitId != null "> and hd.monitor_unit_id = #{monitorUnitId}</if>
<if test="deviceType != null and deviceType != ''"> and hd.device_type = #{deviceType}</if>
<if test="networkingMode != null and networkingMode != ''"> and hd.networking_mode = #{networkingMode}</if>
<if test="accessProtocol != null "> and hd.access_protocol = #{accessProtocol}</if>
<if test="dataFormat != null "> and hd.data_format = #{dataFormat}</if>
<if test="releatedDeviceId != null "> and hd.releated_device_id = #{releatedDeviceId}</if>
<if test="deviceModeId != null "> and hd.device_mode_id = #{deviceModeId}</if>
<if test="accessGwProtocol != null "> and hd.access_gw_protocol = #{accessGwProtocol}</if>
<if test="activeStatus != null and activeStatus != ''"> and hd.active_status = #{activeStatus}</if>
<if test="deviceStatus != null and deviceStatus != ''"> and hd.device_status = #{deviceStatus}</if>
<if test="activeTime != null "> and hd.active_time = #{activeTime}</if>
<if test="devicePic != null and devicePic != ''"> and hd.device_pic = #{devicePic}</if>
<if test="ipAddress != null and ipAddress != ''"> and hd.ip_address = #{ipAddress}</if>
<if test="areaId != null "> and hd.area_id = #{areaId}</if>
<if test="deviceLocation != null and deviceLocation != ''"> and hd.device_location = #{deviceLocation}</if>
<if test="currentModuleVersion != null and currentModuleVersion != ''"> and hd.current_module_version = #{currentModuleVersion}</if>
<if test="currentSinglechipVersion != null and currentSinglechipVersion != ''"> and hd.current_singlechip_version = #{currentSinglechipVersion}</if>
<if test="deviceField != null and deviceField != ''"> and hd.device_field = #{deviceField}</if>
<if test="tenantId != null "> and hd.tenant_id = #{tenantId}</if>
<if test="onlineStatus != null and onlineStatus != ''"> and hd.online_status = #{onlineStatus}</if>
<!-- 租户数据范围过滤 -->
${params.tenantDataScope}
</where>
@ -131,7 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectHwDeviceByDeviceId" parameterType="Long" resultMap="HwDeviceResult">
<include refid="selectHwDeviceVo"/>
where device_id = #{deviceId}
where hd.device_id = #{deviceId}
</select>
<insert id="insertHwDevice" parameterType="HwDevice" useGeneratedKeys="true" keyProperty="deviceId">
@ -305,7 +336,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectHwDeviceByDeviceCode" parameterType="String" resultMap="HwDeviceResult">
<include refid="selectHwDeviceVo"/>
where device_code = #{deviceCode} limit 1
where hd.device_code = #{deviceCode} limit 1
</select>
@ -328,10 +359,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectHwDeviceListByMonitor" parameterType="HwDevice" resultMap="HwDeviceResult">
<include refid="selectHwDeviceVo"/>
<where>
<if test="sceneId != null "> and scene_id = #{sceneId}</if>
<if test="monitorUnitId != null "> and monitor_unit_id = #{monitorUnitId}</if>
<if test="sceneId != null "> and hd.scene_id = #{sceneId}</if>
<if test="monitorUnitId != null "> and hd.monitor_unit_id = #{monitorUnitId}</if>
and device_status !='9' and (device_type='2' or device_type='3')
and hd.device_status !='9' and (device_type='2' or device_type='3')
<!-- 租户数据范围过滤 -->
${params.tenantDataScope}
</where>
@ -404,10 +435,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where ha.area_id = ha2.parent_id and ha.area_id = #{areaId}
</select>
<select id="getDeviceListInMonitorUnit" parameterType="Long" resultMap="HwDeviceResult">
select * from hw_device hd where device_mode_id in
(select device_mode_id from hw_device_mode_function hdmf where function_identifier ='latitude')
and device_status !=9
and monitor_unit_id = #{monitorUnitId}
SELECT hd.*, hmu.monitor_unit_name
FROM hw_device hd
LEFT JOIN hw_monitor_unit hmu ON hmu.monitor_unit_id = hd.monitor_unit_id
WHERE hd.device_mode_id IN (
SELECT hdmf.device_mode_id
FROM hw_device_mode_function hdmf
WHERE hdmf.function_identifier = 'latitude'
)
AND hd.device_status != 9
AND hd.monitor_unit_id = #{monitorUnitId}
</select>
<select id="selectFunctionNameByFunctionIdentifier" parameterType="String" resultType="String">
select distinct function_name from hw_device_mode_function where function_identifier = #{functionIdentifier}

Loading…
Cancel
Save