修改全局参数和告警参数

hunan
liuguijing 2 years ago
parent 09c8cad166
commit d7820a3ec1

@ -5,6 +5,7 @@ import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.bean.ServiceStatus;
import com.shxy.xymanager_common.model.GlobalParamsModel;
import com.shxy.xymanager_service.service.GloablParamsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -29,8 +30,8 @@ public class GloableParamsController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getMarkEnableStatus")
@Log(title = "查询图片绘制开关状态", type = "查询")
public ResponseReult<Integer> getMarkEnableStatus() {
ServiceBody<Integer> serviceBody = gloableParamsService.getMarkEnableStatus();
public ResponseReult<GlobalParamsModel> getMarkEnableStatus() {
ServiceBody<GlobalParamsModel> serviceBody = gloableParamsService.getMarkEnableStatus();
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
@ -42,7 +43,7 @@ public class GloableParamsController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/updateMarkEnableStatus")
@Log(title = "修改图片绘制开关状态", type = "修改")
public ResponseReult<String> updateMarkEnableStatus(@RequestParam("status") Integer status) {
public ResponseReult<String> updateMarkEnableStatus(@RequestParam("status") Integer status) {
ServiceBody<String> serviceBody = gloableParamsService.updateMarkEnableStatus(status);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
@ -51,5 +52,17 @@ public class GloableParamsController extends BaseController {
}
}
@ApiOperation(value = "修改告警展示的通道接口", notes = "修改告警展示的通道接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/updateAlarmChannel")
@Log(title = "修改告警展示的通道接口", type = "修改")
public ResponseReult<String> updateAlarmChannel(@RequestParam("channel") Integer status) {
ServiceBody<String> serviceBody = gloableParamsService.updateAlarmChannel(status);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
}
}

@ -0,0 +1,16 @@
package com.shxy.xymanager_common.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.List;
@Data
public class LastPicTimeDto implements Serializable {
private BigInteger photoTime;
private static final long serialVersionUID = 1L;
}

@ -11,9 +11,9 @@ import java.util.List;
public class TerminalsAndStatusAndLastPicDto implements Serializable {
private Integer id;
private Integer towerid;
private Integer towerId;
private String cmdid;
private String cmdId;
private String displayName;
@ -29,12 +29,7 @@ public class TerminalsAndStatusAndLastPicDto implements Serializable {
private BigInteger lastHeartbeat;
private List<PhotoTime> list;
@Data
public static class PhotoTime {
private BigInteger photoTime;
}
private List<LastPicTimeDto> list;
private static final long serialVersionUID = 1L;

@ -8,7 +8,7 @@ package com.shxy.xymanager_common.enums;
* @author
*/
public enum GloableParamsType {
ImgMark("img_mark");
ImgMark("img_mark"),ALarmChannel("alarm_channel");
private String name;

@ -0,0 +1,23 @@
package com.shxy.xymanager_common.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
*
*/
@Data
@ApiModel(value = "全局参数对象", description = "全局参数对象")
public class GlobalParamsModel implements Serializable {
@ApiModelProperty(value = "图像标志", example = "123456")
private Integer imgMark;
@ApiModelProperty(value = "告警通道", example = "123456")
private Integer alarmChannel;
}

@ -26,9 +26,6 @@ public class TerminalAlarmSelectVo {
@ApiModelProperty(value = "告警类型", example = "123455")
private Integer label;
@ApiModelProperty(value = "通道编号", example = "123455")
private Integer channel;
@NotNull(message = "查询时间不能缺少")
@ApiModelProperty(value = "查询时间", example = "123455")
private Date starttime;

@ -74,7 +74,7 @@
#{item}
</foreach>
</if>
<if test="channel != null">
<if test="channel != null and channel >= 0">
and channel_id = #{channel}
</if>
<if test="labellist != null and labellist.size > 0">

@ -75,7 +75,7 @@
<result column="battery_capacity" jdbcType="REAL" property="batteryCapacity"/>
<result column="battery_voltage" jdbcType="REAL" property="batteryVoltage"/>
<result column="last_heartbeat" jdbcType="BIGINT" property="lastHeartbeat"/>
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.LineAndTerminalWithHeartDto">
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.LastPicTimeDto">
<result column="photo_time" jdbcType="BIGINT" property="photoTime"/>
</collection>
</resultMap>

@ -1,9 +1,11 @@
package com.shxy.xymanager_service.impl;
import cn.hutool.core.util.StrUtil;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.entity.GlobalParams;
import com.shxy.xymanager_common.enums.GloableParamsType;
import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_common.model.GlobalParamsModel;
import com.shxy.xymanager_dao.dao.GlobalParamsDao;
import com.shxy.xymanager_service.cache.XyCache;
import com.shxy.xymanager_service.service.CacheService;
@ -35,14 +37,26 @@ public class GloablParamsServiceImpl implements GloablParamsService {
* @return
*/
@Override
public ServiceBody<Integer> getMarkEnableStatus() {
public ServiceBody<GlobalParamsModel> getMarkEnableStatus() {
GlobalParamsModel model = new GlobalParamsModel();
Map<String, String> globalParams = cacheService.getGolobalMap();
String s = globalParams.get(GloableParamsType.ImgMark.value());
Integer integer = Integer.valueOf(s);
return Asserts.success(integer);
if (StrUtil.isNotEmpty(s)) {
Integer integer = Integer.valueOf(s);
model.setImgMark(integer);
} else {
model.setImgMark(0);
}
String channelstr = globalParams.get(GloableParamsType.ALarmChannel.value());
if (StrUtil.isNotEmpty(channelstr)) {
Integer channel = Integer.valueOf(channelstr);
model.setAlarmChannel(channel);
} else {
model.setAlarmChannel(-1);
}
return Asserts.success(model);
}
/**
*
*
@ -62,4 +76,18 @@ public class GloablParamsServiceImpl implements GloablParamsService {
}
}
@Override
public ServiceBody<String> updateAlarmChannel(Integer channelid) {
GlobalParams record = new GlobalParams();
record.setParamName(GloableParamsType.ALarmChannel.value());
record.setParamValue(String.valueOf(channelid));
int i = globalParamsDao.updateByParamName(record, new Date());
if (i != 0) {
cacheService.updateGolobalMap();
return Asserts.success("修改成功");
} else {
return Asserts.error("修改失败");
}
}
}

@ -9,6 +9,7 @@ import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.dto.*;
import com.shxy.xymanager_common.entity.*;
import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_common.enums.GloableParamsType;
import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_common.model.*;
import com.shxy.xymanager_common.page.PageUtils;
@ -72,10 +73,6 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
Integer lineid = vo.getLineId();
Integer towerid = vo.getTowerId();
Integer label = vo.getLabel();
Integer channel = vo.getChannel();
if (channel == null || channel == -1) {
channel = null;
}
String search = vo.getSearch();
if (StrUtil.isEmpty(search)) {
search = null;
@ -91,6 +88,15 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
labellist.add(terminalImgAlarmParams);
}
Integer channel = null;
Map<String, String> globalParams = cacheService.getGolobalMap();
String s = globalParams.get(GloableParamsType.ALarmChannel.value());
if (StrUtil.isNotEmpty(s)) {
Integer integer = Integer.valueOf(s);
channel = integer;
} else {
channel = null;
}
Date starttime = vo.getStarttime();
Date endtime = vo.getEndtime();
int pageindex = vo.getPageindex();

@ -579,17 +579,17 @@ public class TerminalServiceImpl implements TerminalService {
@Override
public ServiceBody<List<TerminalAndLastPicListExcelModel>> getOnlineTerminalList() {
List<TerminalAndLastPicListExcelModel> modellist = new ArrayList<>();
TerminalAndLastPicListExcelModel model = new TerminalAndLastPicListExcelModel();
Map<Integer, TowerDto> towerMap = cacheService.getTowerMap();
List<TerminalsAndStatusAndLastPicDto> list = terminalsDao.selectTermAndStatusAndLastPicList(CommonStatus.EFFECTIVE.value());
boolean empty = CollectionUtil.isEmpty(list);
if (!empty) {
for (int i = 0; i < list.size(); i++) {
TerminalAndLastPicListExcelModel model = new TerminalAndLastPicListExcelModel();
TerminalsAndStatusAndLastPicDto item = list.get(i);
if (item != null) {
model.setCmdId(item.getCmdid());
model.setCmdId(item.getCmdId());
if (towerMap != null) {
Integer towerid = item.getTowerid();
Integer towerid = item.getTowerId();
TowerDto towerDto = towerMap.get(towerid);
if (towerDto != null) {
model.setLineName(towerDto.getLineName());
@ -609,18 +609,21 @@ public class TerminalServiceImpl implements TerminalService {
} else {
model.setIsonline("否");
}
List<TerminalsAndStatusAndLastPicDto.PhotoTime> timeList = item.getList();
List<LastPicTimeDto> timeList = item.getList();
if (CollectionUtil.isNotEmpty(timeList)) {
ArrayList<BigInteger> list1 = new ArrayList<>();
for (int j = 0; j < timeList.size(); j++) {
TerminalsAndStatusAndLastPicDto.PhotoTime photoTime = timeList.get(j);
LastPicTimeDto photoTime = timeList.get(j);
if (photoTime != null) {
list1.add(photoTime.getPhotoTime());
}
}
if (CollectionUtil.isNotEmpty(list1)) {
String s = "";
BigInteger max = CollectionUtil.max(list1);
String s = MyDateUtils.TimeSecondToDate(max);
if (max.longValue() != 0) {
s = MyDateUtils.TimeSecondToDate(max);
}
model.setPictime(s);
}
}

@ -2,6 +2,7 @@ package com.shxy.xymanager_service.service;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.model.GlobalParamsModel;
/**
*
@ -15,7 +16,7 @@ public interface GloablParamsService {
*
* @return
*/
ServiceBody<Integer> getMarkEnableStatus();
ServiceBody<GlobalParamsModel> getMarkEnableStatus();
/**
*
@ -25,4 +26,10 @@ public interface GloablParamsService {
ServiceBody<String> updateMarkEnableStatus(Integer status);
/**
*
* @param status
* @return
*/
ServiceBody<String> updateAlarmChannel(Integer status);
}

Loading…
Cancel
Save