Commit 0d3ca84d authored by 耿迪迪's avatar 耿迪迪

报信息接口修改 gengdidi

parent 6552ef81
package com.zehong.web.controller.dataMonitoring;
import java.util.List;
import com.zehong.common.core.domain.entity.SysDictData;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.vo.DeviceAlarmVo;
import com.zehong.system.service.ISysDictTypeService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TDeviceAlarm;
import com.zehong.system.domain.vo.DeviceAlarmVo;
import com.zehong.system.service.ITDeviceAlarmService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 报警信息Controller
......@@ -38,8 +27,6 @@ public class TDeviceAlarmController extends BaseController
@Autowired
private ITDeviceAlarmService tDeviceAlarmService;
@Autowired
private ISysDictTypeService iSysDictTypeService;
/**
* 查询报警信息列表
......@@ -52,18 +39,6 @@ public class TDeviceAlarmController extends BaseController
List<DeviceAlarmVo> list = null;
try {
list = tDeviceAlarmService.selectTDeviceAlarmList(tDeviceAlarm);
List<SysDictData> sysDictDataList = iSysDictTypeService.selectDictDataByType("t_alarm_type");
for(DeviceAlarmVo deviceAlarmVo : list){
for(SysDictData sysDictData : sysDictDataList){
if(StringUtils.isNotEmpty(deviceAlarmVo.getAlarmType())){
if(deviceAlarmVo.getAlarmType().equals(sysDictData.getDictValue())){
deviceAlarmVo.setAlarmType(sysDictData.getDictLabel());
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
throw new Exception("查询报警信息列表出错");
......
......@@ -2,12 +2,16 @@ package com.zehong.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.zehong.common.core.domain.entity.SysDictData;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TPipe;
import com.zehong.system.domain.vo.DeviceAlarmVo;
import com.zehong.system.mapper.TDeviceInfoMapper;
import com.zehong.system.mapper.TPipeMapper;
import com.zehong.system.service.ISysDictTypeService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -31,6 +35,9 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService
@Autowired
private TPipeMapper tPipeMapper;
@Autowired
private ISysDictTypeService iSysDictTypeService;
/**
* 查询报警信息
*
......@@ -75,7 +82,7 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService
DeviceAlarmVo deviceAlarmVo = new DeviceAlarmVo();
BeanUtils.copyProperties(alarm, deviceAlarmVo);
if("0".equals(tDeviceAlarm.getDeviceType())){
if("0".equals(alarm.getDeviceType())){
TPipe pipe = tPipeMapper.selectTPipeById(alarm.getDeviceId());
if(pipe != null) {
deviceAlarmVo.setDeviceCode(pipe.getPipeCode());
......@@ -89,6 +96,16 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService
}
}
List<SysDictData> sysDictDataList = iSysDictTypeService.selectDictDataByType("t_alarm_type");
for(SysDictData sysDictData : sysDictDataList){
if(StringUtils.isNotEmpty(alarm.getAlarmType())){
if(alarm.getAlarmType().equals(sysDictData.getDictValue())){
deviceAlarmVo.setAlarmType(sysDictData.getDictLabel());
}
}
}
list.add(deviceAlarmVo);
}
return list;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment