Commit ab2399da authored by shiyubin's avatar shiyubin

山西数据推送完整版

parent 43c07fd4
......@@ -49,11 +49,11 @@ public class Sender {
resultList.add(dbDeviceInfo);
//对数据加密
String result = JSONUtil.toJsonStr(resultList);
String encrypt = AESUtil.encrypt(result, "i2MvNzkedPgITpz2UcZS3A==" , "ReQb3Swiz8frJ3+8l9RGvg==");
String encrypt = AESUtil.encrypt(result, "4qInuXy6CREhRch7toLcBg==" , "rluhvrn9+EHIodq5Tx86Jg==");
Map<String, Object> resultMap = new HashMap<String, Object>();
//荷载消息内容
while(true) {
resultMap.put("tailingNo","1402240003");
resultMap.put("tailingNo","1409240055");
resultMap.put("departmentId","" );
resultMap.put("provinceId", "");
resultMap.put("type","0101");
......
......@@ -16,13 +16,16 @@ import org.springframework.context.ConfigurableApplicationContext;
public class ShanxiApplication {
/*
山西宏伟矿业有限责任公司泽水沟东沟尾矿库
尾矿库编号:1402240003
转自 接口:
请上传尾矿库监测数据,以下是上传数据所需的配置信息:
繁峙县鑫丰矿业有限责任公司大李老沟尾矿库
尾矿库编号:1409240055
数据上传IP:192.166.1.253
rbmq账号:hwzsgdg
rbmq密码:7793oa
密钥:i2MvNzkedPgITpz2UcZS3A==
向量:ReQb3Swiz8frJ3+8l9RGvg==
rbmq账号:fsxfdllg
rbmq密码:TErA18
密钥:4qInuXy6CREhRch7toLcBg==
向量:rluhvrn9+EHIodq5Tx86Jg==
*/
public static void main(String[] args) {
ConfigurableApplicationContext run = SpringApplication.run(ShanxiApplication.class, args);
......@@ -36,16 +39,16 @@ public class ShanxiApplication {
//rabbitmq监听默认端口
factory.setPort(5672);
//设置访问的用户
factory.setUsername("hwzsgdg");
factory.setPassword("7793oa");
factory.setUsername("fsxfdllg");
factory.setPassword("TErA18");
factory.setVirtualHost("/");
Connection connection = factory.newConnection();
ThreadService threadService1 = new ThreadService("staticData", connection, deviceStaticDataAMQPService, realTimeDataAMQPService, alarmDataAMQPService);
ThreadService threadService2 = new ThreadService("realTimeData", connection, deviceStaticDataAMQPService, realTimeDataAMQPService,alarmDataAMQPService);
//ThreadService threadService3 = new ThreadService("alarmData", connection, deviceStaticDataAMQPService, realTimeDataAMQPService,alarmDataAMQPService);
ThreadService threadService3 = new ThreadService("alarmData", connection, deviceStaticDataAMQPService, realTimeDataAMQPService,alarmDataAMQPService);
threadService1.start();
threadService2.start();
//threadService3.start();
threadService3.start();
} catch(Exception e) {
e.printStackTrace();
}
......
......@@ -17,7 +17,7 @@ public interface DeviceStaticDataInfoDao {
List<KushuiweiDeviceInfoModel> findKushuiweiDeviceInfo();
@Select("SELECT id AS equipno, name AS equipname, jd AS longitude, wd AS latitude, gaocheng AS altitude FROM tab_sensor WHERE mark = '坝体表面位移'")
@Select("SELECT id AS equipno, name AS equipname, jd AS longitude, wd AS latitude, gaocheng AS altitude FROM tab_sensor WHERE mark = '坝体表面位移' and name != '基准点'")
List<BiaomianweiyiDeviceInfoModel> findBiaomianweiyiDeviceInfo();
......
package com.amqp.shanxi.dao;
import com.amqp.shanxi.model.*;
import lombok.Data;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
......@@ -10,11 +9,10 @@ import java.util.List;
@Mapper
public interface RealTimeInfoDao {
/**
* 干滩实时数据
*/
@Select("SELECT c.gantanid AS sensorno, c.jctime AS collectdate, c.gantan AS value, c.bagao AS beachTopHeight, c.podu AS beachLongSlope, c.ifbj AS valuestate, b.id AS recordid FROM (" +
@Select("SELECT b.id AS sensorno, c.jctime AS collectdate, c.gantan AS value, c.ifbj AS valuestate, c.id AS recordid FROM (" +
" SELECT a.id, a.gantanid, a.jctime, a.gantan, a.bagao, a.podu, a.ifbj from (" +
" SELECT id, gantanid, jctime, gantan, bagao, podu, ifbj, rank() OVER (PARTITION BY gantanid ORDER BY jctime DESC)" +
" FROM tab_gantanweiyi where jctime > now() - INTERVAL '6 hour'" +
......@@ -23,7 +21,7 @@ public interface RealTimeInfoDao {
List<GantanRealTimeInfoModel> findGantanRealTimeData();
@Select("SELECT c.sensorname AS sensorno, c.jctime AS collectdate, c.value2 as value, c.ifbj AS valuestate, b.id AS recordid FROM (" +
@Select("SELECT b.id AS sensorno, c.jctime AS collectdate, c.value2 as value, c.ifbj AS valuestate, c.id AS recordid FROM (" +
" SELECT a.id, a.sensorname, a.jctime, a.value2, a.ifbj FROM (" +
" SELECT id, sensorname, jctime, value2, ifbj, rank() OVER (PARTITION BY sensorname ORDER BY jctime DESC)"+
" FROM tab_kushuiwei WHERE jctime > now() - INTERVAL '6 hour'" +
......@@ -32,7 +30,7 @@ public interface RealTimeInfoDao {
List<KushuiweiRealTimeInfoModel> findKushuiweiRealTimeData();
@Select("SELECT c.sensorname AS sensorno, c.jctime AS collectdate, c.disx AS xvalue, c.disy AS yvalue, c.disz AS zvalue, c.ifbj AS displacementstate, b.id AS recordid FROM (" +
@Select("SELECT b.id AS sensorno, c.jctime AS collectdate, c.disx AS xvalue, c.disy AS yvalue, c.disz AS zvalue, c.ifbj AS displacementstate, c.id AS recordid FROM (" +
" SELECT a.id, a.sensorname, a.jctime, a.disx, a.disy, a.disz, a.ifbj from (" +
" SELECT id, sensorname, jctime, disx, disy, disz, ifbj, rank() OVER (PARTITION BY sensorname ORDER BY jctime DESC)" +
" FROM tab_batidibiaoweiyi where jctime > now() - INTERVAL '6 hour'" +
......@@ -41,7 +39,7 @@ public interface RealTimeInfoDao {
List<BiaomianweiyiRealTimeInfoModel> findBiaomianweiyiRealTimeData();
@Select("select c.sensorname AS sensorno, c.jctime AS collectdate, c.value2 as value, c.ifbj AS valuestate, b.id AS recordid from ("+
@Select("select b.id AS sensorno, c.jctime AS collectdate, c.value2 as value, c.ifbj AS valuestate, c.id AS recordid from ("+
" select a.id, a.sensorname, a.jctime, a.value2, a.ifbj from (" +
" select id, sensorname, jctime, value2, ifbj, rank() over (partition by sensorname order by jctime desc)" +
" from tab_jinrunxian where jctime > now() - interval '6 hour'" +
......@@ -50,7 +48,7 @@ public interface RealTimeInfoDao {
List<JinrunxianRealTimeInfoModel> findJinrunxianRealTimeData();
@Select("select c.sensorname AS sensorno, c.jctime AS collectdate, c.value2 as value, c.ifbj AS onehourvaluestate, b.id AS recordid from (" +
@Select("select b.id AS sensorno, c.jctime AS collectdate, c.value2 as value, c.ifbj AS onehourvaluestate, c.id AS recordid from (" +
" select a.id, a.sensorname, a.jctime, a.value2, a.ifbj from (" +
" select id, sensorname, jctime, value2, ifbj, rank() over (partition by sensorname order by jctime desc)" +
" from tab_jiangyuliang where jctime > now() - interval '6 hour'" +
......@@ -59,9 +57,33 @@ public interface RealTimeInfoDao {
List<JiangyuliangRealTimeInfoModel> findJiangyuliangRealTimeData();
/**
* 内部位移(水平)
* @return List<NeibuweiyiRealTimeInfoModel>
*/
@Select("select b.id AS sensorno, c.jctime AS collectdate, c.value2 as xvalue, 0 as yvalue, c.ifbj AS valuestate, c.id AS recordid from (" +
" select a.id, a.sensorname, a.jctime, a.value2, a.ifbj from ("+
" select id, sensorname, jctime, value2, ifbj, rank() over (partition by sensorname order by jctime desc)" +
" from tab_shuipingweiyi where jctime > now() - interval '6 hour'" +
" ) a where rank = 1" +
" ) c inner join (select id, name from tab_sensor) b on c.sensorname = b.name")
List<NeibuweiyiRealTimeInfoModel> findNeibuShuipingRealTimeData();
/**
* 内部位移(沉降)
* @return List<NeibuweiyiRealTimeInfoModel>
*/
@Select("select b.id AS sensorno, c.jctime AS collectdate, c.value2 as yvalue, 0 as xvalue, c.ifbj AS valuestate, c.id AS recordid from (" +
" select a.id, a.sensorname, a.jctime, a.value2, a.ifbj from (" +
" select id, sensorname, jctime, value2, ifbj, rank() over (partition by sensorname order by jctime desc)" +
" from tab_neibuchenjiang where jctime > now() - interval '6 hour'" +
" ) a where rank = 1" +
" ) c inner join (select id, name from tab_sensor) b on c.sensorname = b.name")
List<NeibuweiyiRealTimeInfoModel> findNeibuChenjiangRealTimeData();
// 监测项报警
@Select("select a.mark AS itemno,b.id AS recordid, b.yjjb AS state, b.jctime AS collectdate from"+
" (select mark from tab_sensor group by mark) a left join" +
" (select mark from tab_sensor where mark != '干滩1' group by mark) a left join" +
" (select id, alarmtype, yjjb, jctime from tab_alarmtype where status = 0) b on a.mark = b.alarmtype")
List<DeviceRealTimeInfoModel> findDeviceRealTimeData();
......@@ -71,50 +93,27 @@ public interface RealTimeInfoDao {
/**
* 设备离线
* @return
* @return List<DeviceOffLineInfoModel>
*/
@Select("select b.id AS recordid, b.name, a.jctime from" +
@Select("select b.id AS recordid, b.mark AS sensorno, a.jctime from" +
" (select jctime, gantanid from tab_gantanweiyi where jctime > now() - interval '6 hour') a right join" +
" (select id, name from tab_sensor where mark = '干滩2') b on a.gantanid = b.name where jctime is null" +
" (select id, name, mark from tab_sensor where mark = '干滩2') b on a.gantanid = b.name where jctime is null" +
" union all" +
" select b.id AS recordid, b.name, a.jctime from" +
" select b.id AS recordid, b.mark AS sensorno, a.jctime from" +
" (select sensorname, jctime from tab_kushuiwei where jctime > now() - interval '6 hour') a right join" +
" (select id, name from tab_sensor where mark = '库水位') b on a.sensorname = b.name where a.jctime is null" +
" (select id, name, mark from tab_sensor where mark = '库水位') b on a.sensorname = b.name where a.jctime is null" +
" union all" +
" select b.id AS recordid, b.name, a.jctime from" +
" select b.id AS recordid, b.mark AS sensorno, a.jctime from" +
" (select sensorname, jctime from tab_batidibiaoweiyi where jctime > now() - interval '6 hour') a right join" +
" (select id, name from tab_sensor where mark = '坝体表面位移') b on a.sensorname = b.name where a.jctime is null" +
" (select id, name, mark from tab_sensor where mark = '坝体表面位移') b on a.sensorname = b.name where a.jctime is null" +
" union all"+
" select b.id AS recordid, b.name, a.jctime from" +
" select b.id AS recordid, b.mark AS sensorno, a.jctime from" +
" (select sensorname, jctime from tab_jinrunxian where jctime > now() - interval '6 hour') a right join" +
" (select id, name from tab_sensor where mark = '浸润线') b on a.sensorname = b.name where a.jctime is null" +
" (select id, name, mark from tab_sensor where mark = '浸润线') b on a.sensorname = b.name where a.jctime is null" +
" union all" +
" select b.id AS recordid, b.name, a.jctime from" +
" select b.id AS recordid, b.mark AS sensorno, a.jctime from" +
" (select sensorname, jctime from tab_jiangyuliang where jctime > now() - interval '6 hour') a right join" +
" (select id, name from tab_sensor where mark = '雨量计') b on a.sensorname = b.name where a.jctime is null")
" (select id, name, mark from tab_sensor where mark = '雨量计') b on a.sensorname = b.name where a.jctime is null")
List<DeviceOffLineInfoModel> findDeviceOffLineData();
/**
* 内部位移(水平)
* @return
*/
@Select("select c.sensorname AS sensorno, c.jctime AS collectdate, c.value2 as xvalue, 0 as yvalue, c.ifbj AS valuestate, b.id AS recordid from (" +
" select a.id, a.sensorname, a.jctime, a.value2, a.ifbj from ("+
" select id, sensorname, jctime, value2, ifbj, rank() over (partition by sensorname order by jctime desc)" +
" from tab_shuipingweiyi where jctime > now() - interval '6 hour'" +
" ) a where rank = 1" +
" ) c inner join (select id, name from tab_sensor) b on c.sensorname = b.name")
List<NeibuweiyiRealTimeInfoModel> findNeibuShuipingRealTimeData();
/**
* 内部位移(沉降)
* @return
*/
@Select("select c.sensorname AS sensorno, c.jctime AS collectdate, c.value2 as yvalue, 0 as xvalue, c.ifbj AS valuestate, b.id AS recordid from (" +
" select a.id, a.sensorname, a.jctime, a.value2, a.ifbj from (" +
" select id, sensorname, jctime, value2, ifbj, rank() over (partition by sensorname order by jctime desc)" +
" from tab_neibuchenjiang where jctime > now() - interval '6 hour'" +
" ) a where rank = 1" +
" ) c inner join (select id, name from tab_sensor) b on c.sensorname = b.name")
List<NeibuweiyiRealTimeInfoModel> findNeibuChenjiangRealTimeData();
}
......@@ -7,7 +7,6 @@ public class BiaomianweiyiAlarmInfoModel {
private Integer recordid;
private String sensorno;
private String collectdate;
private String value;
private String warninglevel;
private String rvalue;
......
......@@ -5,16 +5,15 @@ import lombok.Data;
@Data
public class BiaomianweiyiRealTimeInfoModel {
private Integer recordid;
private String recordid;
private String sensorno;
private String collectdate;
private Double xvalue;
private Double yvalue;
private Double zvalue;
private String xvalue;
private String yvalue;
private String zvalue;
private Double displacement;
private String displacementstate;
private Double displacementrate;
private String displacementratestate;
}
package com.amqp.shanxi.model;
import lombok.Data;
/**
* 干滩设备信息实体类
*/
@Data
public class DBDeviceInfo {
private String equipno;//设备编号
......@@ -38,142 +42,6 @@ public class DBDeviceInfo {
private String is_sync;//同步状态
public String getEquipno() {
return equipno;
}
public void setEquipno(String equipno) {
this.equipno = equipno;
}
public String getEquipname() {
return equipname;
}
public void setEquipname(String equipname) {
this.equipname = equipname;
}
public String getInstallationdate() {
return installationdate;
}
public void setInstallationdate(String installationdate) {
this.installationdate = installationdate;
}
public String getManufacture() {
return manufacture;
}
public void setManufacture(String manufacture) {
this.manufacture = manufacture;
}
public Double getInstalllocation() {
return installlocation;
}
public void setInstalllocation(Double installlocation) {
this.installlocation = installlocation;
}
public String getInstallationlocate() {
return installationlocate;
}
public void setInstallationlocate(String installationlocate) {
this.installationlocate = installationlocate;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public Double getAltitude() {
return altitude;
}
public void setAltitude(Double altitude) {
this.altitude = altitude;
}
public Double getOnelevelalarm() {
return onelevelalarm;
}
public void setOnelevelalarm(Double onelevelalarm) {
this.onelevelalarm = onelevelalarm;
}
public Double getTwolevelalarm() {
return twolevelalarm;
}
public void setTwolevelalarm(Double twolevelalarm) {
this.twolevelalarm = twolevelalarm;
}
public Double getThreelevelalarm() {
return threelevelalarm;
}
public void setThreelevelalarm(Double threelevelalarm) {
this.threelevelalarm = threelevelalarm;
}
public Double getHonelevelalarm() {
return honelevelalarm;
}
public void setHonelevelalarm(Double honelevelalarm) {
this.honelevelalarm = honelevelalarm;
}
public Double getHtwolevelalarm() {
return htwolevelalarm;
}
public void setHtwolevelalarm(Double htwolevelalarm) {
this.htwolevelalarm = htwolevelalarm;
}
public Double getHthreelevelalarm() {
return hthreelevelalarm;
}
public void setHthreelevelalarm(Double hthreelevelalarm) {
this.hthreelevelalarm = hthreelevelalarm;
}
public String getIs_used() {
return is_used;
}
public void setIs_used(String is_used) {
this.is_used = is_used;
}
public String getIs_sync() {
return is_sync;
}
public void setIs_sync(String is_sync) {
this.is_sync = is_sync;
}
@Override
public String toString() {
return "DBDeviceInfo [equipno=" + equipno + ", equipname=" + equipname + ", installationdate="
......
......@@ -5,7 +5,7 @@ import lombok.Data;
@Data
public class DeviceRealTimeInfoModel {
private Integer recordid;
private String recordid;
private String itemno;
private String collectdate;
private String state;
......
......@@ -11,7 +11,6 @@ public class GantanDeviceInfoModel {
private String equipname;
private String installationdate;
private String installationlocate;
private Double installlocation;
private String manufacture;
private String longitude;
private String latitude;
......
......@@ -5,10 +5,10 @@ import lombok.Data;
@Data
public class GantanRealTimeInfoModel {
private Integer recordid;
private String recordid;
private String sensorno;
private String collectdate;
private Double value;
private String value;
private String valuestate;
private Double freeBoard;
private String freeBoardState;
......
......@@ -15,8 +15,8 @@ public class JiangyuliangAlarmInfoModel {
private String sixwarninglevel;
private String twelvevalue;
private String twelvewarninglevel;
private String twentyvalue;
private String twentywarninglevel;
private String twentyfourvalue;
private String twentyfourwarninglevel;
private String warningcontent;
private String warningdata;
......
......@@ -23,8 +23,8 @@ public class JiangyuliangDeviceInfoModel {
private Double sixhourstwolevelalarm;
private Double sixhoursthreelevelalarm;
private Double twelvehoursonelevelalarm;
private Double twolvehourstwolevelalarm;
private Double twolvehoursthreelevelalarm;
private Double twelvehourstwolevelalarm;
private Double twelvehoursthreelevelalarm;
private Double tfhoursonelevelalarm;
private Double tfhourstwolevelalarm;
private Double tfhoursthreelevelalarm;
......
......@@ -5,10 +5,10 @@ import lombok.Data;
@Data
public class JiangyuliangRealTimeInfoModel {
private Integer recordid;
private String recordid;
private String sensorno;
private String collectdate;
private Double value;
private String value;
private Double onehourvalue;
private String onehourvaluestate;
private Double threehoursvalue;
......@@ -17,7 +17,7 @@ public class JiangyuliangRealTimeInfoModel {
private String sixhoursvaluestate;
private Double twelvehoursvalue;
private String twelvehoursvaluestate;
private Double twentyhoursvalue;
private String twentyhoursvaluestate;
private Double twentyfourhoursvalue;
private String twentyfourhoursvaluestate;
}
......@@ -11,7 +11,7 @@ public class JinrunxianDeviceInfoModel {
private String installationlocate;
private String manufacture;
private String holedepth;
private String burialdepath;
private String burialdepth;
private String longitude;
private String latitude;
private String altitude;
......
......@@ -5,10 +5,10 @@ import lombok.Data;
@Data
public class JinrunxianRealTimeInfoModel {
private Integer recordid;
private String recordid;
private String sensorno;
private String collectdate;
private Double value;
private String value;
private String valuestate;
}
......@@ -5,10 +5,10 @@ import lombok.Data;
@Data
public class KushuiweiRealTimeInfoModel {
private Integer recordid;
private String recordid;
private String sensorno;
private String collectdate;
private Double value;
private String value;
private String valuestate;
}
......@@ -5,11 +5,11 @@ import lombok.Data;
@Data
public class NeibuweiyiRealTimeInfoModel {
private Integer recordid;
private String recordid;
private String sensorno;
private String collectdate;
private Double xvalue;
private Double yvalue;
private String xvalue;
private String yvalue;
private Double displacement;
private String displacementstate;
private Double displacementrate;
......
......@@ -5,8 +5,8 @@ import lombok.Data;
@Data
public class WkkRealTimeInfoModel {
private Integer recordid;
private String collectdat;
private String recordid;
private String collectdate;
private String state;
}
......@@ -62,6 +62,7 @@ public class DeviceStaticDataAMQPService {
System.out.println("尾矿库基础信息发送失败!");
}
channel.close();
} else if ("gt".equals(type)) {
Channel channel = connection.createChannel();
// channel.queueDeclare("static_gantan", true, false, false, null);
......@@ -78,6 +79,7 @@ public class DeviceStaticDataAMQPService {
System.out.println("干滩设备信息发送失败!");
}
channel.close();
} else if ("ksw".equals(type)) {
Channel channel = connection.createChannel();
//channel.queueDeclare("static_kushuiwei", true, false, false, null);
......@@ -124,6 +126,7 @@ public class DeviceStaticDataAMQPService {
System.out.println("内部位移设备信息发送失败!");
}
channel.close();
} else if ("jrx".equals(type)) {
Channel channel = connection.createChannel();
channel.basicPublish(AMQPTopicStaticDataConfig.TOPIC_EXCHANGE
......
......@@ -3,22 +3,23 @@ server:
spring:
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/MineTRS_hongwei
url: jdbc:postgresql://localhost:5432/MineTRS_fanshi
username: postgres
#password: ENC(MUOMhFvUHg7PHf1SB5lEs7cCgxexl14k)
password: mengzi--
password: red___
device: # 设备编码 -parameters
gantanno: '140224000301'
kushuiweino: '140224000302'
biaomianweiyino: '140224000303'
neibuweiyino: '140224000304'
jinrunxianno: '140224000305'
jiangyuliangno: '140224000306'
shenliuliangno: '140224000307'
gantanno: '140924005501'
kushuiweino: '140924005502'
biaomianweiyino: '140924005503'
neibuweiyino: '140924005504'
jinrunxianno: '140924005505'
jiangyuliangno: '140924005506'
shenliuliangno: '140924005507'
basic: # 基础信息
provinceno: '14'
wkkno: '1402240003'
wkkno: '1409240055'
datatype:
basicinfo: '0001'
......
No preview for this file type
......@@ -3,22 +3,23 @@ server:
spring:
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/MineTRS_hongwei
url: jdbc:postgresql://localhost:5432/MineTRS_fanshi
username: postgres
#password: ENC(MUOMhFvUHg7PHf1SB5lEs7cCgxexl14k)
password: mengzi--
password: red___
device: # 设备编码 -parameters
gantanno: '140224000301'
kushuiweino: '140224000302'
biaomianweiyino: '140224000303'
neibuweiyino: '140224000304'
jinrunxianno: '140224000305'
jiangyuliangno: '140224000306'
shenliuliangno: '140224000307'
gantanno: '140924005501'
kushuiweino: '140924005502'
biaomianweiyino: '140924005503'
neibuweiyino: '140924005504'
jinrunxianno: '140924005505'
jiangyuliangno: '140924005506'
shenliuliangno: '140924005507'
basic: # 基础信息
provinceno: '14'
wkkno: '1402240003'
wkkno: '1409240055'
datatype:
basicinfo: '0001'
......
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