Commit 28fd5aa1 authored by 王晓倩's avatar 王晓倩

报警器用户接口,报警器列表接口。

泽宏云数据推送接口,地图统计及报警数据列表接口。
parent 8e099d67
...@@ -60,6 +60,10 @@ ...@@ -60,6 +60,10 @@
<groupId>com.zehong</groupId> <groupId>com.zehong</groupId>
<artifactId>gassafety-generator</artifactId> <artifactId>gassafety-generator</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies> </dependencies>
......
package com.zehong.web.controller.detector; package com.zehong.web.controller.detector;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zehong.common.enums.ResultEnum;
import com.zehong.common.exception.IOCException;
import com.zehong.system.domain.TDetectorReportData;
import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TDetectorInfo;
import com.zehong.system.domain.dto.TDetectorInfoDTO;
import com.zehong.system.domain.form.TDetectorReportDataForm;
import com.zehong.system.domain.vo.TDetectorUserVO;
import com.zehong.system.service.ITDetectorReportDataService;
import com.zehong.system.service.ITDetectorUserService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.util.StringUtils;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
...@@ -15,12 +37,13 @@ import com.zehong.common.annotation.Log; ...@@ -15,12 +37,13 @@ import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController; import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult; import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType; import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TDetectorInfo;
import com.zehong.system.service.ITDetectorInfoService; import com.zehong.system.service.ITDetectorInfoService;
import com.zehong.common.utils.poi.ExcelUtil; import com.zehong.common.utils.poi.ExcelUtil;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.zehong.common.core.page.TableDataInfo; import com.zehong.common.core.page.TableDataInfo;
import javax.validation.Valid;
/** /**
* 探测器Controller * 探测器Controller
* *
...@@ -29,10 +52,15 @@ import com.zehong.common.core.page.TableDataInfo; ...@@ -29,10 +52,15 @@ import com.zehong.common.core.page.TableDataInfo;
*/ */
@RestController @RestController
@RequestMapping("/detector/detectorInfo") @RequestMapping("/detector/detectorInfo")
@Slf4j
public class TDetectorInfoController extends BaseController public class TDetectorInfoController extends BaseController
{ {
@Autowired @Autowired
private ITDetectorInfoService tDetectorInfoService; private ITDetectorInfoService tDetectorInfoService;
@Autowired
private ITDetectorUserService tDetectorUserService;
@Autowired
private ITDetectorReportDataService tDetectorReportDataService;
/** /**
* 查询探测器列表 * 查询探测器列表
...@@ -105,4 +133,441 @@ public class TDetectorInfoController extends BaseController ...@@ -105,4 +133,441 @@ public class TDetectorInfoController extends BaseController
{ {
return toAjax(tDetectorInfoService.deleteTDetectorInfoByIds(detectorIds)); return toAjax(tDetectorInfoService.deleteTDetectorInfoByIds(detectorIds));
} }
@ApiOperation(value = "泽宏报警器信息推送接口")
@PostMapping("/reportTDetectorInfoData")
public AjaxResult reportTDetectorInfoData(@RequestBody String param) throws IOException {
log.info(param);
JSONObject object = JSONObject.parseObject(param);
String operateType = object.getString("operateType");
String data = object.getString("data");
JSONArray arr = JSONArray.parseArray(data);
List<TDetectorInfo> list = new ArrayList<TDetectorInfo>();
String username = "";
String deviceName = "";
String deviceNo = "";
String deviceType = "";
String medium = "";
String address = "";
String longitude = "";
String latitude = "";
String contacts = "";
String telephone = "";
if("1".equals(operateType)){ // 新增操作
for(int i=0; i<arr.size(); i++){
JSONObject obj = arr.getJSONObject(i);
username = obj.getString("username");
deviceName = obj.getString("deviceName");
deviceNo = obj.getString("deviceNo");
deviceType = obj.getString("deviceType");
medium = obj.getString("medium");
address = obj.getString("address");
longitude = obj.getString("longitude");
latitude = obj.getString("latitude");
contacts = obj.getString("contacts");
telephone = obj.getString("telephone");
// MapResourcesInfoExample example = new MapResourcesInfoExample();
// example.createCriteria().andFullNameEqualTo(username).andIsEnableEqualTo("0");
// List<MapResourcesInfo> mapResourcesList = mapResourcesService.selectByExample(example);
TDetectorUser tDetectorUser = new TDetectorUser();
tDetectorUser.setNickName(username);
List<TDetectorUserVO> tDetectorUserList = tDetectorUserService.detectorUserList(tDetectorUser);
if(tDetectorUserList.size() == 0){
return AjaxResult.error(1,"查询不到用户名username=" + username);
}
TDetectorInfo tDetectorInfo = new TDetectorInfo();
tDetectorInfo.setUserId(tDetectorUser.getUserId());
tDetectorInfo.setDetectorName(deviceName);
tDetectorInfo.setDetectorCode(deviceNo);
tDetectorInfo.setDetectorType(deviceType);
if(!"".equals(medium)){
tDetectorInfo.setMedium(medium);
}
if(!"".equals(address)) {
tDetectorInfo.setDetectorAddr(address);
}
if(!"".equals(longitude)){
tDetectorInfo.setLongitude(new BigDecimal(longitude));
}
if(!"".equals(latitude)){
tDetectorInfo.setLatitude(new BigDecimal(latitude));
}
if(!"".equals(contacts)) {
tDetectorInfo.setLinkman(contacts);
}
if(!"".equals(telephone)) {
tDetectorInfo.setPhone(telephone);
}
// 如果该设备编号已存在,则执行修改
// TDetectorInfoExample deviceInfoExample = new TDetectorInfoExample();
// MapResourcesInfo mapResourcesInfo = mapResourcesList.get(0);
// deviceInfoExample.createCriteria().andDetectorNoEqualTo(deviceNo)
// .andEnterpriseIdEqualTo(mapResourcesInfo.getResourceNo()).andIsEnableEqualTo("0");
TDetectorInfo detector = new TDetectorInfo();
detector.setDetectorCode(deviceNo);
detector.setIsDel("0");
List<TDetectorInfo> detectorList = tDetectorInfoService.selectTDetectorInfoList(detector);
if(detectorList.size() > 0){
tDetectorInfoService.updateTDetectorInfo(tDetectorInfo);
continue;
}
tDetectorInfo.setCreateTime(new Date());
list.add(tDetectorInfo);
}
if(list.size() > 0) {
tDetectorInfoService.insertBatch(list);
}
} else if ("2".equals(operateType)) { // 修改操作
List<String> errList = new ArrayList<>();
for(int i=0; i<arr.size(); i++){
JSONObject obj = arr.getJSONObject(i);
username = obj.getString("username");
deviceName = obj.getString("deviceName");
deviceNo = obj.getString("deviceNo");
deviceType = obj.getString("deviceType");
address = obj.getString("address");
longitude = obj.getString("longitude");
latitude = obj.getString("latitude");
contacts = obj.getString("contacts");
telephone = obj.getString("telephone");
TDetectorInfo tDetectorInfo = new TDetectorInfo();
tDetectorInfo.setDetectorCode(deviceNo);
// MapResourcesInfoExample example = new MapResourcesInfoExample();
// example.createCriteria().andFullNameEqualTo(username).andIsEnableEqualTo("0");
// List<MapResourcesInfo> mapResourcesList = mapResourcesService.selectByExample(example);
TDetectorUser tDetectorUser = new TDetectorUser();
tDetectorUser.setNickName(username);
List<TDetectorUserVO> tDetectorUserList = tDetectorUserService.detectorUserList(tDetectorUser);
if(tDetectorUserList.size() == 0){
return AjaxResult.error(1,"查询不到用户名username=" + username);
}
// 设备编号不存在执行的操作
TDetectorInfo detector = new TDetectorInfo();
detector.setDetectorCode(deviceNo);
detector.setIsDel("0");
List<TDetectorInfo> detectorList = tDetectorInfoService.selectTDetectorInfoList(detector);
if(detectorList.size() == 0){
errList.add(deviceNo);
continue;
}
if(!"".equals(deviceType)) {
tDetectorInfo.setDetectorType(deviceType);
}
if(!"".equals(deviceName)) {
tDetectorInfo.setDetectorName(deviceName);
}
if(!"".equals(address)) {
tDetectorInfo.setDetectorAddr(address);
}
if(!"".equals(longitude)){
tDetectorInfo.setLongitude(new BigDecimal(longitude));
}
if(!"".equals(latitude)){
tDetectorInfo.setLatitude(new BigDecimal(latitude));
}
if(!"".equals(contacts)) {
tDetectorInfo.setLinkman(contacts);
}
if(!"".equals(telephone)) {
tDetectorInfo.setPhone(telephone);
}
tDetectorInfo.setUpdateTime(new Date());
list.add(tDetectorInfo);
}
if(errList.size() > 0){
return AjaxResult.error(3,"设备不存在" + errList);
}
tDetectorInfoService.updateBatch(list);
} else if ("3".equals(operateType)) { // 删除操作
for(int i=0; i<arr.size(); i++){
JSONObject obj = arr.getJSONObject(i);
deviceNo = obj.get("deviceNo").toString();
username = obj.getString("username");
//用户不存在无操作
TDetectorUser tDetectorUser = new TDetectorUser();
tDetectorUser.setNickName(username);
List<TDetectorUserVO> tDetectorUserList = tDetectorUserService.detectorUserList(tDetectorUser);
if(tDetectorUserList.size() == 0){
continue;
}
//设备编号不存在无操作
TDetectorInfo detector = new TDetectorInfo();
detector.setDetectorCode(deviceNo);
detector.setIsDel("0");
List<TDetectorInfo> detectorList = tDetectorInfoService.selectTDetectorInfoList(detector);
if(detectorList.size() == 0){
continue;
}
TDetectorInfo tDetectorInfo = new TDetectorInfo();
tDetectorInfo.setDetectorCode(deviceNo);
tDetectorInfo.setIsDel("1");
tDetectorInfo.setUpdateTime(new Date());
list.add(tDetectorInfo);
}
if(list.size() > 0) {
tDetectorInfoService.updateBatch(list);
}
} else if ("4".equals(operateType)) { // 批量转移操作
List<String> errList = new ArrayList<>();
String sourceUsername = "";
String targetUsername = "";
for(int i=0; i<arr.size(); i++){
JSONObject obj = arr.getJSONObject(i);
deviceNo = obj.getString("deviceNo");
sourceUsername = obj.getString("sourceUsername");
targetUsername = obj.getString("targetUsername");
TDetectorInfo tDetectorInfo = new TDetectorInfo();
tDetectorInfo.setDetectorCode(deviceNo);
TDetectorUser tDetectorUser1 = new TDetectorUser();
tDetectorUser1.setNickName(username);
List<TDetectorUserVO> tDetectorUserList1 = tDetectorUserService.detectorUserList(tDetectorUser1);
if(tDetectorUserList1.size() == 0){
return AjaxResult.error(4,"查询不到原用户名sourceUsername=" + sourceUsername);
}
TDetectorUser tDetectorUser2 = new TDetectorUser();
tDetectorUser2.setNickName(username);
List<TDetectorUserVO> tDetectorUserList2 = tDetectorUserService.detectorUserList(tDetectorUser2);
if(tDetectorUserList2.size() == 0){
return AjaxResult.error(5,"查询不到目标用户名targetUsername=" + targetUsername);
}
tDetectorInfo.setUserId(tDetectorUserList2.get(0).getUserId());
TDetectorInfo detector = new TDetectorInfo();
detector.setDetectorCode(deviceNo);
detector.setIsDel("0");
List<TDetectorInfo> detectorList = tDetectorInfoService.selectTDetectorInfoList(detector);
if(detectorList.size() == 0){
errList.add(deviceNo);
continue;
}
tDetectorInfo.setUpdateTime(new Date());
list.add(tDetectorInfo);
}
if(errList.size() > 0){
return AjaxResult.error(3,"设备不存在" + errList);
}
tDetectorInfoService.updateBatch(list);
}
return AjaxResult.success();
}
@ApiOperation(value = "泽宏报警器更新数据推送接口")
@PostMapping("/reportZHDeviceStatus")
public AjaxResult reportZHDeviceStatus(@RequestBody List<TDetectorInfoDTO> tDetectorInfoDTOList){
log.info(tDetectorInfoDTOList.toString());
List<TDetectorInfo> list = new ArrayList<>();
try {
for(TDetectorInfoDTO dto : tDetectorInfoDTOList){
TDetectorInfo tDetectorInfo = new TDetectorInfo();
if(!StringUtils.isEmpty(dto.getDetectorType()) && dto.getDetectorType().equals("1")){
if(!StringUtils.isEmpty(dto.getDetectorStatus()) && dto.getDetectorStatus().equals("1")){
tDetectorInfo.setDetectorStatus("0");
tDetectorInfo.setAlarmTime(null);
}else if(new ArrayList<String>(Arrays.asList("7","9")).contains(dto.getDetectorStatus())){
tDetectorInfo.setDetectorStatus("1");
}else{
tDetectorInfo.setDetectorStatus("2");
}
}else{
if(!StringUtils.isEmpty(dto.getDetectorStatus()) && dto.getDetectorStatus().equals("0")){
tDetectorInfo.setAlarmTime(null);
}
}
list.add(tDetectorInfo);
}
tDetectorInfoService.updateBatch(list);
} catch (Exception e) {
e.printStackTrace();
log.error("【泽宏设备状态】操作出错,error={}",e.getMessage());
throw new IOCException(ResultEnum.OPERATION_FAIL);
}
return AjaxResult.success();
}
@ApiOperation(value = "泽宏设备预警数据推送接口")
@PostMapping("/reportZHDeviceAlarmData")
public AjaxResult reportZHDeviceAlarmData(@Valid @RequestBody TDetectorReportDataForm tDetectorReportDataForm, BindingResult bindingResult){
if(bindingResult.hasErrors()){
log.error("【新增泽宏设备上报数据】参数不正确,zhDeviceReportDataForm={}",tDetectorReportDataForm);
throw new IOCException(ResultEnum.PARAM_ERROR.getCode(),bindingResult.getFieldError().getDefaultMessage());
}
log.info("泽宏设备上报数据===="+tDetectorReportDataForm.toString());
try {
boolean flag = true;
if(!StringUtils.isEmpty(tDetectorReportDataForm.getDeviceType()) && tDetectorReportDataForm.getDeviceType().equals("1") && !StringUtils.isEmpty(tDetectorReportDataForm.getDeviceStatusId()) && new ArrayList<String>(Arrays.asList("7","9")).contains((tDetectorReportDataForm.getDeviceStatusId()))){
flag = false;
}
//7,9通信故障不处理
if(flag){
TDetectorInfo tDetectorInfo = new TDetectorInfo();
tDetectorInfo.setDetectorCode(tDetectorReportDataForm.getDeviceNo());
List<TDetectorInfo> tDetectorInfoList = tDetectorInfoService.selectTDetectorInfoList(tDetectorInfo);
if(tDetectorInfoList.size() > 0){
//报警设备类型,1家用报警器,2工业探测器
if(!StringUtils.isEmpty(tDetectorReportDataForm.getDeviceType()) && tDetectorReportDataForm.getDeviceType().equals("1") && !StringUtils.isEmpty(tDetectorReportDataForm.getDeviceStatusId()) && !tDetectorReportDataForm.getDeviceStatusId().equals("1")){
TDetectorReportData datas = new TDetectorReportData();
datas.setSourceId(tDetectorReportDataForm.getSourceId());
datas.setDetectorCode(tDetectorReportDataForm.getDeviceNo());
datas.setDetectorStatus(tDetectorReportDataForm.getDeviceStatusId());
datas.setReportValue(StringUtils.isEmpty(tDetectorReportDataForm.getReportValue())?null:Float.parseFloat(tDetectorReportDataForm.getReportValue()));
datas.setZhHostStatusId(StringUtils.isEmpty(tDetectorReportDataForm.getZhHostStatusId())?null:Integer.parseInt(tDetectorReportDataForm.getZhHostStatusId()));
datas.setSignalStrength(StringUtils.isEmpty(tDetectorReportDataForm.getSignalStrength())?null:Integer.parseInt(tDetectorReportDataForm.getSignalStrength()));
datas.setNetPoint(StringUtils.isEmpty(tDetectorReportDataForm.getNetPoint())?null:Integer.parseInt(tDetectorReportDataForm.getNetPoint()));
datas.setIpAddress(StringUtils.isEmpty(tDetectorReportDataForm.getIpAddress())?null:tDetectorReportDataForm.getIpAddress());
datas.setCreateTime(StringUtils.isEmpty(tDetectorReportDataForm.getCreateTime())?null:new Date());
tDetectorReportDataService.insertTDetectorReportData(datas);
}else if(!StringUtils.isEmpty(tDetectorReportDataForm.getDeviceType()) && tDetectorReportDataForm.getDeviceType().equals("2") && !StringUtils.isEmpty(tDetectorReportDataForm.getDeviceStatusId()) && !tDetectorReportDataForm.getDeviceStatusId().equals("E")){
TDetectorReportData datas = new TDetectorReportData();
datas.setSourceId(tDetectorReportDataForm.getSourceId());
datas.setDetectorCode(tDetectorReportDataForm.getDeviceNo());
//设备类型,1家用报警器,2工业探测器
datas.setDetectorStatus(StringUtils.isEmpty(tDetectorReportDataForm.getDeviceStatusId())?null:"E"+tDetectorReportDataForm.getDeviceStatusId());
datas.setReportValue(StringUtils.isEmpty(tDetectorReportDataForm.getReportValue())?null:Float.parseFloat(tDetectorReportDataForm.getReportValue()));
datas.setZhHostStatusId(StringUtils.isEmpty(tDetectorReportDataForm.getZhHostStatusId())?null:Integer.parseInt(tDetectorReportDataForm.getZhHostStatusId()));
datas.setSignalStrength(StringUtils.isEmpty(tDetectorReportDataForm.getSignalStrength())?null:Integer.parseInt(tDetectorReportDataForm.getSignalStrength()));
datas.setNetPoint(StringUtils.isEmpty(tDetectorReportDataForm.getNetPoint())?null:Integer.parseInt(tDetectorReportDataForm.getNetPoint()));
datas.setIpAddress(StringUtils.isEmpty(tDetectorReportDataForm.getIpAddress())?null:tDetectorReportDataForm.getIpAddress());
datas.setCreateTime(StringUtils.isEmpty(tDetectorReportDataForm.getCreateTime())?null:new Date());
tDetectorReportDataService.insertTDetectorReportData(datas);
}
//设备状态更新
TDetectorInfo detectorInfo = new TDetectorInfo();
detectorInfo.setDetectorId(tDetectorInfoList.get(0).getDetectorId());
// 探测器 推送数据(1正常,7、9离线,其他值预警) 用电推送数据(E正常,其他都为报警值)用电手动消警 用 E 代表
if(!StringUtils.isEmpty(tDetectorReportDataForm.getDeviceStatusId()) && new ArrayList<String>(Arrays.asList("1","E")).contains((tDetectorReportDataForm.getDeviceStatusId()))){
detectorInfo.setDetectorStatus("0"); // 设备表状态 0正常,1故障(掉线)
detectorInfo.setAlarmTime(null);
}else{
if(!StringUtils.isEmpty(tDetectorReportDataForm.getDeviceType()) && tDetectorReportDataForm.getDeviceType().equals("1")){
if(!StringUtils.isEmpty(tDetectorReportDataForm.getDeviceStatusId()) && new ArrayList<String>(Arrays.asList("7","9")).contains((tDetectorReportDataForm.getDeviceStatusId()))){
detectorInfo.setDetectorStatus("1");
}else{
detectorInfo.setDetectorStatus("2");
}
}else{
detectorInfo.setDetectorStatus("2");
}
detectorInfo.setAlarmTime(tDetectorReportDataForm.getCreateTime());
}
tDetectorInfoService.updateTDetectorInfo(detectorInfo);
//消警处理
if(!StringUtils.isEmpty(tDetectorReportDataForm.getDeviceStatusId()) && new ArrayList<String>(Arrays.asList("1","E")).contains((tDetectorReportDataForm.getDeviceStatusId()))){
// ZHDeviceReportDatasExample zhDeviceReportDatasExample = new ZHDeviceReportDatasExample();
// zhDeviceReportDatasExample.createCriteria().andDeviceNoEqualTo(tDetectorReportDataForm.getDeviceNo());
// zhDeviceReportDatasExample.setOrderByClause(" create_time DESC LIMIT 1");
//
// List<ZHDeviceReportDatas> dataList = zHDeviceReportDataService.selectByExample(zhDeviceReportDatasExample);
TDetectorReportData data = tDetectorReportDataService.selectTDetectorReportDataByCode(tDetectorReportDataForm.getDeviceNo());
if(data != null){
data.setIsCancelAlarm("1"); // 1自动消警
data.setCancelTime(StringUtils.isEmpty(tDetectorReportDataForm.getCreateTime())?null: new Date());
tDetectorReportDataService.updateTDetectorReportData(data);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("【新增泽宏设备上报数据】操作出错,error={},zhDeviceReportDataForm={}",e.getMessage(),tDetectorReportDataForm);
throw new IOCException(ResultEnum.OPERATION_FAIL);
}
return AjaxResult.success();
}
@ApiOperation(value = "大屏数据初始化时主动查询的感知设备报警信息前50条")
@GetMapping("/getAlarmData")
public AjaxResult getAlarmData(){
ModelMap map = new ModelMap();
try {
TDetectorInfo detector = new TDetectorInfo();
detector.setIsDel("0");
List<TDetectorInfo> tDetectorInfoList = tDetectorInfoService.selectTDetectorInfoList(detector);
List<String> strList = new ArrayList<>();
for(TDetectorInfo info : tDetectorInfoList){
strList.add(info.getDetectorCode());
}
List<TDetectorReportData> dataList = tDetectorReportDataService.countDetector(strList);
int totalNum = dataList.size();
int handledNum = 0;
for(TDetectorReportData data : dataList){
if(!StringUtils.isEmpty(data.getIsCancelAlarm()) && data.getIsCancelAlarm().equals("1")){
++handledNum;
}
}
List<TDetectorReportData> alarmVO = tDetectorReportDataService.selectRealtimeDataList();
map.put("totalNum", totalNum);
map.put("handledNum", handledNum);
map.put("noHandeldNum", totalNum-handledNum);
map.put("pageData", alarmVO);
} catch (Exception ie){
ie.printStackTrace();
log.error("【查询报警数据】操作出错,error={}",ie.getMessage());
throw new IOCException(ResultEnum.OPERATION_FAIL.getCode(),"查询报警数据操作出错");
}
return AjaxResult.success(map);
}
} }
...@@ -2,6 +2,7 @@ package com.zehong.web.controller.detector; ...@@ -2,6 +2,7 @@ package com.zehong.web.controller.detector;
import java.util.List; import java.util.List;
import com.zehong.system.domain.vo.TDetectorUserVO;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -54,7 +55,7 @@ public class TDetectorUserController extends BaseController ...@@ -54,7 +55,7 @@ public class TDetectorUserController extends BaseController
*/ */
@GetMapping("/detectorUserList") @GetMapping("/detectorUserList")
public AjaxResult detectorUserList(TDetectorUser tDetectorUser){ public AjaxResult detectorUserList(TDetectorUser tDetectorUser){
return AjaxResult.success(tDetectorUserService.selectTDetectorUserList(tDetectorUser)); return AjaxResult.success(tDetectorUserService.detectorUserList(tDetectorUser));
} }
/** /**
...@@ -65,8 +66,8 @@ public class TDetectorUserController extends BaseController ...@@ -65,8 +66,8 @@ public class TDetectorUserController extends BaseController
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(TDetectorUser tDetectorUser) public AjaxResult export(TDetectorUser tDetectorUser)
{ {
List<TDetectorUser> list = tDetectorUserService.selectTDetectorUserList(tDetectorUser); List<TDetectorUserVO> list = tDetectorUserService.detectorUserList(tDetectorUser);
ExcelUtil<TDetectorUser> util = new ExcelUtil<TDetectorUser>(TDetectorUser.class); ExcelUtil<TDetectorUserVO> util = new ExcelUtil<TDetectorUserVO>(TDetectorUserVO.class);
return util.exportExcel(list, "探测器用户数据"); return util.exportExcel(list, "探测器用户数据");
} }
......
...@@ -124,6 +124,10 @@ ...@@ -124,6 +124,10 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId> <artifactId>spring-boot-starter-websocket</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies> </dependencies>
......
package com.zehong.common.enums;
import lombok.Getter;
@Getter
public enum ResultEnum {
SUCCESS(0,"成功"),
PARAM_ERROR(10000,"参数不正确"),
NOT_EXIST(20000,"记录不存在"),
ACCOUNT_EXIST(20001,"帐号已存在"),
LOGIN_FAIL(30000,"登录失败"),
ACCOUNT_NO(30001,"账号不存在"),
ACCOUNT_PWD_ERROR(30002,"登录失败,账号或密码错误"),
ACCOUNT_LOCKED(30003,"账号冻结"),
LOGOUT_FAIL(30004,"登出失败"),
AUTH_FAIL(30005,"认证失败"),
AUTH_INFO_ERROR(30006,"认证信息异常"),
ERROR_PERMISSION(30007,"权限不足"),
ERROR_JWT(30008,"凭证认证失败"),
EXPIRED_JWT(30009,"失效的jwtToken"),
ACCOUNT_PWD_EMPTY(30010,"登录失败,帐号或密码不能为空"),
ACCOUNT_OLD_PWD_ERROR(30011,"旧密码错误"),
OPERATION_FAIL(4000,"操作失败"),
INDICATOR_CREATE_FAIL(4001,"新增失败,最多添加3个引领性指标!"),
ORG_CREATE_FAIL(4002,"新增失败,该主管在该时间段内已存在至关重要指标!"),
REQUEST_METHOD_SUPPORT_ERROR(4003,"当前请求方法不支持"),
MEETING_CREATE_FAIL(4004,"本周已填写至关重要目标会议!"),
SERVER_FAIL(5000,"服务器开小差了~~"),
INTERNAL_SERVER_ERROR(5001, "服务器内部错误!"),
SERVER_BUSY(5002, "服务器正忙,请稍后再试!"),
ENTERPRISE_EXIST(6000, "企业机构代码已注册!"),
ENTERPRISE_NOEXIST(6001, "企业机构代码不存在!")
;
private Integer code;
private String message;
ResultEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
}
package com.zehong.common.exception;
import com.zehong.common.enums.ResultEnum;
import lombok.Getter;
@Getter
public class IOCException extends RuntimeException {
/**
*
*/
private static final long serialVersionUID = 7272332822781740888L;
private Integer code;
public IOCException(ResultEnum resultEnum){
super(resultEnum.getMessage());
this.code = resultEnum.getCode();
}
public IOCException(Integer code, String message){
super(message);
this.code = code;
}
}
...@@ -2,9 +2,6 @@ package com.zehong.system.domain; ...@@ -2,9 +2,6 @@ package com.zehong.system.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel; import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity; import com.zehong.common.core.domain.BaseEntity;
...@@ -40,12 +37,8 @@ public class TDetectorInfo extends BaseEntity ...@@ -40,12 +37,8 @@ public class TDetectorInfo extends BaseEntity
@Excel(name = "设备地址") @Excel(name = "设备地址")
private String detectorAddr; private String detectorAddr;
/** 设备型号 */ /** 设备类型(1家用报警器,2工业报警器) */
@Excel(name = "设备型号") @Excel(name = "设备类型", readConverterExp = "1家用报警器,2工业报警器")
private String detectorModel;
/** 设备类型(1家用报警器,2商业报警器,3工业报警器) */
@Excel(name = "设备类型", readConverterExp = "1=家用报警器,2商业报警器,3工业报警器")
private String detectorType; private String detectorType;
/** 检测介质(1甲烷,2氨气,3一氧化碳,4可燃气体,5有毒气体) */ /** 检测介质(1甲烷,2氨气,3一氧化碳,4可燃气体,5有毒气体) */
...@@ -72,15 +65,15 @@ public class TDetectorInfo extends BaseEntity ...@@ -72,15 +65,15 @@ public class TDetectorInfo extends BaseEntity
@Excel(name = "电话") @Excel(name = "电话")
private String phone; private String phone;
/** 安装时间 */ /** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd") private Date creatTime;
@Excel(name = "安装时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date installationTime; /** 报警时间 */
private Date alarmTime;
/** 最后巡检时间 */ /** 设备状态 */
@JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "设备状态")
@Excel(name = "最后巡检时间", width = 30, dateFormat = "yyyy-MM-dd") private String detectorStatus;
private Date inspectionTime;
/** 是否删除(0正常,1删除) */ /** 是否删除(0正常,1删除) */
@Excel(name = "是否删除(0正常,1删除)") @Excel(name = "是否删除(0正常,1删除)")
...@@ -144,15 +137,7 @@ public class TDetectorInfo extends BaseEntity ...@@ -144,15 +137,7 @@ public class TDetectorInfo extends BaseEntity
{ {
return detectorAddr; return detectorAddr;
} }
public void setDetectorModel(String detectorModel)
{
this.detectorModel = detectorModel;
}
public String getDetectorModel()
{
return detectorModel;
}
public void setDetectorType(String detectorType) public void setDetectorType(String detectorType)
{ {
this.detectorType = detectorType; this.detectorType = detectorType;
...@@ -216,25 +201,24 @@ public class TDetectorInfo extends BaseEntity ...@@ -216,25 +201,24 @@ public class TDetectorInfo extends BaseEntity
{ {
return phone; return phone;
} }
public void setInstallationTime(Date installationTime)
{ public Date getCreatTime() {
this.installationTime = installationTime; return creatTime;
} }
public Date getInstallationTime() public void setCreatTime(Date creatTime) {
{ this.creatTime = creatTime;
return installationTime;
} }
public void setInspectionTime(Date inspectionTime)
{ public Date getAlarmTime() {
this.inspectionTime = inspectionTime; return alarmTime;
} }
public Date getInspectionTime() public void setAlarmTime(Date alarmTime) {
{ this.alarmTime = alarmTime;
return inspectionTime;
} }
public void setIsDel(String isDel)
public void setIsDel(String isDel)
{ {
this.isDel = isDel; this.isDel = isDel;
} }
...@@ -243,7 +227,16 @@ public class TDetectorInfo extends BaseEntity ...@@ -243,7 +227,16 @@ public class TDetectorInfo extends BaseEntity
{ {
return isDel; return isDel;
} }
public void setRemarks(String remarks)
public String getDetectorStatus() {
return detectorStatus;
}
public void setDetectorStatus(String detectorStatus) {
this.detectorStatus = detectorStatus;
}
public void setRemarks(String remarks)
{ {
this.remarks = remarks; this.remarks = remarks;
} }
...@@ -252,27 +245,4 @@ public class TDetectorInfo extends BaseEntity ...@@ -252,27 +245,4 @@ public class TDetectorInfo extends BaseEntity
{ {
return remarks; return remarks;
} }
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("detectorId", getDetectorId())
.append("userId", getUserId())
.append("detectorName", getDetectorName())
.append("detectorCode", getDetectorCode())
.append("detectorAddr", getDetectorAddr())
.append("detectorModel", getDetectorModel())
.append("detectorType", getDetectorType())
.append("medium", getMedium())
.append("longitude", getLongitude())
.append("latitude", getLatitude())
.append("iotNo", getIotNo())
.append("linkman", getLinkman())
.append("phone", getPhone())
.append("installationTime", getInstallationTime())
.append("inspectionTime", getInspectionTime())
.append("isDel", getIsDel())
.append("remarks", getRemarks())
.toString();
}
} }
package com.zehong.system.domain;
import java.io.Serializable;
import java.util.Date;
public class TDetectorReportData implements Serializable {
private Integer id;
private String sourceId;
private String detectorCode;
private String detectorStatus;
private Float reportValue;
private Integer zhHostStatusId;
private Integer netPoint;
private Integer signalStrength;
private String ipAddress;
private Date createTime;
private String isCancelAlarm;
private Date cancelTime;
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getSourceId() {
return sourceId;
}
public void setSourceId(String sourceId) {
this.sourceId = sourceId == null ? null : sourceId.trim();
}
public String getDetectorCode() {
return detectorCode;
}
public void setDetectorCode(String detectorCode) {
this.detectorCode = detectorCode;
}
public String getDetectorStatus() {
return detectorStatus;
}
public void setDetectorStatus(String detectorStatus) {
this.detectorStatus = detectorStatus;
}
public Float getReportValue() {
return reportValue;
}
public void setReportValue(Float reportValue) {
this.reportValue = reportValue;
}
public Integer getZhHostStatusId() {
return zhHostStatusId;
}
public void setZhHostStatusId(Integer zhHostStatusId) {
this.zhHostStatusId = zhHostStatusId;
}
public Integer getNetPoint() {
return netPoint;
}
public void setNetPoint(Integer netPoint) {
this.netPoint = netPoint;
}
public Integer getSignalStrength() {
return signalStrength;
}
public void setSignalStrength(Integer signalStrength) {
this.signalStrength = signalStrength;
}
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress == null ? null : ipAddress.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getIsCancelAlarm() {
return isCancelAlarm;
}
public void setIsCancelAlarm(String isCancelAlarm) {
this.isCancelAlarm = isCancelAlarm == null ? null : isCancelAlarm.trim();
}
public Date getCancelTime() {
return cancelTime;
}
public void setCancelTime(Date cancelTime) {
this.cancelTime = cancelTime;
}
}
\ No newline at end of file
package com.zehong.system.domain.dto;
import lombok.Data;
@Data
public class TDetectorInfoDTO {
private String detectorType; // 1探测器、2安全用电设备
private String detectorCode;
//探测器 推送数据(1正常,7、9离线,其他值预警) 用电推送数据(E正常,0正常,1故障,2预警)
private String detectorStatus;
private String alarmTime;
}
package com.zehong.system.domain.form;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.util.Date;
@Data
public class TDetectorReportDataForm {
//数据上报原始ID必填 正常数据为用户名,报警数据为用户名+主键id
@NotEmpty(message="数据上报原始ID必填")
private String sourceId;
@NotEmpty(message="设备编号必填")
private String deviceNo;
//报警设备类型,1探测器,2智慧用电
private String deviceType;
//探测器 推送数据(1正常,7、9离线,其他值预警)
private String deviceStatusId;
//状态名称
private String statusName;
private String reportValue;
private String zhHostStatusId;
private String netPoint;
private String signalStrength;
private String ipAddress;
//创建时间
@NotEmpty(message="上报时间必填")
private Date createTime;
}
package com.zehong.system.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* 探测器用户对象 t_detector_user
*
* @author zehong
* @date 2021-11-02
*/
@Data
public class TDetectorUserVO
{
private static final long serialVersionUID = 1L;
/** 用户id */
private Long userId;
/** 用户账号 */
private String username;
/** 用户名称 */
private String nickName;
/** 用户类型(1居民用户,2商业用户,3工业用户) */
private String userType;
/** 探测器总数 */
private Integer detectorCount;
/** 在线数量 */
private Integer onLineNum;
/** 离线数量 */
private Integer offLineNum;
/** 历史报警数 */
private Integer historyAlarmNum;
/** 已处理报警 */
private Integer cancelAlarmNum;
/** 报警中 */
private Integer processingAlarmNum;
/** 地址 */
private String address;
/** 经度 */
private BigDecimal longitude;
/** 纬度 */
private BigDecimal latitude;
/** 联系人 */
private String linkman;
/** 电话 */
private String phone;
/** 邮箱 */
private String email;
/** 是否删除(0正常,1删除) */
private String isDel;
/** 备注 */
private String remarks;
}
...@@ -35,6 +35,10 @@ public interface TDetectorInfoMapper ...@@ -35,6 +35,10 @@ public interface TDetectorInfoMapper
*/ */
public int insertTDetectorInfo(TDetectorInfo tDetectorInfo); public int insertTDetectorInfo(TDetectorInfo tDetectorInfo);
public int insertBatch(List<TDetectorInfo> detectorList);
public int updateBatch(List<TDetectorInfo> detectorList);
/** /**
* 修改探测器 * 修改探测器
* *
......
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TDetectorReportData;
/**
* 设备上报的数据Mapper接口
*
* @author zehong
* @date 2021-11-08
*/
public interface TDetectorReportDataMapper
{
/**
* 查询设备上报的数据
*
* @param id 设备上报的数据ID
* @return 设备上报的数据
*/
public TDetectorReportData selectTDetectorReportDataById(Long id);
public TDetectorReportData selectTDetectorReportDataByCode(String detectorCode);
public List<TDetectorReportData> countDetector(List<String> list);
public List<TDetectorReportData> selectRealtimeDataList();
/**
* 查询设备上报的数据列表
*
* @param tDetectorReportData 设备上报的数据
* @return 设备上报的数据集合
*/
public List<TDetectorReportData> selectTDetectorReportDataList(TDetectorReportData tDetectorReportData);
/**
* 新增设备上报的数据
*
* @param tDetectorReportData 设备上报的数据
* @return 结果
*/
public int insertTDetectorReportData(TDetectorReportData tDetectorReportData);
/**
* 修改设备上报的数据
*
* @param tDetectorReportData 设备上报的数据
* @return 结果
*/
public int updateTDetectorReportData(TDetectorReportData tDetectorReportData);
/**
* 删除设备上报的数据
*
* @param id 设备上报的数据ID
* @return 结果
*/
public int deleteTDetectorReportDataById(Long id);
/**
* 批量删除设备上报的数据
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteTDetectorReportDataByIds(Long[] ids);
}
...@@ -44,6 +44,10 @@ public interface ITDetectorInfoService ...@@ -44,6 +44,10 @@ public interface ITDetectorInfoService
*/ */
public int insertTDetectorInfo(TDetectorInfo tDetectorInfo); public int insertTDetectorInfo(TDetectorInfo tDetectorInfo);
public int insertBatch(List<TDetectorInfo> detectorList);
public int updateBatch(List<TDetectorInfo> detectorList);
/** /**
* 修改探测器 * 修改探测器
* *
......
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TDetectorReportData;
import com.github.pagehelper.PageInfo;
/**
* 设备上报的数据Service接口
*
* @author zehong
* @date 2021-11-08
*/
public interface ITDetectorReportDataService
{
/**
* 查询设备上报的数据
*
* @param id 设备上报的数据ID
* @return 设备上报的数据
*/
public TDetectorReportData selectTDetectorReportDataById(Long id);
public TDetectorReportData selectTDetectorReportDataByCode(String detectorCode);
public List<TDetectorReportData> selectRealtimeDataList();
public List<TDetectorReportData> countDetector(List<String> list);
/**
* 查询设备上报的数据列表
*
* @param tDetectorReportData 设备上报的数据
* @return 设备上报的数据集合
*/
public List<TDetectorReportData> selectTDetectorReportDataList(TDetectorReportData tDetectorReportData);
/**
* 查询设备上报的数据分页列表
*
* @param tDetectorReportData 设备上报的数据
* @return 设备上报的数据分页集合
*/
public PageInfo<TDetectorReportData> selectTDetectorReportDataPage(TDetectorReportData tDetectorReportData);
/**
* 新增设备上报的数据
*
* @param tDetectorReportData 设备上报的数据
* @return 结果
*/
public int insertTDetectorReportData(TDetectorReportData tDetectorReportData);
/**
* 修改设备上报的数据
*
* @param tDetectorReportData 设备上报的数据
* @return 结果
*/
public int updateTDetectorReportData(TDetectorReportData tDetectorReportData);
/**
* 批量删除设备上报的数据
*
* @param ids 需要删除的设备上报的数据ID
* @return 结果
*/
public int deleteTDetectorReportDataByIds(Long[] ids);
/**
* 删除设备上报的数据信息
*
* @param id 设备上报的数据ID
* @return 结果
*/
public int deleteTDetectorReportDataById(Long id);
}
...@@ -3,6 +3,7 @@ package com.zehong.system.service; ...@@ -3,6 +3,7 @@ package com.zehong.system.service;
import java.util.List; import java.util.List;
import com.zehong.system.domain.TDetectorUser; import com.zehong.system.domain.TDetectorUser;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.zehong.system.domain.vo.TDetectorUserVO;
/** /**
* 探测器用户Service接口 * 探测器用户Service接口
...@@ -26,7 +27,7 @@ public interface ITDetectorUserService ...@@ -26,7 +27,7 @@ public interface ITDetectorUserService
* @param tDetectorUser 探测器用户 * @param tDetectorUser 探测器用户
* @return 探测器用户集合 * @return 探测器用户集合
*/ */
public List<TDetectorUser> selectTDetectorUserList(TDetectorUser tDetectorUser); public List<TDetectorUserVO> detectorUserList(TDetectorUser tDetectorUser);
/** /**
* 查询探测器用户分页列表 * 查询探测器用户分页列表
......
...@@ -68,6 +68,18 @@ public class TDetectorInfoServiceImpl implements ITDetectorInfoService ...@@ -68,6 +68,18 @@ public class TDetectorInfoServiceImpl implements ITDetectorInfoService
return tDetectorInfoMapper.insertTDetectorInfo(tDetectorInfo); return tDetectorInfoMapper.insertTDetectorInfo(tDetectorInfo);
} }
@Override
public int insertBatch(List<TDetectorInfo> detectorList) {
// TODO Auto-generated method stub
return tDetectorInfoMapper.insertBatch(detectorList);
}
@Override
public int updateBatch(List<TDetectorInfo> detectorList) {
// TODO Auto-generated method stub
return tDetectorInfoMapper.updateBatch(detectorList);
}
/** /**
* 修改探测器 * 修改探测器
* *
......
package com.zehong.system.service.impl;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TDetectorReportDataMapper;
import com.zehong.system.domain.TDetectorReportData;
import com.zehong.system.service.ITDetectorReportDataService;
/**
* 设备上报的数据Service业务层处理
*
* @author zehong
* @date 2021-11-08
*/
@Service
public class TDetectorReportDataServiceImpl implements ITDetectorReportDataService
{
@Autowired
private TDetectorReportDataMapper tDetectorReportDataMapper;
/**
* 查询设备上报的数据
*
* @param id 设备上报的数据ID
* @return 设备上报的数据
*/
@Override
public TDetectorReportData selectTDetectorReportDataById(Long id)
{
return tDetectorReportDataMapper.selectTDetectorReportDataById(id);
}
@Override
public TDetectorReportData selectTDetectorReportDataByCode(String detectorCode)
{
return tDetectorReportDataMapper.selectTDetectorReportDataByCode(detectorCode);
}
@Override
public List<TDetectorReportData> selectRealtimeDataList()
{
return tDetectorReportDataMapper.selectRealtimeDataList();
}
@Override
public List<TDetectorReportData> countDetector(List<String> list){
return tDetectorReportDataMapper.countDetector(list);
}
/**
* 查询设备上报的数据列表
*
* @param tDetectorReportData 设备上报的数据
* @return 设备上报的数据
*/
@Override
public List<TDetectorReportData> selectTDetectorReportDataList(TDetectorReportData tDetectorReportData)
{
return tDetectorReportDataMapper.selectTDetectorReportDataList(tDetectorReportData);
}
/**
* 查询设备上报的数据分页列表
*
* @param tDetectorReportData 设备上报的数据
* @return 设备上报的数据
*/
@Override
public PageInfo<TDetectorReportData> selectTDetectorReportDataPage(TDetectorReportData tDetectorReportData)
{
return new PageInfo(tDetectorReportDataMapper.selectTDetectorReportDataList(tDetectorReportData));
}
/**
* 新增设备上报的数据
*
* @param tDetectorReportData 设备上报的数据
* @return 结果
*/
@Override
public int insertTDetectorReportData(TDetectorReportData tDetectorReportData)
{
tDetectorReportData.setCreateTime(DateUtils.getNowDate());
return tDetectorReportDataMapper.insertTDetectorReportData(tDetectorReportData);
}
/**
* 修改设备上报的数据
*
* @param tDetectorReportData 设备上报的数据
* @return 结果
*/
@Override
public int updateTDetectorReportData(TDetectorReportData tDetectorReportData)
{
return tDetectorReportDataMapper.updateTDetectorReportData(tDetectorReportData);
}
/**
* 批量删除设备上报的数据
*
* @param ids 需要删除的设备上报的数据ID
* @return 结果
*/
@Override
public int deleteTDetectorReportDataByIds(Long[] ids)
{
return tDetectorReportDataMapper.deleteTDetectorReportDataByIds(ids);
}
/**
* 删除设备上报的数据信息
*
* @param id 设备上报的数据ID
* @return 结果
*/
@Override
public int deleteTDetectorReportDataById(Long id)
{
return tDetectorReportDataMapper.deleteTDetectorReportDataById(id);
}
}
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.zehong.system.domain.TDetectorInfo;
import com.zehong.system.domain.TDetectorReportData;
import com.zehong.system.domain.vo.TDetectorUserVO;
import com.zehong.system.mapper.TDetectorInfoMapper;
import com.zehong.system.mapper.TDetectorReportDataMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TDetectorUserMapper; import com.zehong.system.mapper.TDetectorUserMapper;
import com.zehong.system.domain.TDetectorUser; import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.service.ITDetectorUserService; import com.zehong.system.service.ITDetectorUserService;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.springframework.util.StringUtils;
/** /**
* 探测器用户Service业务层处理 * 探测器用户Service业务层处理
...@@ -19,6 +28,10 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -19,6 +28,10 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
{ {
@Autowired @Autowired
private TDetectorUserMapper tDetectorUserMapper; private TDetectorUserMapper tDetectorUserMapper;
@Autowired
private TDetectorInfoMapper tDetectorInfoMapper;
@Autowired
private TDetectorReportDataMapper tDetectorReportDataMapper;
/** /**
* 查询探测器用户 * 查询探测器用户
...@@ -39,9 +52,63 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -39,9 +52,63 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
* @return 探测器用户 * @return 探测器用户
*/ */
@Override @Override
public List<TDetectorUser> selectTDetectorUserList(TDetectorUser tDetectorUser) public List<TDetectorUserVO> detectorUserList(TDetectorUser tDetectorUser)
{ {
return tDetectorUserMapper.selectTDetectorUserList(tDetectorUser); List<TDetectorUserVO> list = new ArrayList<>();
List<TDetectorUser> tDetectorUserList = tDetectorUserMapper.selectTDetectorUserList(tDetectorUser);
TDetectorInfo detector = new TDetectorInfo();
for(TDetectorUser user : tDetectorUserList){
TDetectorUserVO userVO = new TDetectorUserVO();
BeanUtils.copyProperties(user, userVO);
detector.setUserId(user.getUserId());
detector.setIsDel("0");
List<TDetectorInfo> tDetectorInfoList = tDetectorInfoMapper.selectTDetectorInfoList(detector);
int onLineNum = 0;
int offLineNum = 0;
int cancelAlarmNum = 0;
int historyAlarmNum = 0;
List<String> strList = new ArrayList<>();
for(TDetectorInfo info : tDetectorInfoList){
if(!StringUtils.isEmpty(info.getDetectorStatus()) && info.getDetectorStatus().equals("0")){
++onLineNum;
}else{
++offLineNum;
}
strList.add(info.getDetectorCode());
}
if(strList.size() > 0){
// ZHDeviceReportDatasExample zhDeviceReportDatasExample = new ZHDeviceReportDatasExample();
// zhDeviceReportDatasExample.createCriteria().andDeviceNoIn(strList);
List<TDetectorReportData> dataList = tDetectorReportDataMapper.countDetector(strList);
historyAlarmNum = dataList.size();
// zhDeviceReportDatasExample.clear();
// zhDeviceReportDatasExample.createCriteria().andDeviceNoIn(strList).andIsCancelAlarmEqualTo("1");
for(TDetectorReportData data : dataList){
if(!StringUtils.isEmpty(data.getIsCancelAlarm()) && data.getIsCancelAlarm().equals("1")){
++cancelAlarmNum;
}
}
}
userVO.setDetectorCount(tDetectorInfoList.size());
userVO.setOnLineNum(onLineNum);
userVO.setOffLineNum(offLineNum);
userVO.setHistoryAlarmNum(historyAlarmNum);
userVO.setCancelAlarmNum(cancelAlarmNum);
userVO.setProcessingAlarmNum(Math.abs(historyAlarmNum - cancelAlarmNum));
list.add(userVO);
}
return list;
} }
/** /**
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.detector.mapper.TDetectorInfoMapper"> <mapper namespace="com.zehong.system.mapper.TDetectorInfoMapper">
<resultMap type="TDetectorInfo" id="TDetectorInfoResult"> <resultMap type="TDetectorInfo" id="TDetectorInfoResult">
<result property="detectorId" column="detector_id" /> <result property="detectorId" column="detector_id" />
...@@ -11,7 +11,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -11,7 +11,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="detectorName" column="detector_name" /> <result property="detectorName" column="detector_name" />
<result property="detectorCode" column="detector_code" /> <result property="detectorCode" column="detector_code" />
<result property="detectorAddr" column="detector_addr" /> <result property="detectorAddr" column="detector_addr" />
<result property="detectorModel" column="detector_model" />
<result property="detectorType" column="detector_type" /> <result property="detectorType" column="detector_type" />
<result property="medium" column="medium" /> <result property="medium" column="medium" />
<result property="longitude" column="longitude" /> <result property="longitude" column="longitude" />
...@@ -19,14 +18,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -19,14 +18,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="iotNo" column="iot_no" /> <result property="iotNo" column="iot_no" />
<result property="linkman" column="linkman" /> <result property="linkman" column="linkman" />
<result property="phone" column="phone" /> <result property="phone" column="phone" />
<result property="installationTime" column="installation_time" /> <result property="createTime" column="create_time" />
<result property="inspectionTime" column="inspection_time" /> <result property="alarmTime" column="alarm_time" />
<result property="detectorStatus" column="detector_status" />
<result property="isDel" column="is_del" /> <result property="isDel" column="is_del" />
<result property="remarks" column="remarks" /> <result property="remarks" column="remarks" />
</resultMap> </resultMap>
<sql id="selectTDetectorInfoVo"> <sql id="selectTDetectorInfoVo">
select detector_id, enterprise_id, user_id, detector_name, detector_code, detector_addr, detector_model, detector_type, medium, longitude, latitude, iot_no, linkman, phone, installation_time, inspection_time, is_del, remarks from t_detector_info select detector_id, enterprise_id, user_id, detector_name, detector_code, detector_addr, detector_type, medium, longitude, latitude, iot_no, linkman, phone, create_time, alarm_time, detector_status, is_del, remarks from t_detector_info
</sql> </sql>
<select id="selectTDetectorInfoList" parameterType="TDetectorInfo" resultMap="TDetectorInfoResult"> <select id="selectTDetectorInfoList" parameterType="TDetectorInfo" resultMap="TDetectorInfoResult">
...@@ -37,7 +37,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -37,7 +37,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="detectorName != null and detectorName != ''"> and detector_name like concat('%', #{detectorName}, '%')</if> <if test="detectorName != null and detectorName != ''"> and detector_name like concat('%', #{detectorName}, '%')</if>
<if test="detectorCode != null and detectorCode != ''"> and detector_code = #{detectorCode}</if> <if test="detectorCode != null and detectorCode != ''"> and detector_code = #{detectorCode}</if>
<if test="detectorAddr != null and detectorAddr != ''"> and detector_addr = #{detectorAddr}</if> <if test="detectorAddr != null and detectorAddr != ''"> and detector_addr = #{detectorAddr}</if>
<if test="detectorModel != null and detectorModel != ''"> and detector_model = #{detectorModel}</if>
<if test="detectorType != null and detectorType != ''"> and detector_type = #{detectorType}</if> <if test="detectorType != null and detectorType != ''"> and detector_type = #{detectorType}</if>
<if test="medium != null and medium != ''"> and medium = #{medium}</if> <if test="medium != null and medium != ''"> and medium = #{medium}</if>
<if test="longitude != null "> and longitude = #{longitude}</if> <if test="longitude != null "> and longitude = #{longitude}</if>
...@@ -45,8 +44,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -45,8 +44,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="iotNo != null and iotNo != ''"> and iot_no = #{iotNo}</if> <if test="iotNo != null and iotNo != ''"> and iot_no = #{iotNo}</if>
<if test="linkman != null and linkman != ''"> and linkman = #{linkman}</if> <if test="linkman != null and linkman != ''"> and linkman = #{linkman}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if> <if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="installationTime != null "> and installation_time = #{installationTime}</if> <if test="createTime != null "> and create_time = #{createTime}</if>
<if test="inspectionTime != null "> and inspection_time = #{inspectionTime}</if> <if test="alarmTime != null "> and alarm_time = #{alarmTime}</if>
<if test="detectorStatus != null and detectorStatus != ''"> and detector_status = #{detectorStatus}</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if> <if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if> <if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
</where> </where>
...@@ -65,7 +65,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -65,7 +65,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="detectorName != null">detector_name,</if> <if test="detectorName != null">detector_name,</if>
<if test="detectorCode != null">detector_code,</if> <if test="detectorCode != null">detector_code,</if>
<if test="detectorAddr != null">detector_addr,</if> <if test="detectorAddr != null">detector_addr,</if>
<if test="detectorModel != null">detector_model,</if>
<if test="detectorType != null">detector_type,</if> <if test="detectorType != null">detector_type,</if>
<if test="medium != null">medium,</if> <if test="medium != null">medium,</if>
<if test="longitude != null">longitude,</if> <if test="longitude != null">longitude,</if>
...@@ -73,8 +72,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -73,8 +72,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="iotNo != null">iot_no,</if> <if test="iotNo != null">iot_no,</if>
<if test="linkman != null">linkman,</if> <if test="linkman != null">linkman,</if>
<if test="phone != null">phone,</if> <if test="phone != null">phone,</if>
<if test="installationTime != null">installation_time,</if> <if test="createTime != null">create_time,</if>
<if test="inspectionTime != null">inspection_time,</if> <if test="alarmTime != null">alarm_time,</if>
<if test="detectorStatus != null">detector_status,</if>
<if test="isDel != null">is_del,</if> <if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if> <if test="remarks != null">remarks,</if>
</trim> </trim>
...@@ -84,7 +84,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -84,7 +84,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="detectorName != null">#{detectorName},</if> <if test="detectorName != null">#{detectorName},</if>
<if test="detectorCode != null">#{detectorCode},</if> <if test="detectorCode != null">#{detectorCode},</if>
<if test="detectorAddr != null">#{detectorAddr},</if> <if test="detectorAddr != null">#{detectorAddr},</if>
<if test="detectorModel != null">#{detectorModel},</if>
<if test="detectorType != null">#{detectorType},</if> <if test="detectorType != null">#{detectorType},</if>
<if test="medium != null">#{medium},</if> <if test="medium != null">#{medium},</if>
<if test="longitude != null">#{longitude},</if> <if test="longitude != null">#{longitude},</if>
...@@ -92,12 +91,124 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -92,12 +91,124 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="iotNo != null">#{iotNo},</if> <if test="iotNo != null">#{iotNo},</if>
<if test="linkman != null">#{linkman},</if> <if test="linkman != null">#{linkman},</if>
<if test="phone != null">#{phone},</if> <if test="phone != null">#{phone},</if>
<if test="installationTime != null">#{installationTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="inspectionTime != null">#{inspectionTime},</if> <if test="alarmTime != null">#{alarmTime},</if>
<if test="detectorStatus != null">#{detectorStatus},</if>
<if test="isDel != null">#{isDel},</if> <if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if> <if test="remarks != null">#{remarks},</if>
</trim> </trim>
</insert> </insert>
<insert id="insertBatch" parameterType="java.util.List" >
insert into t_detector_info (
user_id, detector_name, detector_code, detector_addr, detector_type, medium, longitude, latitude, linkman, phone, create_time
)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.userId,jdbcType=INTEGER}, #{item.detectorName,jdbcType=VARCHAR}, #{item.detectorCode,jdbcType=VARCHAR},
#{item.detectorAddr,jdbcType=VARCHAR}, #{item.detectorType,jdbcType=VARCHAR}, #{item.medium,jdbcType=VARCHAR},
#{item.longitude,jdbcType=DECIMAL}, #{item.latitude,jdbcType=DECIMAL}, #{item.linkman,jdbcType=VARCHAR},
#{item.phone,jdbcType=VARCHAR}, #{item.createTime,jdbcType=VARCHAR}
)
</foreach>
</insert>
<update id="updateBatch" parameterType="java.util.List">
update t_detector_info d
<trim prefix="set" suffixOverrides=",">
<trim prefix="user_id=case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.userId != null">
when detector_code=#{item.detectorCode} then #{item.userId}
</if>
</foreach>
</trim>
<trim prefix="detector_name=case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.detectorName != null &amp;&amp; item.detectorName != ''">
when detector_code=#{item.detectorCode} then #{item.detectorName}
</if>
</foreach>
</trim>
<trim prefix="detector_addr=case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.detectorAddr != null &amp;&amp; item.detectorAddr != ''">
when detector_code=#{item.detectorCode} then #{item.detectorAddr}
</if>
</foreach>
</trim>
<trim prefix="detector_type=case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.detectorType != null &amp;&amp; item.detectorType != ''">
when detector_code=#{item.detectorCode} then #{item.detectorType}
</if>
</foreach>
</trim>
<trim prefix="medium=case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.medium != null &amp;&amp; item.medium != ''">
when detector_code=#{item.detectorCode} then #{item.medium}
</if>
</foreach>
</trim>
<trim prefix="longitude=case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.longitude != null &amp;&amp; item.longitude != ''">
when detector_code=#{item.detectorCode} then #{item.longitude}
</if>
</foreach>
</trim>
<trim prefix="latitude=case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.latitude != null &amp;&amp; item.latitude != ''">
when detector_code=#{item.detectorCode} then #{item.latitude}
</if>
</foreach>
</trim>
<trim prefix="linkman=case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.linkman != null &amp;&amp; item.linkman != ''">
when detector_code=#{item.detectorCode} then #{item.linkman}
</if>
</foreach>
</trim>
<trim prefix="phone=case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.phone != null &amp;&amp; item.telephone != ''">
when detector_code=#{item.detectorCode} then #{item.phone}
</if>
</foreach>
</trim>
<trim prefix="is_del=case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.isDel != null &amp;&amp; item.isDel != ''">
when detector_code=#{item.detectorCode} then #{item.isDel}
</if>
</foreach>
</trim>
<trim prefix="detector_status=case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.detectorStatus != null &amp;&amp; item.detectorStatus != ''">
when detector_code=#{item.detectorCode} then #{item.detectorStatus}
</if>
</foreach>
</trim>
<trim prefix="alarm_time=case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.alarmTime != null">
when detector_code=#{item.detectorCode} then #{item.alarmTime}
</if>
<if test="item.alarmTime = null">
when detector_code=#{item.detectorCode} then null
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="item" index="index">
detector_code=#{item.detectorCode}
</foreach>
</update>
<update id="updateTDetectorInfo" parameterType="TDetectorInfo"> <update id="updateTDetectorInfo" parameterType="TDetectorInfo">
update t_detector_info update t_detector_info
...@@ -106,7 +217,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -106,7 +217,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="detectorName != null">detector_name = #{detectorName},</if> <if test="detectorName != null">detector_name = #{detectorName},</if>
<if test="detectorCode != null">detector_code = #{detectorCode},</if> <if test="detectorCode != null">detector_code = #{detectorCode},</if>
<if test="detectorAddr != null">detector_addr = #{detectorAddr},</if> <if test="detectorAddr != null">detector_addr = #{detectorAddr},</if>
<if test="detectorModel != null">detector_model = #{detectorModel},</if>
<if test="detectorType != null">detector_type = #{detectorType},</if> <if test="detectorType != null">detector_type = #{detectorType},</if>
<if test="medium != null">medium = #{medium},</if> <if test="medium != null">medium = #{medium},</if>
<if test="longitude != null">longitude = #{longitude},</if> <if test="longitude != null">longitude = #{longitude},</if>
...@@ -114,8 +224,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -114,8 +224,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="iotNo != null">iot_no = #{iotNo},</if> <if test="iotNo != null">iot_no = #{iotNo},</if>
<if test="linkman != null">linkman = #{linkman},</if> <if test="linkman != null">linkman = #{linkman},</if>
<if test="phone != null">phone = #{phone},</if> <if test="phone != null">phone = #{phone},</if>
<if test="installationTime != null">installation_time = #{installationTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="inspectionTime != null">inspection_time = #{inspectionTime},</if> <if test="alarmTime != null">alarm_time = #{alarmTime},</if>
<if test="detectorStatus != null">detector_status = #{detectorStatus},</if>
<if test="isDel != null">is_del = #{isDel},</if> <if test="isDel != null">is_del = #{isDel},</if>
<if test="remarks != null">remarks = #{remarks},</if> <if test="remarks != null">remarks = #{remarks},</if>
</trim> </trim>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TDetectorReportDataMapper">
<resultMap type="TDetectorReportData" id="TDetectorReportDataResult">
<result property="id" column="id" />
<result property="sourceId" column="source_id" />
<result property="detectorCode" column="detector_code" />
<result property="deviceStatus" column="device_status" />
<result property="reportValue" column="report_value" />
<result property="zhHostStatusId" column="zh_host_status_id" />
<result property="netPoint" column="net_point" />
<result property="signalStrength" column="signal_strength" />
<result property="ipAddress" column="ip_address" />
<result property="createTime" column="create_time" />
<result property="isCancelAlarm" column="is_cancel_alarm" />
<result property="cancelTime" column="cancel_time" />
</resultMap>
<sql id="selectTDetectorReportDataVo">
select id, source_id, detector_code, detector_status, report_value, zh_host_status_id, net_point, signal_strength, ip_address, create_time, is_cancel_alarm, cancel_time from t_detector_report_data
</sql>
<select id="selectTDetectorReportDataList" parameterType="TDetectorReportData" resultMap="TDetectorReportDataResult">
<include refid="selectTDetectorReportDataVo"/>
<where>
<if test="sourceId != null and sourceId != ''"> and source_id = #{sourceId}</if>
<if test="detectorCode != null and detectorCode != ''"> and detector_code = #{detectorCode}</if>
<if test="detectorStatus != null and detectorStatus != ''"> and detector_status = #{detectorStatus}</if>
<if test="reportValue != null "> and report_value = #{reportValue}</if>
<if test="zhHostStatusId != null "> and zh_host_status_id = #{zhHostStatusId}</if>
<if test="netPoint != null "> and net_point = #{netPoint}</if>
<if test="signalStrength != null "> and signal_strength = #{signalStrength}</if>
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
<if test="isCancelAlarm != null and isCancelAlarm != ''"> and is_cancel_alarm = #{isCancelAlarm}</if>
<if test="cancelTime != null "> and cancel_time = #{cancelTime}</if>
</where>
</select>
<select id="selectTDetectorReportDataById" parameterType="Long" resultMap="TDetectorReportDataResult">
<include refid="selectTDetectorReportDataVo"/>
where id = #{id}
</select>
<select id="selectTDetectorReportDataByCode" parameterType="String" resultMap="TDetectorReportDataResult">
<include refid="selectTDetectorReportDataVo"/>
where detector_code = #{detectorCode}
order by create_time DESC LIMIT 1
</select>
<select id="selectRealtimeDataList" resultMap="TDetectorReportDataResult">
SELECT * FROM
(
SELECT
t.source_id,
t.detector_code,
t.detector_status,
t.report_value,
t.zh_host_status_id,
t.net_point,
t.signal_strength,
t.ip_address,
t.create_time,
t.is_cancel_alarm,
t.cancel_time,
d.detector_id,
d.detector_name,
d.detector_type
FROM
t_detector_report_data t
LEFT JOIN t_detector_info d ON t.detector_code = d.detector_code
WHERE
t.detector_status != '1'
ORDER BY t.create_time DESC
)data
GROUP BY data.detector_id LIMIT 50
</select>
<select id="countDetector" parameterType="List" resultMap="TDetectorReportDataResult" >
<include refid="selectTDetectorReportDataVo"/>
where detector_status != '1' and detector_code in
<foreach collection="list" item="detectorCode" index="index" open="(" close=")" separator=",">
#{detectorCode}
</foreach>
</select>
<insert id="insertTDetectorReportData" parameterType="TDetectorReportData" useGeneratedKeys="true" keyProperty="id">
insert into t_detector_report_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sourceId != null">source_id,</if>
<if test="detectorCode != null and detectorCode != ''">detector_code,</if>
<if test="detectorStatus != null">detector_status,</if>
<if test="reportValue != null">report_value,</if>
<if test="zhHostStatusId != null">zh_host_status_id,</if>
<if test="netPoint != null">net_point,</if>
<if test="signalStrength != null">signal_strength,</if>
<if test="ipAddress != null">ip_address,</if>
<if test="createTime != null">create_time,</if>
<if test="isCancelAlarm != null">is_cancel_alarm,</if>
<if test="cancelTime != null">cancel_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sourceId != null">#{sourceId},</if>
<if test="detectorCode != null and detectorCode != ''">#{detectorCode},</if>
<if test="detectorStatus != null">#{detectorStatus},</if>
<if test="reportValue != null">#{reportValue},</if>
<if test="zhHostStatusId != null">#{zhHostStatusId},</if>
<if test="netPoint != null">#{netPoint},</if>
<if test="signalStrength != null">#{signalStrength},</if>
<if test="ipAddress != null">#{ipAddress},</if>
<if test="createTime != null">#{createTime},</if>
<if test="isCancelAlarm != null">#{isCancelAlarm},</if>
<if test="cancelTime != null">#{cancelTime},</if>
</trim>
</insert>
<update id="updateTDetectorReportData" parameterType="TDetectorReportData">
update t_detector_report_data
<trim prefix="SET" suffixOverrides=",">
<if test="sourceId != null">source_id = #{sourceId},</if>
<if test="detectorCode != null and detectorCode != ''">detector_code = #{detectorCode},</if>
<if test="detectorStatus != null">detector_status = #{detectorStatus},</if>
<if test="reportValue != null">report_value = #{reportValue},</if>
<if test="zhHostStatusId != null">zh_host_status_id = #{zhHostStatusId},</if>
<if test="netPoint != null">net_point = #{netPoint},</if>
<if test="signalStrength != null">signal_strength = #{signalStrength},</if>
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="isCancelAlarm != null">is_cancel_alarm = #{isCancelAlarm},</if>
<if test="cancelTime != null">cancel_time = #{cancelTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTDetectorReportDataById" parameterType="Long">
delete from t_detector_report_data where id = #{id}
</delete>
<delete id="deleteTDetectorReportDataByIds" parameterType="String">
delete from t_detector_report_data where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.detector.mapper.TDetectorUserMapper"> <mapper namespace="com.zehong.system.mapper.TDetectorUserMapper">
<resultMap type="TDetectorUser" id="TDetectorUserResult"> <resultMap type="TDetectorUser" id="TDetectorUserResult">
<result property="userId" column="user_id" /> <result property="userId" column="user_id" />
......
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