diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java index 7fb5953..eb1f7ab 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java @@ -1,16 +1,13 @@ package com.casic.PgInterface.devTable.domain; import com.casic.PgInterface.devData.domain.*; -import com.casic.PgInterface.patroler.domain.PgAlarmRule; -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.List; /** - * Created by yxw on 2017/10/30. + * Created by yxw on 2017/12/29. */ @Entity @Table(name = "PG_DEVICE") @@ -19,27 +16,29 @@ private static final long serialVersionUID = 1L; private long id; - private PipeGallery pipeGalleryId;//所在管廊信息 + private String partition;//分区 private String road;//路名 + private String pipeGallery;//仓位 private String position;//设备位置 private String devType;//设备类型 private String devCode;//设备编号 private String assetName;//资产名称 - private String assetCode;//资产编码 + private String assetCode;//资产名称 private String assetBarCode;//资产条码 private String ip;//IP地址 private String modBus;//modBus地址 private String mome;//备注 - private int isOpen;//设备是否开启 + private int isOpen;//设备开启状态 private int active;//状态位 private List pgAlarms; - private List pgTempHums;//温湿度 - private List pgCos;//一氧化碳 - private List pgO2s;//氧气 - private List pgCh4s;//甲烷 - private List pgShs;//硫化氢 - private List pgAlarmRules;//报警规则 + private List pgCh4s; + private List pgCos; + private List pgLocations; + private List pgO2s; + private List pgShs; + private List pgTempHums; + @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_ID") @@ -51,6 +50,15 @@ this.id = id; } + @Column(name = "PARTITION") + public String getPartition() { + return partition; + } + + public void setPartition(String partition) { + this.partition = partition; + } + @Column(name = "ROAD") public String getRoad() { return road; @@ -60,6 +68,15 @@ this.road = road; } + @Column(name = "PIPEGALLERY") + public String getPipeGallery() { + return pipeGallery; + } + + public void setPipeGallery(String pipeGallery) { + this.pipeGallery = pipeGallery; + } + @Column(name = "POSITION") public String getPosition() { return position; @@ -69,7 +86,7 @@ this.position = position; } - @Column(name = "DEV_TYPE") + @Column(name = "DEVTPYE") public String getDevType() { return devType; } @@ -78,7 +95,7 @@ this.devType = devType; } - @Column(name = "DEV_CODE") + @Column(name = "DEVCODE") public String getDevCode() { return devCode; } @@ -87,7 +104,7 @@ this.devCode = devCode; } - @Column(name = "ASSET_NAME") + @Column(name = "ASSETNAME") public String getAssetName() { return assetName; } @@ -96,7 +113,7 @@ this.assetName = assetName; } - @Column(name = "ASSET_CODE") + @Column(name = "ASSETCODE") public String getAssetCode() { return assetCode; } @@ -105,7 +122,7 @@ this.assetCode = assetCode; } - @Column(name = "ASSET_BAR_CODE") + @Column(name = "ASSETBARCODE") public String getAssetBarCode() { return assetBarCode; } @@ -168,24 +185,13 @@ this.pgAlarms = pgAlarms; } - @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) - @NotFound(action = NotFoundAction.IGNORE) - @JoinColumn(name = "PGID") - public PipeGallery getPipeGalleryId() { - return pipeGalleryId; - } - - public void setPipeGalleryId(PipeGallery pipeGalleryId) { - this.pipeGalleryId = pipeGalleryId; - } - @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") - public List getPgTempHums() { - return pgTempHums; + public List getPgCh4s() { + return pgCh4s; } - public void setPgTempHums(List pgTempHums) { - this.pgTempHums = pgTempHums; + public void setPgCh4s(List pgCh4s) { + this.pgCh4s = pgCh4s; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") @@ -198,6 +204,15 @@ } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") + public List getPgLocations() { + return pgLocations; + } + + public void setPgLocations(List pgLocations) { + this.pgLocations = pgLocations; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") public List getPgO2s() { return pgO2s; } @@ -207,15 +222,6 @@ } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") - public List getPgCh4s() { - return pgCh4s; - } - - public void setPgCh4s(List pgCh4s) { - this.pgCh4s = pgCh4s; - } - - @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") public List getPgShs() { return pgShs; } @@ -225,12 +231,11 @@ } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") - public List getPgAlarmRules() { - return pgAlarmRules; + public List getPgTempHums() { + return pgTempHums; } - public void setPgAlarmRules(List pgAlarmRules) { - this.pgAlarmRules = pgAlarmRules; + public void setPgTempHums(List pgTempHums) { + this.pgTempHums = pgTempHums; } - } diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java index 7fb5953..eb1f7ab 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java @@ -1,16 +1,13 @@ package com.casic.PgInterface.devTable.domain; import com.casic.PgInterface.devData.domain.*; -import com.casic.PgInterface.patroler.domain.PgAlarmRule; -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.List; /** - * Created by yxw on 2017/10/30. + * Created by yxw on 2017/12/29. */ @Entity @Table(name = "PG_DEVICE") @@ -19,27 +16,29 @@ private static final long serialVersionUID = 1L; private long id; - private PipeGallery pipeGalleryId;//所在管廊信息 + private String partition;//分区 private String road;//路名 + private String pipeGallery;//仓位 private String position;//设备位置 private String devType;//设备类型 private String devCode;//设备编号 private String assetName;//资产名称 - private String assetCode;//资产编码 + private String assetCode;//资产名称 private String assetBarCode;//资产条码 private String ip;//IP地址 private String modBus;//modBus地址 private String mome;//备注 - private int isOpen;//设备是否开启 + private int isOpen;//设备开启状态 private int active;//状态位 private List pgAlarms; - private List pgTempHums;//温湿度 - private List pgCos;//一氧化碳 - private List pgO2s;//氧气 - private List pgCh4s;//甲烷 - private List pgShs;//硫化氢 - private List pgAlarmRules;//报警规则 + private List pgCh4s; + private List pgCos; + private List pgLocations; + private List pgO2s; + private List pgShs; + private List pgTempHums; + @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_ID") @@ -51,6 +50,15 @@ this.id = id; } + @Column(name = "PARTITION") + public String getPartition() { + return partition; + } + + public void setPartition(String partition) { + this.partition = partition; + } + @Column(name = "ROAD") public String getRoad() { return road; @@ -60,6 +68,15 @@ this.road = road; } + @Column(name = "PIPEGALLERY") + public String getPipeGallery() { + return pipeGallery; + } + + public void setPipeGallery(String pipeGallery) { + this.pipeGallery = pipeGallery; + } + @Column(name = "POSITION") public String getPosition() { return position; @@ -69,7 +86,7 @@ this.position = position; } - @Column(name = "DEV_TYPE") + @Column(name = "DEVTPYE") public String getDevType() { return devType; } @@ -78,7 +95,7 @@ this.devType = devType; } - @Column(name = "DEV_CODE") + @Column(name = "DEVCODE") public String getDevCode() { return devCode; } @@ -87,7 +104,7 @@ this.devCode = devCode; } - @Column(name = "ASSET_NAME") + @Column(name = "ASSETNAME") public String getAssetName() { return assetName; } @@ -96,7 +113,7 @@ this.assetName = assetName; } - @Column(name = "ASSET_CODE") + @Column(name = "ASSETCODE") public String getAssetCode() { return assetCode; } @@ -105,7 +122,7 @@ this.assetCode = assetCode; } - @Column(name = "ASSET_BAR_CODE") + @Column(name = "ASSETBARCODE") public String getAssetBarCode() { return assetBarCode; } @@ -168,24 +185,13 @@ this.pgAlarms = pgAlarms; } - @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) - @NotFound(action = NotFoundAction.IGNORE) - @JoinColumn(name = "PGID") - public PipeGallery getPipeGalleryId() { - return pipeGalleryId; - } - - public void setPipeGalleryId(PipeGallery pipeGalleryId) { - this.pipeGalleryId = pipeGalleryId; - } - @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") - public List getPgTempHums() { - return pgTempHums; + public List getPgCh4s() { + return pgCh4s; } - public void setPgTempHums(List pgTempHums) { - this.pgTempHums = pgTempHums; + public void setPgCh4s(List pgCh4s) { + this.pgCh4s = pgCh4s; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") @@ -198,6 +204,15 @@ } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") + public List getPgLocations() { + return pgLocations; + } + + public void setPgLocations(List pgLocations) { + this.pgLocations = pgLocations; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") public List getPgO2s() { return pgO2s; } @@ -207,15 +222,6 @@ } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") - public List getPgCh4s() { - return pgCh4s; - } - - public void setPgCh4s(List pgCh4s) { - this.pgCh4s = pgCh4s; - } - - @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") public List getPgShs() { return pgShs; } @@ -225,12 +231,11 @@ } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") - public List getPgAlarmRules() { - return pgAlarmRules; + public List getPgTempHums() { + return pgTempHums; } - public void setPgAlarmRules(List pgAlarmRules) { - this.pgAlarmRules = pgAlarmRules; + public void setPgTempHums(List pgTempHums) { + this.pgTempHums = pgTempHums; } - } diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java index 650d623..8e6e785 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java @@ -22,7 +22,6 @@ private PgPartition pgPartitionId;// private List pgTextureList; private List pgPipeLineList; - private List pgDeviceList; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PIPE_GALLERY_ID") @@ -81,13 +80,5 @@ this.pgPipeLineList = pgPipeLineList; } - @OneToMany(fetch = FetchType.LAZY, mappedBy = "pipeGalleryId") - public List getPgDeviceList() { - return pgDeviceList; - } - - public void setPgDeviceList(List pgDeviceList) { - this.pgDeviceList = pgDeviceList; - } } diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java index 7fb5953..eb1f7ab 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java @@ -1,16 +1,13 @@ package com.casic.PgInterface.devTable.domain; import com.casic.PgInterface.devData.domain.*; -import com.casic.PgInterface.patroler.domain.PgAlarmRule; -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.List; /** - * Created by yxw on 2017/10/30. + * Created by yxw on 2017/12/29. */ @Entity @Table(name = "PG_DEVICE") @@ -19,27 +16,29 @@ private static final long serialVersionUID = 1L; private long id; - private PipeGallery pipeGalleryId;//所在管廊信息 + private String partition;//分区 private String road;//路名 + private String pipeGallery;//仓位 private String position;//设备位置 private String devType;//设备类型 private String devCode;//设备编号 private String assetName;//资产名称 - private String assetCode;//资产编码 + private String assetCode;//资产名称 private String assetBarCode;//资产条码 private String ip;//IP地址 private String modBus;//modBus地址 private String mome;//备注 - private int isOpen;//设备是否开启 + private int isOpen;//设备开启状态 private int active;//状态位 private List pgAlarms; - private List pgTempHums;//温湿度 - private List pgCos;//一氧化碳 - private List pgO2s;//氧气 - private List pgCh4s;//甲烷 - private List pgShs;//硫化氢 - private List pgAlarmRules;//报警规则 + private List pgCh4s; + private List pgCos; + private List pgLocations; + private List pgO2s; + private List pgShs; + private List pgTempHums; + @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_ID") @@ -51,6 +50,15 @@ this.id = id; } + @Column(name = "PARTITION") + public String getPartition() { + return partition; + } + + public void setPartition(String partition) { + this.partition = partition; + } + @Column(name = "ROAD") public String getRoad() { return road; @@ -60,6 +68,15 @@ this.road = road; } + @Column(name = "PIPEGALLERY") + public String getPipeGallery() { + return pipeGallery; + } + + public void setPipeGallery(String pipeGallery) { + this.pipeGallery = pipeGallery; + } + @Column(name = "POSITION") public String getPosition() { return position; @@ -69,7 +86,7 @@ this.position = position; } - @Column(name = "DEV_TYPE") + @Column(name = "DEVTPYE") public String getDevType() { return devType; } @@ -78,7 +95,7 @@ this.devType = devType; } - @Column(name = "DEV_CODE") + @Column(name = "DEVCODE") public String getDevCode() { return devCode; } @@ -87,7 +104,7 @@ this.devCode = devCode; } - @Column(name = "ASSET_NAME") + @Column(name = "ASSETNAME") public String getAssetName() { return assetName; } @@ -96,7 +113,7 @@ this.assetName = assetName; } - @Column(name = "ASSET_CODE") + @Column(name = "ASSETCODE") public String getAssetCode() { return assetCode; } @@ -105,7 +122,7 @@ this.assetCode = assetCode; } - @Column(name = "ASSET_BAR_CODE") + @Column(name = "ASSETBARCODE") public String getAssetBarCode() { return assetBarCode; } @@ -168,24 +185,13 @@ this.pgAlarms = pgAlarms; } - @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) - @NotFound(action = NotFoundAction.IGNORE) - @JoinColumn(name = "PGID") - public PipeGallery getPipeGalleryId() { - return pipeGalleryId; - } - - public void setPipeGalleryId(PipeGallery pipeGalleryId) { - this.pipeGalleryId = pipeGalleryId; - } - @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") - public List getPgTempHums() { - return pgTempHums; + public List getPgCh4s() { + return pgCh4s; } - public void setPgTempHums(List pgTempHums) { - this.pgTempHums = pgTempHums; + public void setPgCh4s(List pgCh4s) { + this.pgCh4s = pgCh4s; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") @@ -198,6 +204,15 @@ } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") + public List getPgLocations() { + return pgLocations; + } + + public void setPgLocations(List pgLocations) { + this.pgLocations = pgLocations; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") public List getPgO2s() { return pgO2s; } @@ -207,15 +222,6 @@ } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") - public List getPgCh4s() { - return pgCh4s; - } - - public void setPgCh4s(List pgCh4s) { - this.pgCh4s = pgCh4s; - } - - @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") public List getPgShs() { return pgShs; } @@ -225,12 +231,11 @@ } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") - public List getPgAlarmRules() { - return pgAlarmRules; + public List getPgTempHums() { + return pgTempHums; } - public void setPgAlarmRules(List pgAlarmRules) { - this.pgAlarmRules = pgAlarmRules; + public void setPgTempHums(List pgTempHums) { + this.pgTempHums = pgTempHums; } - } diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java index 650d623..8e6e785 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java @@ -22,7 +22,6 @@ private PgPartition pgPartitionId;// private List pgTextureList; private List pgPipeLineList; - private List pgDeviceList; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PIPE_GALLERY_ID") @@ -81,13 +80,5 @@ this.pgPipeLineList = pgPipeLineList; } - @OneToMany(fetch = FetchType.LAZY, mappedBy = "pipeGalleryId") - public List getPgDeviceList() { - return pgDeviceList; - } - - public void setPgDeviceList(List pgDeviceList) { - this.pgDeviceList = pgDeviceList; - } } diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index c3dfc55..8b706f3 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -110,8 +110,7 @@ this.setAlarmDate(sdf.format(pgAlarm.getAlarmDate())); this.setDescription(pgAlarm.getDescription()); this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); - this.setAlarmLocation(pgAlarm.getAlarmDevId().getPipeGalleryId().getPgPartitionId().getParName() + - pgAlarm.getAlarmDevId().getPipeGalleryId().getPgName()); + this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setUserName(pgAlarm.getPatrolerId().getUserName()); this.setPhoneNumber(pgAlarm.getPatrolerId().getPhoneNumber()); this.setActive(String.valueOf(pgAlarm.getActive())); diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java index 7fb5953..eb1f7ab 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java @@ -1,16 +1,13 @@ package com.casic.PgInterface.devTable.domain; import com.casic.PgInterface.devData.domain.*; -import com.casic.PgInterface.patroler.domain.PgAlarmRule; -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.List; /** - * Created by yxw on 2017/10/30. + * Created by yxw on 2017/12/29. */ @Entity @Table(name = "PG_DEVICE") @@ -19,27 +16,29 @@ private static final long serialVersionUID = 1L; private long id; - private PipeGallery pipeGalleryId;//所在管廊信息 + private String partition;//分区 private String road;//路名 + private String pipeGallery;//仓位 private String position;//设备位置 private String devType;//设备类型 private String devCode;//设备编号 private String assetName;//资产名称 - private String assetCode;//资产编码 + private String assetCode;//资产名称 private String assetBarCode;//资产条码 private String ip;//IP地址 private String modBus;//modBus地址 private String mome;//备注 - private int isOpen;//设备是否开启 + private int isOpen;//设备开启状态 private int active;//状态位 private List pgAlarms; - private List pgTempHums;//温湿度 - private List pgCos;//一氧化碳 - private List pgO2s;//氧气 - private List pgCh4s;//甲烷 - private List pgShs;//硫化氢 - private List pgAlarmRules;//报警规则 + private List pgCh4s; + private List pgCos; + private List pgLocations; + private List pgO2s; + private List pgShs; + private List pgTempHums; + @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_ID") @@ -51,6 +50,15 @@ this.id = id; } + @Column(name = "PARTITION") + public String getPartition() { + return partition; + } + + public void setPartition(String partition) { + this.partition = partition; + } + @Column(name = "ROAD") public String getRoad() { return road; @@ -60,6 +68,15 @@ this.road = road; } + @Column(name = "PIPEGALLERY") + public String getPipeGallery() { + return pipeGallery; + } + + public void setPipeGallery(String pipeGallery) { + this.pipeGallery = pipeGallery; + } + @Column(name = "POSITION") public String getPosition() { return position; @@ -69,7 +86,7 @@ this.position = position; } - @Column(name = "DEV_TYPE") + @Column(name = "DEVTPYE") public String getDevType() { return devType; } @@ -78,7 +95,7 @@ this.devType = devType; } - @Column(name = "DEV_CODE") + @Column(name = "DEVCODE") public String getDevCode() { return devCode; } @@ -87,7 +104,7 @@ this.devCode = devCode; } - @Column(name = "ASSET_NAME") + @Column(name = "ASSETNAME") public String getAssetName() { return assetName; } @@ -96,7 +113,7 @@ this.assetName = assetName; } - @Column(name = "ASSET_CODE") + @Column(name = "ASSETCODE") public String getAssetCode() { return assetCode; } @@ -105,7 +122,7 @@ this.assetCode = assetCode; } - @Column(name = "ASSET_BAR_CODE") + @Column(name = "ASSETBARCODE") public String getAssetBarCode() { return assetBarCode; } @@ -168,24 +185,13 @@ this.pgAlarms = pgAlarms; } - @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) - @NotFound(action = NotFoundAction.IGNORE) - @JoinColumn(name = "PGID") - public PipeGallery getPipeGalleryId() { - return pipeGalleryId; - } - - public void setPipeGalleryId(PipeGallery pipeGalleryId) { - this.pipeGalleryId = pipeGalleryId; - } - @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") - public List getPgTempHums() { - return pgTempHums; + public List getPgCh4s() { + return pgCh4s; } - public void setPgTempHums(List pgTempHums) { - this.pgTempHums = pgTempHums; + public void setPgCh4s(List pgCh4s) { + this.pgCh4s = pgCh4s; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") @@ -198,6 +204,15 @@ } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") + public List getPgLocations() { + return pgLocations; + } + + public void setPgLocations(List pgLocations) { + this.pgLocations = pgLocations; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") public List getPgO2s() { return pgO2s; } @@ -207,15 +222,6 @@ } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") - public List getPgCh4s() { - return pgCh4s; - } - - public void setPgCh4s(List pgCh4s) { - this.pgCh4s = pgCh4s; - } - - @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") public List getPgShs() { return pgShs; } @@ -225,12 +231,11 @@ } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") - public List getPgAlarmRules() { - return pgAlarmRules; + public List getPgTempHums() { + return pgTempHums; } - public void setPgAlarmRules(List pgAlarmRules) { - this.pgAlarmRules = pgAlarmRules; + public void setPgTempHums(List pgTempHums) { + this.pgTempHums = pgTempHums; } - } diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java index 650d623..8e6e785 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java @@ -22,7 +22,6 @@ private PgPartition pgPartitionId;// private List pgTextureList; private List pgPipeLineList; - private List pgDeviceList; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PIPE_GALLERY_ID") @@ -81,13 +80,5 @@ this.pgPipeLineList = pgPipeLineList; } - @OneToMany(fetch = FetchType.LAZY, mappedBy = "pipeGalleryId") - public List getPgDeviceList() { - return pgDeviceList; - } - - public void setPgDeviceList(List pgDeviceList) { - this.pgDeviceList = pgDeviceList; - } } diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index c3dfc55..8b706f3 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -110,8 +110,7 @@ this.setAlarmDate(sdf.format(pgAlarm.getAlarmDate())); this.setDescription(pgAlarm.getDescription()); this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); - this.setAlarmLocation(pgAlarm.getAlarmDevId().getPipeGalleryId().getPgPartitionId().getParName() + - pgAlarm.getAlarmDevId().getPipeGalleryId().getPgName()); + this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setUserName(pgAlarm.getPatrolerId().getUserName()); this.setPhoneNumber(pgAlarm.getPatrolerId().getPhoneNumber()); this.setActive(String.valueOf(pgAlarm.getActive())); diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java index 49bd436..95f9fbd 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java @@ -151,8 +151,8 @@ SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgDevice.getId())); - this.setPipeGallery(pgDevice.getPipeGalleryId().getPgName()); - this.setPartition(pgDevice.getPipeGalleryId().getPgPartitionId().getParName()); + this.setPipeGallery(pgDevice.getPipeGallery()); + this.setPartition(pgDevice.getPartition()); this.setRoad(pgDevice.getRoad()); this.setPosition(pgDevice.getPosition()); this.setDevType(pgDevice.getDevType()); diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java index 7fb5953..eb1f7ab 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java @@ -1,16 +1,13 @@ package com.casic.PgInterface.devTable.domain; import com.casic.PgInterface.devData.domain.*; -import com.casic.PgInterface.patroler.domain.PgAlarmRule; -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.List; /** - * Created by yxw on 2017/10/30. + * Created by yxw on 2017/12/29. */ @Entity @Table(name = "PG_DEVICE") @@ -19,27 +16,29 @@ private static final long serialVersionUID = 1L; private long id; - private PipeGallery pipeGalleryId;//所在管廊信息 + private String partition;//分区 private String road;//路名 + private String pipeGallery;//仓位 private String position;//设备位置 private String devType;//设备类型 private String devCode;//设备编号 private String assetName;//资产名称 - private String assetCode;//资产编码 + private String assetCode;//资产名称 private String assetBarCode;//资产条码 private String ip;//IP地址 private String modBus;//modBus地址 private String mome;//备注 - private int isOpen;//设备是否开启 + private int isOpen;//设备开启状态 private int active;//状态位 private List pgAlarms; - private List pgTempHums;//温湿度 - private List pgCos;//一氧化碳 - private List pgO2s;//氧气 - private List pgCh4s;//甲烷 - private List pgShs;//硫化氢 - private List pgAlarmRules;//报警规则 + private List pgCh4s; + private List pgCos; + private List pgLocations; + private List pgO2s; + private List pgShs; + private List pgTempHums; + @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_ID") @@ -51,6 +50,15 @@ this.id = id; } + @Column(name = "PARTITION") + public String getPartition() { + return partition; + } + + public void setPartition(String partition) { + this.partition = partition; + } + @Column(name = "ROAD") public String getRoad() { return road; @@ -60,6 +68,15 @@ this.road = road; } + @Column(name = "PIPEGALLERY") + public String getPipeGallery() { + return pipeGallery; + } + + public void setPipeGallery(String pipeGallery) { + this.pipeGallery = pipeGallery; + } + @Column(name = "POSITION") public String getPosition() { return position; @@ -69,7 +86,7 @@ this.position = position; } - @Column(name = "DEV_TYPE") + @Column(name = "DEVTPYE") public String getDevType() { return devType; } @@ -78,7 +95,7 @@ this.devType = devType; } - @Column(name = "DEV_CODE") + @Column(name = "DEVCODE") public String getDevCode() { return devCode; } @@ -87,7 +104,7 @@ this.devCode = devCode; } - @Column(name = "ASSET_NAME") + @Column(name = "ASSETNAME") public String getAssetName() { return assetName; } @@ -96,7 +113,7 @@ this.assetName = assetName; } - @Column(name = "ASSET_CODE") + @Column(name = "ASSETCODE") public String getAssetCode() { return assetCode; } @@ -105,7 +122,7 @@ this.assetCode = assetCode; } - @Column(name = "ASSET_BAR_CODE") + @Column(name = "ASSETBARCODE") public String getAssetBarCode() { return assetBarCode; } @@ -168,24 +185,13 @@ this.pgAlarms = pgAlarms; } - @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) - @NotFound(action = NotFoundAction.IGNORE) - @JoinColumn(name = "PGID") - public PipeGallery getPipeGalleryId() { - return pipeGalleryId; - } - - public void setPipeGalleryId(PipeGallery pipeGalleryId) { - this.pipeGalleryId = pipeGalleryId; - } - @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") - public List getPgTempHums() { - return pgTempHums; + public List getPgCh4s() { + return pgCh4s; } - public void setPgTempHums(List pgTempHums) { - this.pgTempHums = pgTempHums; + public void setPgCh4s(List pgCh4s) { + this.pgCh4s = pgCh4s; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") @@ -198,6 +204,15 @@ } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") + public List getPgLocations() { + return pgLocations; + } + + public void setPgLocations(List pgLocations) { + this.pgLocations = pgLocations; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") public List getPgO2s() { return pgO2s; } @@ -207,15 +222,6 @@ } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") - public List getPgCh4s() { - return pgCh4s; - } - - public void setPgCh4s(List pgCh4s) { - this.pgCh4s = pgCh4s; - } - - @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") public List getPgShs() { return pgShs; } @@ -225,12 +231,11 @@ } @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId") - public List getPgAlarmRules() { - return pgAlarmRules; + public List getPgTempHums() { + return pgTempHums; } - public void setPgAlarmRules(List pgAlarmRules) { - this.pgAlarmRules = pgAlarmRules; + public void setPgTempHums(List pgTempHums) { + this.pgTempHums = pgTempHums; } - } diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java index 650d623..8e6e785 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java @@ -22,7 +22,6 @@ private PgPartition pgPartitionId;// private List pgTextureList; private List pgPipeLineList; - private List pgDeviceList; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PIPE_GALLERY_ID") @@ -81,13 +80,5 @@ this.pgPipeLineList = pgPipeLineList; } - @OneToMany(fetch = FetchType.LAZY, mappedBy = "pipeGalleryId") - public List getPgDeviceList() { - return pgDeviceList; - } - - public void setPgDeviceList(List pgDeviceList) { - this.pgDeviceList = pgDeviceList; - } } diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index c3dfc55..8b706f3 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -110,8 +110,7 @@ this.setAlarmDate(sdf.format(pgAlarm.getAlarmDate())); this.setDescription(pgAlarm.getDescription()); this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); - this.setAlarmLocation(pgAlarm.getAlarmDevId().getPipeGalleryId().getPgPartitionId().getParName() + - pgAlarm.getAlarmDevId().getPipeGalleryId().getPgName()); + this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setUserName(pgAlarm.getPatrolerId().getUserName()); this.setPhoneNumber(pgAlarm.getPatrolerId().getPhoneNumber()); this.setActive(String.valueOf(pgAlarm.getActive())); diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java index 49bd436..95f9fbd 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java @@ -151,8 +151,8 @@ SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgDevice.getId())); - this.setPipeGallery(pgDevice.getPipeGalleryId().getPgName()); - this.setPartition(pgDevice.getPipeGalleryId().getPgPartitionId().getParName()); + this.setPipeGallery(pgDevice.getPipeGallery()); + this.setPartition(pgDevice.getPartition()); this.setRoad(pgDevice.getRoad()); this.setPosition(pgDevice.getPosition()); this.setDevType(pgDevice.getDevType()); diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java index 4f77754..bb8c245 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java @@ -1,11 +1,8 @@ package com.casic.PgInterface.rs; import com.casic.PgInterface.devTable.domain.PgDevice; -import com.casic.PgInterface.devTable.domain.PgPartition; -import com.casic.PgInterface.devTable.domain.PipeGallery; import com.casic.PgInterface.devTable.dto.PgDeviceDto; import com.casic.PgInterface.devTable.manager.PgDeviceManager; -import com.casic.PgInterface.devTable.manager.PgDeviceTypeManager; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import com.casic.PgInterface.devTable.manager.PipeGalleryManager; import org.slf4j.Logger; @@ -34,8 +31,6 @@ private PgDeviceManager pgDeviceManager; - private PgDeviceTypeManager pgDeviceTypeManager; - private PgPartitionManager pgPartitionManager; private PipeGalleryManager pipeGalleryManager; @@ -55,11 +50,6 @@ this.pipeGalleryManager = pipeGalleryManager; } - @Resource - public void setPgDeviceTypeManager(PgDeviceTypeManager pgDeviceTypeManager) { - this.pgDeviceTypeManager = pgDeviceTypeManager; - } - /** * 获取设备信息 */ @@ -132,45 +122,39 @@ String result = ""; String msg = ""; - PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); - PipeGallery pipeGallery = pipeGalleryManager.getPipeGalleryByPgName(pgName,pgPartition); - - if (pgPartition == null) { - result = "false"; - msg = "不存在管廊仓和分区信息"; - } else { - try { - if (pgDeviceManager.getDeviceByAssetCode(assetCode)!=null) { - result = "false"; - msg = "已存在同名设备"; - } else { - PgDevice pgDevice = new PgDevice(); - - pgDevice.setPipeGalleryId(pipeGallery); - pgDevice.setRoad(road); - pgDevice.setPosition(position); - pgDevice.setDevType(devType); - pgDevice.setDevCode(devCode); - pgDevice.setAssetName(assetName); - pgDevice.setAssetCode(assetCode); - pgDevice.setAssetBarCode(assetBarCode); - pgDevice.setIp(ip); - pgDevice.setModBus(modBus); - pgDevice.setMome(mome); - pgDevice.setIsOpen(0); - pgDevice.setActive(1); - - pgDeviceManager.save(pgDevice); - result = "true"; - msg = "保存成功"; - } - - } catch (Exception e) { + try { + if (pgDeviceManager.getDeviceByAssetCode(assetCode)!=null) { result = "false"; - msg = "保存失败"; - e.printStackTrace(); + msg = "已存在同名设备"; + } else { + PgDevice pgDevice = new PgDevice(); + + pgDevice.setPipeGallery(pgName); + pgDevice.setPartition(parName); + pgDevice.setRoad(road); + pgDevice.setPosition(position); + pgDevice.setDevType(devType); + pgDevice.setDevCode(devCode); + pgDevice.setAssetName(assetName); + pgDevice.setAssetCode(assetCode); + pgDevice.setAssetBarCode(assetBarCode); + pgDevice.setIp(ip); + pgDevice.setModBus(modBus); + pgDevice.setMome(mome); + pgDevice.setIsOpen(0); + pgDevice.setActive(1); + + pgDeviceManager.save(pgDevice); + result = "true"; + msg = "保存成功"; } + + } catch (Exception e) { + result = "false"; + msg = "保存失败"; + e.printStackTrace(); } + resultMap.put("success", result); resultMap.put("msg", msg); @@ -202,42 +186,35 @@ String result = ""; String msg = ""; - PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); - PipeGallery pipeGallery = pipeGalleryManager.getPipeGalleryByPgName(pgName,pgPartition); - - if (pgPartition == null) { - result = "false"; - msg = "不存在管廊仓和分区信息"; - } else { - try { - if (pgDeviceManager.getDeviceByAssetCode(assetCode)!=null) { - result = "false"; - msg = "已存在同名设备"; - } else { - PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id)); - pgDevice.setPipeGalleryId(pipeGallery); - pgDevice.setRoad(road); - pgDevice.setPosition(position); - pgDevice.setDevType(devType); - pgDevice.setDevCode(devCode); - pgDevice.setAssetName(assetName); - pgDevice.setAssetCode(assetCode); - pgDevice.setAssetBarCode(assetBarCode); - pgDevice.setIp(ip); - pgDevice.setModBus(modBus); - pgDevice.setMome(mome); - pgDevice.setActive(1); - pgDevice.setIsOpen(Integer.valueOf(isOpen)); - - pgDeviceManager.save(pgDevice); - result = "true"; - msg = "编辑成功"; - } - } catch (Exception e) { + try { + if (pgDeviceManager.getDeviceByAssetCode(assetCode)!=null) { result = "false"; - msg = "编辑失败"; - e.printStackTrace(); + msg = "已存在同名设备"; + } else { + PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id)); + pgDevice.setPipeGallery(pgName); + pgDevice.setPartition(parName); + pgDevice.setRoad(road); + pgDevice.setPosition(position); + pgDevice.setDevType(devType); + pgDevice.setDevCode(devCode); + pgDevice.setAssetName(assetName); + pgDevice.setAssetCode(assetCode); + pgDevice.setAssetBarCode(assetBarCode); + pgDevice.setIp(ip); + pgDevice.setModBus(modBus); + pgDevice.setMome(mome); + pgDevice.setActive(1); + pgDevice.setIsOpen(Integer.valueOf(isOpen)); + + pgDeviceManager.save(pgDevice); + result = "true"; + msg = "编辑成功"; } + } catch (Exception e) { + result = "false"; + msg = "编辑失败"; + e.printStackTrace(); } resultMap.put("result",result);