Commit 29137847 authored by zhangjianqian's avatar zhangjianqian

报警推送,配置修改

parent 8d103020
......@@ -77,7 +77,11 @@ public class CommonController
String fileName = file.getOriginalFilename();
//本地存储地址
// String fileName=filePath+FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + FileUploadUtils.upload(filePath, file);
String fileServer = serverConfig.getUrl();
if(fileServer.contains("psrq.zhkjgf.com")){
fileServer = serverConfig.getUrl().replace("http://psrq.zhkjgf.com","https://psrq.zhkjgf.com:8093");
}
String url = fileServer + FileUploadUtils.upload(filePath, file);
AjaxResult ajax = AjaxResult.success();
// ajax.put("fileName", fileName);
ajax.put("fileName", fileName);
......
......@@ -136,6 +136,8 @@ public class TDetectorInfoController extends BaseController
alarm.setDetectorType("家用探测器");
} else if ("2".equals(alarm.getDetectorType())){
alarm.setDetectorType("工业探测器");
}else if ("3".equals(alarm.getDetectorType())){
alarm.setDetectorType("可燃气体探测器");
}
}
......@@ -152,7 +154,6 @@ public class TDetectorInfoController extends BaseController
return AjaxResult.success(map);
}
/**
* 获取探测器监控数据
* @param tDetectorInfo
......
......@@ -15,6 +15,7 @@ import com.zehong.system.domain.vo.TDetectorUserVO;
import com.zehong.system.service.ITDetectorInfoService;
import com.zehong.system.service.ITDetectorReportDataService;
import com.zehong.system.service.ITDetectorUserService;
import com.zehong.system.service.WebSocketServer;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
......@@ -48,6 +50,8 @@ public class TDetectorReportController extends BaseController
private ITDetectorUserService tDetectorUserService;
@Autowired
private ITDetectorReportDataService tDetectorReportDataService;
@Autowired
private WebSocketServer webSocketServer;
@ApiOperation(value = "泽宏报警器信息推送接口")
@PostMapping("/reportTDetectorInfoData")
......@@ -402,6 +406,12 @@ public class TDetectorReportController extends BaseController
datas.setCreateTime(StringUtils.isEmpty(tDetectorReportDataForm.getCreateTime()) ? null : new Date());
tDetectorReportDataService.insertTDetectorReportData(datas);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
datas.setAlarmTime(dateFormat.format(datas.getCreateTime()));
//webSocketServer.batchSendMessage(JSONObject.toJSONString("success"));
TDetectorInfo info = tDetectorInfoService.selectTDetectorInfoByCode(datas.getDetectorCode());
datas.setDetectorType(info.getDetectorType());
webSocketServer.batchSendMessage(JSONObject.toJSONString(datas));
}
} else {
......@@ -418,6 +428,12 @@ public class TDetectorReportController extends BaseController
datas.setCreateTime(StringUtils.isEmpty(tDetectorReportDataForm.getCreateTime()) ? null : new Date());
tDetectorReportDataService.insertTDetectorReportData(datas);
//webSocketServer.batchSendMessage(JSONObject.toJSONString("success"));
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
datas.setAlarmTime(dateFormat.format(datas.getCreateTime()));
TDetectorInfo info = tDetectorInfoService.selectTDetectorInfoByCode(datas.getDetectorCode());
datas.setDetectorType(info.getDetectorType());
webSocketServer.batchSendMessage(JSONObject.toJSONString(datas));
}
}
// else if(!StringUtils.isEmpty(tDetectorReportDataForm.getDeviceType()) && tDetectorReportDataForm.getDeviceType().equals("2") && !StringUtils.isEmpty(tDetectorReportDataForm.getDeviceStatusId()) && !tDetectorReportDataForm.getDeviceStatusId().equals("E")){
......
......@@ -6,9 +6,10 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://222.223.203.154:3309/gas_progress_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: root@123
url: jdbc:mysql://36.138.180.129:3306/gas_progress_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
#url: jdbc:mysql://36.148.23.59:3306/gas_progress_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: gas_progress_db
password: RMtiC6YCzdLxeJJL
# 从库数据源
slave:
# 从数据源开关/默认关闭
......@@ -58,13 +59,13 @@ spring:
# redis 配置
redis:
# 地址
host: 222.223.203.154
host: 127.0.0.1
# 端口,默认为6379
port: 6380
port: 6379
# 数据库索引
database: 0
# 密码
password: 1qaz2wsx3edc
password:
# 连接超时时间
timeout: 10s
lettuce:
......
# 开发环境配置
server:
# 服务器的HTTP端口,默认为8080
port: 8903
port: 8904
servlet:
# 应用的访问路径
context-path: /gassafety
......
......@@ -26,13 +26,34 @@ public class TDetectorReportData implements Serializable {
private Date createTime;
private String alarmTime;
// 是否销警,默认0, 1自动销警,2手动销警
private String isCancelAlarm;
private Date cancelTime;
private String detectorType;
private static final long serialVersionUID = 1L;
public String getDetectorType() {
return detectorType;
}
public void setDetectorType(String detectorType) {
this.detectorType = detectorType;
}
public String getAlarmTime() {
return alarmTime;
}
public void setAlarmTime(String alarmTime) {
this.alarmTime = alarmTime;
}
public Integer getId() {
return id;
}
......
......@@ -50,6 +50,9 @@ public class TSiteStationInfo extends BaseEntity
@Excel(name = "纬度")
private BigDecimal latitude;
@Excel(name = "详细地址")
private String address;
/** 是否删除(0正常,1删除) */
private String isDel;
......@@ -63,6 +66,14 @@ public class TSiteStationInfo extends BaseEntity
/** 关联设备类型 1设备 2场站*/
private String relationDeviceType;
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPictureAddress() {
return pictureAddress;
}
......
......@@ -88,6 +88,16 @@ public class TSiteStationInfoData {
//探测器报警中
private int detectorInAlarm;
private String address;
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPictureAddress() {
return pictureAddress;
}
......
......@@ -71,4 +71,6 @@ public interface TDetectorReportDataMapper
* @return 结果
*/
public int deleteTDetectorReportDataByIds(Long[] ids);
public TDetectorAlarmInfoVO selectAlarm(Integer id);
}
......@@ -31,6 +31,8 @@ public interface ITDetectorReportDataService
public List<TDetectorAlarmInfoVO> selectTDetectorAlarm();
public TDetectorAlarmInfoVO selectAlarm(Integer id);
public List<TDetectorReportData> countDetectorByUserId(TDetectorInfo tDetectorInfo);
/**
......
......@@ -48,6 +48,11 @@ public class TDetectorReportDataServiceImpl implements ITDetectorReportDataServi
{
return tDetectorReportDataMapper.selectTDetectorAlarm();
}
@Override
public TDetectorAlarmInfoVO selectAlarm(Integer id)
{
return tDetectorReportDataMapper.selectAlarm(id);
}
@Override
public List<TDetectorReportData> selectRealtimeDataList()
......
......@@ -125,7 +125,7 @@
<!--场站信息查询方法-->
<select id="selectTSiteStationInfoData" resultMap="TSiteStationInfoDataResult">
select beyond_enterprise_id,picture_address,site_station_id,site_station_name,site_station_type,longitude,latitude,create_time,build_unit,beyond_enterprise_name
select beyond_enterprise_id,picture_address,site_station_id,site_station_name,site_station_type,longitude,latitude,address,create_time,build_unit,beyond_enterprise_name
from t_site_station_info where is_del='0'
</select>
......
......@@ -259,4 +259,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="selectAlarm" parameterType="integer" resultType="TDetectorAlarmInfoVO">
SELECT d.*,u.nick_name as unitName t_detector_report_data d
LEFT JOIN t_detector_info i on i.detector_code = d.detector_code
LEFT JOIN t_detector_user u on u.user_id = i.user_id
WHERE d.id = #{id}
</select>
</mapper>
\ No newline at end of file
......@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="beyondEnterpriseName" column="beyond_enterprise_name" />
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
<result property="address" column="address" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
......@@ -25,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectTSiteStationInfoVo">
select site_station_id,picture_address,(CASE site_station_type WHEN '1' THEN '加气站' WHEN '2' THEN '门站'WHEN '3' THEN '调压站' WHEN '4' THEN '储备站'WHEN '5' THEN '气化站'end ) as site_station_type,
site_station_name, build_date, build_unit, beyond_enterprise_id, beyond_enterprise_name, longitude, latitude,
site_station_name, build_date, build_unit, beyond_enterprise_id, beyond_enterprise_name, longitude, latitude,address,
create_by, create_time, update_by, update_time, is_del, remarks from t_site_station_info
</sql>
......@@ -44,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectTSiteStationInfoById" parameterType="Long" resultMap="TSiteStationInfoResult">
select site_station_id,picture_address,site_station_type,
select site_station_id,picture_address,site_station_type,address,
site_station_name, build_date, build_unit, beyond_enterprise_id, beyond_enterprise_name, longitude, latitude,
create_by, create_time, update_by, update_time, is_del, remarks from t_site_station_info
where site_station_id = #{siteStationId} and is_del='0'
......
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