diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml deleted file mode 100644 index b8260a5..0000000 --- a/.idea/artifacts/PgInterface.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - $PROJECT_DIR$/../out/artifacts/PgInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml deleted file mode 100644 index b8260a5..0000000 --- a/.idea/artifacts/PgInterface.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - $PROJECT_DIR$/../out/artifacts/PgInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java index 7740d20..a5c9721 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java @@ -1,6 +1,6 @@ package com.casic.PgInterface.overtimeInPG.domain; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +//import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.persistence.*; import java.io.Serializable; diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml deleted file mode 100644 index b8260a5..0000000 --- a/.idea/artifacts/PgInterface.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - $PROJECT_DIR$/../out/artifacts/PgInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java index 7740d20..a5c9721 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java @@ -1,6 +1,6 @@ package com.casic.PgInterface.overtimeInPG.domain; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +//import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java index 270703a..ef4da0d 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java @@ -12,8 +12,25 @@ // public String TagId; // public String CoordinatesId; public String coordinatesName; - public String X; - public String Y; + + public String getX() { + return x; + } + + public void setX(String x) { + this.x = x; + } + + public String getY() { + return y; + } + + public void setY(String y) { + this.y = y; + } + + public String x; + public String y; public String positionUpdateTime; public String getTagMac() { @@ -56,21 +73,7 @@ this.coordinatesName = coordinatesName; } - public String getX() { - return X; - } - public void setX(String x) { - X = x; - } - - public String getY() { - return Y; - } - - public void setY(String y) { - Y = y; - } public String getPositionUpdateTime() { return positionUpdateTime; @@ -81,6 +84,16 @@ } + public PGPositionDto(PGTagPosition pgTagPosition) + { + this.setX(pgTagPosition.getX()); + this.setY(pgTagPosition.getY()); + this.setTagName(pgTagPosition.getTagName()); + this.setTagMac(pgTagPosition.getTagMac()); + this.setCoordinatesName(pgTagPosition.getCoordinatesName()); + this.setHostId(pgTagPosition.getHostId()); + this.setHostName(pgTagPosition.getHostName()); + } @Override public String toString() { @@ -90,8 +103,8 @@ ", hostId='" + hostId + '\'' + ", hostName='" + hostName + '\'' + ", coordinatesName='" + coordinatesName + '\'' + - ", X='" + X + '\'' + - ", Y='" + Y + '\'' + + ", X='" + x + '\'' + + ", Y='" + y + '\'' + ", postionUpdateTime='" + positionUpdateTime + '\'' + '}'; } diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml deleted file mode 100644 index b8260a5..0000000 --- a/.idea/artifacts/PgInterface.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - $PROJECT_DIR$/../out/artifacts/PgInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java index 7740d20..a5c9721 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java @@ -1,6 +1,6 @@ package com.casic.PgInterface.overtimeInPG.domain; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +//import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java index 270703a..ef4da0d 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java @@ -12,8 +12,25 @@ // public String TagId; // public String CoordinatesId; public String coordinatesName; - public String X; - public String Y; + + public String getX() { + return x; + } + + public void setX(String x) { + this.x = x; + } + + public String getY() { + return y; + } + + public void setY(String y) { + this.y = y; + } + + public String x; + public String y; public String positionUpdateTime; public String getTagMac() { @@ -56,21 +73,7 @@ this.coordinatesName = coordinatesName; } - public String getX() { - return X; - } - public void setX(String x) { - X = x; - } - - public String getY() { - return Y; - } - - public void setY(String y) { - Y = y; - } public String getPositionUpdateTime() { return positionUpdateTime; @@ -81,6 +84,16 @@ } + public PGPositionDto(PGTagPosition pgTagPosition) + { + this.setX(pgTagPosition.getX()); + this.setY(pgTagPosition.getY()); + this.setTagName(pgTagPosition.getTagName()); + this.setTagMac(pgTagPosition.getTagMac()); + this.setCoordinatesName(pgTagPosition.getCoordinatesName()); + this.setHostId(pgTagPosition.getHostId()); + this.setHostName(pgTagPosition.getHostName()); + } @Override public String toString() { @@ -90,8 +103,8 @@ ", hostId='" + hostId + '\'' + ", hostName='" + hostName + '\'' + ", coordinatesName='" + coordinatesName + '\'' + - ", X='" + X + '\'' + - ", Y='" + Y + '\'' + + ", X='" + x + '\'' + + ", Y='" + y + '\'' + ", postionUpdateTime='" + positionUpdateTime + '\'' + '}'; } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java index a7eea2c..6736304 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java @@ -2,6 +2,7 @@ import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; @JsonIgnoreProperties(ignoreUnknown = true) public class PGTagPositionDto { @@ -14,7 +15,22 @@ public String CoordinatesName; public String X; public String Y; - public String postionUpdateTime; + + public String getHostName() { + return HostName; + } + + public void setHostName(String hostName) { + HostName = hostName; + } + + public String getTagId() { + return TagId; + } + + public void setTagId(String tagId) { + TagId = tagId; + } public String getCoordinatesId() { return CoordinatesId; @@ -52,9 +68,8 @@ return postionUpdateTime; } - public void setPostionUpdateTime(String postionUpdateTime) { - this.postionUpdateTime = postionUpdateTime; - } + public String postionUpdateTime; + /* {"Success":true,"ErrorCode":0,"ErrorText":"","TagId":11003,"TagMac":"B0:8E:1A:50:54:88", @@ -65,19 +80,9 @@ "HostId":96,"HostGroupIds":[1,9],"HostStatusId":0,"HostExternalId":"5488","HostExternalInfo":"", "postionUpdateTime":"2019-05-22T11:09:31.9387103+08:00"} */ - - public String getTagId() { - return TagId; - } - - public void setTagId(String tagId) { - TagId = tagId; - } - public String getTagMac() { - return TagMac; - } - + return TagMac; +} public void setTagMac(String tagMac) { TagMac = tagMac; } @@ -85,10 +90,11 @@ public String getTagName() { return TagName; } - +// @JsonProperty(value ="tagName") public void setTagName(String tagName) { TagName = tagName; } + public String getHostId() { return HostId; } @@ -97,24 +103,20 @@ HostId = hostId; } - public String getHostName() { - return HostName; + + + public void setPostionUpdateTime(String postionUpdateTime) { + this.postionUpdateTime = postionUpdateTime; } - public void setHostName(String hostName) { - HostName = hostName; - } - - public PGTagPositionDto(PGTagPosition pgTagPosition){ + public PGTagPositionDto(PGTagPosition pgTagPosition) + { this.setHostId(pgTagPosition.getHostId()); - this.setCoordinatesName(pgTagPosition.getCoordinatesName()); - this.setHostName(pgTagPosition.getHostName()); this.setTagMac(pgTagPosition.getTagMac()); this.setTagName(pgTagPosition.getTagName()); - this.setX(pgTagPosition.getX()); - this.setY(pgTagPosition.getY()); } + @Override public String toString() { return "PGTagPositionDto{" + diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml deleted file mode 100644 index b8260a5..0000000 --- a/.idea/artifacts/PgInterface.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - $PROJECT_DIR$/../out/artifacts/PgInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java index 7740d20..a5c9721 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java @@ -1,6 +1,6 @@ package com.casic.PgInterface.overtimeInPG.domain; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +//import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java index 270703a..ef4da0d 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java @@ -12,8 +12,25 @@ // public String TagId; // public String CoordinatesId; public String coordinatesName; - public String X; - public String Y; + + public String getX() { + return x; + } + + public void setX(String x) { + this.x = x; + } + + public String getY() { + return y; + } + + public void setY(String y) { + this.y = y; + } + + public String x; + public String y; public String positionUpdateTime; public String getTagMac() { @@ -56,21 +73,7 @@ this.coordinatesName = coordinatesName; } - public String getX() { - return X; - } - public void setX(String x) { - X = x; - } - - public String getY() { - return Y; - } - - public void setY(String y) { - Y = y; - } public String getPositionUpdateTime() { return positionUpdateTime; @@ -81,6 +84,16 @@ } + public PGPositionDto(PGTagPosition pgTagPosition) + { + this.setX(pgTagPosition.getX()); + this.setY(pgTagPosition.getY()); + this.setTagName(pgTagPosition.getTagName()); + this.setTagMac(pgTagPosition.getTagMac()); + this.setCoordinatesName(pgTagPosition.getCoordinatesName()); + this.setHostId(pgTagPosition.getHostId()); + this.setHostName(pgTagPosition.getHostName()); + } @Override public String toString() { @@ -90,8 +103,8 @@ ", hostId='" + hostId + '\'' + ", hostName='" + hostName + '\'' + ", coordinatesName='" + coordinatesName + '\'' + - ", X='" + X + '\'' + - ", Y='" + Y + '\'' + + ", X='" + x + '\'' + + ", Y='" + y + '\'' + ", postionUpdateTime='" + positionUpdateTime + '\'' + '}'; } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java index a7eea2c..6736304 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java @@ -2,6 +2,7 @@ import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; @JsonIgnoreProperties(ignoreUnknown = true) public class PGTagPositionDto { @@ -14,7 +15,22 @@ public String CoordinatesName; public String X; public String Y; - public String postionUpdateTime; + + public String getHostName() { + return HostName; + } + + public void setHostName(String hostName) { + HostName = hostName; + } + + public String getTagId() { + return TagId; + } + + public void setTagId(String tagId) { + TagId = tagId; + } public String getCoordinatesId() { return CoordinatesId; @@ -52,9 +68,8 @@ return postionUpdateTime; } - public void setPostionUpdateTime(String postionUpdateTime) { - this.postionUpdateTime = postionUpdateTime; - } + public String postionUpdateTime; + /* {"Success":true,"ErrorCode":0,"ErrorText":"","TagId":11003,"TagMac":"B0:8E:1A:50:54:88", @@ -65,19 +80,9 @@ "HostId":96,"HostGroupIds":[1,9],"HostStatusId":0,"HostExternalId":"5488","HostExternalInfo":"", "postionUpdateTime":"2019-05-22T11:09:31.9387103+08:00"} */ - - public String getTagId() { - return TagId; - } - - public void setTagId(String tagId) { - TagId = tagId; - } - public String getTagMac() { - return TagMac; - } - + return TagMac; +} public void setTagMac(String tagMac) { TagMac = tagMac; } @@ -85,10 +90,11 @@ public String getTagName() { return TagName; } - +// @JsonProperty(value ="tagName") public void setTagName(String tagName) { TagName = tagName; } + public String getHostId() { return HostId; } @@ -97,24 +103,20 @@ HostId = hostId; } - public String getHostName() { - return HostName; + + + public void setPostionUpdateTime(String postionUpdateTime) { + this.postionUpdateTime = postionUpdateTime; } - public void setHostName(String hostName) { - HostName = hostName; - } - - public PGTagPositionDto(PGTagPosition pgTagPosition){ + public PGTagPositionDto(PGTagPosition pgTagPosition) + { this.setHostId(pgTagPosition.getHostId()); - this.setCoordinatesName(pgTagPosition.getCoordinatesName()); - this.setHostName(pgTagPosition.getHostName()); this.setTagMac(pgTagPosition.getTagMac()); this.setTagName(pgTagPosition.getTagName()); - this.setX(pgTagPosition.getX()); - this.setY(pgTagPosition.getY()); } + @Override public String toString() { return "PGTagPositionDto{" + diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java index 3bd4025..af85d31 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java @@ -13,6 +13,7 @@ import javax.persistence.ParameterMode; import javax.persistence.criteria.CriteriaBuilder; +import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,10 +41,10 @@ return retMap; } - public int getMaxId(String tagMac) + public long getMaxId(String tagMac) { String hSql = "select max(id) from pg_tagposition where tagmac = '"+tagMac+"'"; - return ((Integer)this.getSession().createSQLQuery(hSql).uniqueResult()).intValue(); + return ((BigDecimal)this.getSession().createSQLQuery(hSql).uniqueResult()).longValue(); } } diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml deleted file mode 100644 index b8260a5..0000000 --- a/.idea/artifacts/PgInterface.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - $PROJECT_DIR$/../out/artifacts/PgInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java index 7740d20..a5c9721 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java @@ -1,6 +1,6 @@ package com.casic.PgInterface.overtimeInPG.domain; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +//import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java index 270703a..ef4da0d 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java @@ -12,8 +12,25 @@ // public String TagId; // public String CoordinatesId; public String coordinatesName; - public String X; - public String Y; + + public String getX() { + return x; + } + + public void setX(String x) { + this.x = x; + } + + public String getY() { + return y; + } + + public void setY(String y) { + this.y = y; + } + + public String x; + public String y; public String positionUpdateTime; public String getTagMac() { @@ -56,21 +73,7 @@ this.coordinatesName = coordinatesName; } - public String getX() { - return X; - } - public void setX(String x) { - X = x; - } - - public String getY() { - return Y; - } - - public void setY(String y) { - Y = y; - } public String getPositionUpdateTime() { return positionUpdateTime; @@ -81,6 +84,16 @@ } + public PGPositionDto(PGTagPosition pgTagPosition) + { + this.setX(pgTagPosition.getX()); + this.setY(pgTagPosition.getY()); + this.setTagName(pgTagPosition.getTagName()); + this.setTagMac(pgTagPosition.getTagMac()); + this.setCoordinatesName(pgTagPosition.getCoordinatesName()); + this.setHostId(pgTagPosition.getHostId()); + this.setHostName(pgTagPosition.getHostName()); + } @Override public String toString() { @@ -90,8 +103,8 @@ ", hostId='" + hostId + '\'' + ", hostName='" + hostName + '\'' + ", coordinatesName='" + coordinatesName + '\'' + - ", X='" + X + '\'' + - ", Y='" + Y + '\'' + + ", X='" + x + '\'' + + ", Y='" + y + '\'' + ", postionUpdateTime='" + positionUpdateTime + '\'' + '}'; } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java index a7eea2c..6736304 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java @@ -2,6 +2,7 @@ import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; @JsonIgnoreProperties(ignoreUnknown = true) public class PGTagPositionDto { @@ -14,7 +15,22 @@ public String CoordinatesName; public String X; public String Y; - public String postionUpdateTime; + + public String getHostName() { + return HostName; + } + + public void setHostName(String hostName) { + HostName = hostName; + } + + public String getTagId() { + return TagId; + } + + public void setTagId(String tagId) { + TagId = tagId; + } public String getCoordinatesId() { return CoordinatesId; @@ -52,9 +68,8 @@ return postionUpdateTime; } - public void setPostionUpdateTime(String postionUpdateTime) { - this.postionUpdateTime = postionUpdateTime; - } + public String postionUpdateTime; + /* {"Success":true,"ErrorCode":0,"ErrorText":"","TagId":11003,"TagMac":"B0:8E:1A:50:54:88", @@ -65,19 +80,9 @@ "HostId":96,"HostGroupIds":[1,9],"HostStatusId":0,"HostExternalId":"5488","HostExternalInfo":"", "postionUpdateTime":"2019-05-22T11:09:31.9387103+08:00"} */ - - public String getTagId() { - return TagId; - } - - public void setTagId(String tagId) { - TagId = tagId; - } - public String getTagMac() { - return TagMac; - } - + return TagMac; +} public void setTagMac(String tagMac) { TagMac = tagMac; } @@ -85,10 +90,11 @@ public String getTagName() { return TagName; } - +// @JsonProperty(value ="tagName") public void setTagName(String tagName) { TagName = tagName; } + public String getHostId() { return HostId; } @@ -97,24 +103,20 @@ HostId = hostId; } - public String getHostName() { - return HostName; + + + public void setPostionUpdateTime(String postionUpdateTime) { + this.postionUpdateTime = postionUpdateTime; } - public void setHostName(String hostName) { - HostName = hostName; - } - - public PGTagPositionDto(PGTagPosition pgTagPosition){ + public PGTagPositionDto(PGTagPosition pgTagPosition) + { this.setHostId(pgTagPosition.getHostId()); - this.setCoordinatesName(pgTagPosition.getCoordinatesName()); - this.setHostName(pgTagPosition.getHostName()); this.setTagMac(pgTagPosition.getTagMac()); this.setTagName(pgTagPosition.getTagName()); - this.setX(pgTagPosition.getX()); - this.setY(pgTagPosition.getY()); } + @Override public String toString() { return "PGTagPositionDto{" + diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java index 3bd4025..af85d31 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java @@ -13,6 +13,7 @@ import javax.persistence.ParameterMode; import javax.persistence.criteria.CriteriaBuilder; +import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,10 +41,10 @@ return retMap; } - public int getMaxId(String tagMac) + public long getMaxId(String tagMac) { String hSql = "select max(id) from pg_tagposition where tagmac = '"+tagMac+"'"; - return ((Integer)this.getSession().createSQLQuery(hSql).uniqueResult()).intValue(); + return ((BigDecimal)this.getSession().createSQLQuery(hSql).uniqueResult()).longValue(); } } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java b/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java index a316bd0..d36e76b 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java @@ -24,8 +24,8 @@ } public void getAllMac(){ tagmacRun.getAllMac(); - }; - public void getMacPosition() throws ParseException {tagmacRun.getMacPosition();}; + } + public void getMacPosition() throws ParseException {tagmacRun.getMacPosition();} public static void main(String[] args) { } } diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml deleted file mode 100644 index b8260a5..0000000 --- a/.idea/artifacts/PgInterface.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - $PROJECT_DIR$/../out/artifacts/PgInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java index 7740d20..a5c9721 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java @@ -1,6 +1,6 @@ package com.casic.PgInterface.overtimeInPG.domain; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +//import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java index 270703a..ef4da0d 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java @@ -12,8 +12,25 @@ // public String TagId; // public String CoordinatesId; public String coordinatesName; - public String X; - public String Y; + + public String getX() { + return x; + } + + public void setX(String x) { + this.x = x; + } + + public String getY() { + return y; + } + + public void setY(String y) { + this.y = y; + } + + public String x; + public String y; public String positionUpdateTime; public String getTagMac() { @@ -56,21 +73,7 @@ this.coordinatesName = coordinatesName; } - public String getX() { - return X; - } - public void setX(String x) { - X = x; - } - - public String getY() { - return Y; - } - - public void setY(String y) { - Y = y; - } public String getPositionUpdateTime() { return positionUpdateTime; @@ -81,6 +84,16 @@ } + public PGPositionDto(PGTagPosition pgTagPosition) + { + this.setX(pgTagPosition.getX()); + this.setY(pgTagPosition.getY()); + this.setTagName(pgTagPosition.getTagName()); + this.setTagMac(pgTagPosition.getTagMac()); + this.setCoordinatesName(pgTagPosition.getCoordinatesName()); + this.setHostId(pgTagPosition.getHostId()); + this.setHostName(pgTagPosition.getHostName()); + } @Override public String toString() { @@ -90,8 +103,8 @@ ", hostId='" + hostId + '\'' + ", hostName='" + hostName + '\'' + ", coordinatesName='" + coordinatesName + '\'' + - ", X='" + X + '\'' + - ", Y='" + Y + '\'' + + ", X='" + x + '\'' + + ", Y='" + y + '\'' + ", postionUpdateTime='" + positionUpdateTime + '\'' + '}'; } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java index a7eea2c..6736304 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java @@ -2,6 +2,7 @@ import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; @JsonIgnoreProperties(ignoreUnknown = true) public class PGTagPositionDto { @@ -14,7 +15,22 @@ public String CoordinatesName; public String X; public String Y; - public String postionUpdateTime; + + public String getHostName() { + return HostName; + } + + public void setHostName(String hostName) { + HostName = hostName; + } + + public String getTagId() { + return TagId; + } + + public void setTagId(String tagId) { + TagId = tagId; + } public String getCoordinatesId() { return CoordinatesId; @@ -52,9 +68,8 @@ return postionUpdateTime; } - public void setPostionUpdateTime(String postionUpdateTime) { - this.postionUpdateTime = postionUpdateTime; - } + public String postionUpdateTime; + /* {"Success":true,"ErrorCode":0,"ErrorText":"","TagId":11003,"TagMac":"B0:8E:1A:50:54:88", @@ -65,19 +80,9 @@ "HostId":96,"HostGroupIds":[1,9],"HostStatusId":0,"HostExternalId":"5488","HostExternalInfo":"", "postionUpdateTime":"2019-05-22T11:09:31.9387103+08:00"} */ - - public String getTagId() { - return TagId; - } - - public void setTagId(String tagId) { - TagId = tagId; - } - public String getTagMac() { - return TagMac; - } - + return TagMac; +} public void setTagMac(String tagMac) { TagMac = tagMac; } @@ -85,10 +90,11 @@ public String getTagName() { return TagName; } - +// @JsonProperty(value ="tagName") public void setTagName(String tagName) { TagName = tagName; } + public String getHostId() { return HostId; } @@ -97,24 +103,20 @@ HostId = hostId; } - public String getHostName() { - return HostName; + + + public void setPostionUpdateTime(String postionUpdateTime) { + this.postionUpdateTime = postionUpdateTime; } - public void setHostName(String hostName) { - HostName = hostName; - } - - public PGTagPositionDto(PGTagPosition pgTagPosition){ + public PGTagPositionDto(PGTagPosition pgTagPosition) + { this.setHostId(pgTagPosition.getHostId()); - this.setCoordinatesName(pgTagPosition.getCoordinatesName()); - this.setHostName(pgTagPosition.getHostName()); this.setTagMac(pgTagPosition.getTagMac()); this.setTagName(pgTagPosition.getTagName()); - this.setX(pgTagPosition.getX()); - this.setY(pgTagPosition.getY()); } + @Override public String toString() { return "PGTagPositionDto{" + diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java index 3bd4025..af85d31 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java @@ -13,6 +13,7 @@ import javax.persistence.ParameterMode; import javax.persistence.criteria.CriteriaBuilder; +import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,10 +41,10 @@ return retMap; } - public int getMaxId(String tagMac) + public long getMaxId(String tagMac) { String hSql = "select max(id) from pg_tagposition where tagmac = '"+tagMac+"'"; - return ((Integer)this.getSession().createSQLQuery(hSql).uniqueResult()).intValue(); + return ((BigDecimal)this.getSession().createSQLQuery(hSql).uniqueResult()).longValue(); } } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java b/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java index a316bd0..d36e76b 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java @@ -24,8 +24,8 @@ } public void getAllMac(){ tagmacRun.getAllMac(); - }; - public void getMacPosition() throws ParseException {tagmacRun.getMacPosition();}; + } + public void getMacPosition() throws ParseException {tagmacRun.getMacPosition();} public static void main(String[] args) { } } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java b/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java index 74f636b..11d3878 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java @@ -1,63 +1,82 @@ -package com.casic.PgInterface.overtimeInPG.web; - - -import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; -import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; -import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; -import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; -import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; -import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; -import com.casic.PgInterface.patroler.domain.PgInPgPerson; -import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.Map; - -@Controller -@RequestMapping("rs") -//@RequestMapping("InOutPGrec") -public class PGInOutRecController { -@Resource -private PGInOutRecManager pgInOutRecManager; -@Resource -private PGTagPositionManager pgTagPositionManager; -@Resource -private PgInPgPersonManager pgInPgPersonManager; -@Resource -private PGTagMacManager pgTagMacManager; - - @RequestMapping("query") - @ResponseBody - public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom,@RequestParam(value = "dtTo", required = true) String dtTo) - { - Map resultMap = new HashMap<>(); - resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); - return resultMap; - } - - @RequestMapping("getRecentPosition") - @ResponseBody - public Map getRecentPosition(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) - { - Map resultMap = new HashMap<>(); - PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); - PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("ASSETCODE",pgInPgPerson.getAssetCode()); - PGTagPosition pgTagPosition = pgTagPositionManager.get(pgTagPositionManager.getMaxId(pgTagMac.getTagMac())); - resultMap.put("msg","success"); - resultMap.put("result",new PGTagPositionDto(pgTagPosition)); - return resultMap; - } - - @RequestMapping("getHistoryByTagmac") - @ResponseBody - public Map getHistoryByTagmac() - { - Map resultMap = new HashMap<>(); - return resultMap; - } -} +//package com.casic.PgInterface.overtimeInPG.web; +// +// +//import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; +//import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; +//import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDBDto; +//import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; +//import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; +//import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; +//import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; +//import com.casic.PgInterface.patroler.domain.PgInPgPerson; +//import com.casic.PgInterface.patroler.domain.PgInPgStatus; +//import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; +//import com.casic.PgInterface.patroler.manager.PgInPgStatusManager; +//import org.springframework.stereotype.Controller; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RequestParam; +//import org.springframework.web.bind.annotation.ResponseBody; +// +//import javax.annotation.Resource; +//import javax.ws.rs.POST; +//import javax.ws.rs.Path; +//import javax.ws.rs.Produces; +//import javax.ws.rs.core.MediaType; +//import java.util.*; +// +//@Controller +//@RequestMapping("rs") +////@RequestMapping("InOutPGrec") +//public class PGInOutRecController { +//@Resource +//private PGInOutRecManager pgInOutRecManager; +//@Resource +//private PGTagPositionManager pgTagPositionManager; +//@Resource +//private PgInPgPersonManager pgInPgPersonManager; +//@Resource +//private PGTagMacManager pgTagMacManager; +//@Resource +//private PgInPgStatusManager pgInPgStatusManager; +// +// @POST +// @Path("query") +// @Produces(MediaType.APPLICATION_JSON) +// public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom,@RequestParam(value = "dtTo", required = true) String dtTo) +// { +// Map resultMap = new HashMap<>(); +// resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); +// return resultMap; +// } +// +//// @RequestMapping("getRecentPosition") +//// @ResponseBody +// @POST +// @Path("getRecentPosition") +// @Produces(MediaType.APPLICATION_JSON) +// public Map getRecentPosition(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) +// { +// Map resultMap = new HashMap<>(); +// PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); +// PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("tagMac",pgInPgPerson.getAssetCode()); +// long maxId = pgTagPositionManager.getMaxId(pgTagMac.getTagMac()); +// PGTagPosition pgTagPosition = pgTagPositionManager.get(maxId); +// resultMap.put("msg","success"); +// resultMap.put("result",pgTagPosition); +//// resultMap.put("result",new PGTagPositionDBDto(pgTagPosition)); +// return resultMap; +// } +// +// @RequestMapping("getHistoryByTagmac") +// @ResponseBody +// public Map getHistoryByTagmac(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) +// { +// Map resultMap = new HashMap<>(); +//// PgInPgStatus pgInPgStatus = pgInPgStatusManager.findUniqueBy("PGINPGPERSONID",inPgPersonId); +//// PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); +//// PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("ASSETCODE",pgInPgPerson.getAssetCode()); +// +// return resultMap; +// +// } +//} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml deleted file mode 100644 index b8260a5..0000000 --- a/.idea/artifacts/PgInterface.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - $PROJECT_DIR$/../out/artifacts/PgInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java index 7740d20..a5c9721 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java @@ -1,6 +1,6 @@ package com.casic.PgInterface.overtimeInPG.domain; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +//import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java index 270703a..ef4da0d 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java @@ -12,8 +12,25 @@ // public String TagId; // public String CoordinatesId; public String coordinatesName; - public String X; - public String Y; + + public String getX() { + return x; + } + + public void setX(String x) { + this.x = x; + } + + public String getY() { + return y; + } + + public void setY(String y) { + this.y = y; + } + + public String x; + public String y; public String positionUpdateTime; public String getTagMac() { @@ -56,21 +73,7 @@ this.coordinatesName = coordinatesName; } - public String getX() { - return X; - } - public void setX(String x) { - X = x; - } - - public String getY() { - return Y; - } - - public void setY(String y) { - Y = y; - } public String getPositionUpdateTime() { return positionUpdateTime; @@ -81,6 +84,16 @@ } + public PGPositionDto(PGTagPosition pgTagPosition) + { + this.setX(pgTagPosition.getX()); + this.setY(pgTagPosition.getY()); + this.setTagName(pgTagPosition.getTagName()); + this.setTagMac(pgTagPosition.getTagMac()); + this.setCoordinatesName(pgTagPosition.getCoordinatesName()); + this.setHostId(pgTagPosition.getHostId()); + this.setHostName(pgTagPosition.getHostName()); + } @Override public String toString() { @@ -90,8 +103,8 @@ ", hostId='" + hostId + '\'' + ", hostName='" + hostName + '\'' + ", coordinatesName='" + coordinatesName + '\'' + - ", X='" + X + '\'' + - ", Y='" + Y + '\'' + + ", X='" + x + '\'' + + ", Y='" + y + '\'' + ", postionUpdateTime='" + positionUpdateTime + '\'' + '}'; } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java index a7eea2c..6736304 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java @@ -2,6 +2,7 @@ import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; @JsonIgnoreProperties(ignoreUnknown = true) public class PGTagPositionDto { @@ -14,7 +15,22 @@ public String CoordinatesName; public String X; public String Y; - public String postionUpdateTime; + + public String getHostName() { + return HostName; + } + + public void setHostName(String hostName) { + HostName = hostName; + } + + public String getTagId() { + return TagId; + } + + public void setTagId(String tagId) { + TagId = tagId; + } public String getCoordinatesId() { return CoordinatesId; @@ -52,9 +68,8 @@ return postionUpdateTime; } - public void setPostionUpdateTime(String postionUpdateTime) { - this.postionUpdateTime = postionUpdateTime; - } + public String postionUpdateTime; + /* {"Success":true,"ErrorCode":0,"ErrorText":"","TagId":11003,"TagMac":"B0:8E:1A:50:54:88", @@ -65,19 +80,9 @@ "HostId":96,"HostGroupIds":[1,9],"HostStatusId":0,"HostExternalId":"5488","HostExternalInfo":"", "postionUpdateTime":"2019-05-22T11:09:31.9387103+08:00"} */ - - public String getTagId() { - return TagId; - } - - public void setTagId(String tagId) { - TagId = tagId; - } - public String getTagMac() { - return TagMac; - } - + return TagMac; +} public void setTagMac(String tagMac) { TagMac = tagMac; } @@ -85,10 +90,11 @@ public String getTagName() { return TagName; } - +// @JsonProperty(value ="tagName") public void setTagName(String tagName) { TagName = tagName; } + public String getHostId() { return HostId; } @@ -97,24 +103,20 @@ HostId = hostId; } - public String getHostName() { - return HostName; + + + public void setPostionUpdateTime(String postionUpdateTime) { + this.postionUpdateTime = postionUpdateTime; } - public void setHostName(String hostName) { - HostName = hostName; - } - - public PGTagPositionDto(PGTagPosition pgTagPosition){ + public PGTagPositionDto(PGTagPosition pgTagPosition) + { this.setHostId(pgTagPosition.getHostId()); - this.setCoordinatesName(pgTagPosition.getCoordinatesName()); - this.setHostName(pgTagPosition.getHostName()); this.setTagMac(pgTagPosition.getTagMac()); this.setTagName(pgTagPosition.getTagName()); - this.setX(pgTagPosition.getX()); - this.setY(pgTagPosition.getY()); } + @Override public String toString() { return "PGTagPositionDto{" + diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java index 3bd4025..af85d31 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java @@ -13,6 +13,7 @@ import javax.persistence.ParameterMode; import javax.persistence.criteria.CriteriaBuilder; +import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,10 +41,10 @@ return retMap; } - public int getMaxId(String tagMac) + public long getMaxId(String tagMac) { String hSql = "select max(id) from pg_tagposition where tagmac = '"+tagMac+"'"; - return ((Integer)this.getSession().createSQLQuery(hSql).uniqueResult()).intValue(); + return ((BigDecimal)this.getSession().createSQLQuery(hSql).uniqueResult()).longValue(); } } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java b/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java index a316bd0..d36e76b 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java @@ -24,8 +24,8 @@ } public void getAllMac(){ tagmacRun.getAllMac(); - }; - public void getMacPosition() throws ParseException {tagmacRun.getMacPosition();}; + } + public void getMacPosition() throws ParseException {tagmacRun.getMacPosition();} public static void main(String[] args) { } } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java b/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java index 74f636b..11d3878 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java @@ -1,63 +1,82 @@ -package com.casic.PgInterface.overtimeInPG.web; - - -import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; -import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; -import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; -import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; -import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; -import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; -import com.casic.PgInterface.patroler.domain.PgInPgPerson; -import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.Map; - -@Controller -@RequestMapping("rs") -//@RequestMapping("InOutPGrec") -public class PGInOutRecController { -@Resource -private PGInOutRecManager pgInOutRecManager; -@Resource -private PGTagPositionManager pgTagPositionManager; -@Resource -private PgInPgPersonManager pgInPgPersonManager; -@Resource -private PGTagMacManager pgTagMacManager; - - @RequestMapping("query") - @ResponseBody - public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom,@RequestParam(value = "dtTo", required = true) String dtTo) - { - Map resultMap = new HashMap<>(); - resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); - return resultMap; - } - - @RequestMapping("getRecentPosition") - @ResponseBody - public Map getRecentPosition(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) - { - Map resultMap = new HashMap<>(); - PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); - PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("ASSETCODE",pgInPgPerson.getAssetCode()); - PGTagPosition pgTagPosition = pgTagPositionManager.get(pgTagPositionManager.getMaxId(pgTagMac.getTagMac())); - resultMap.put("msg","success"); - resultMap.put("result",new PGTagPositionDto(pgTagPosition)); - return resultMap; - } - - @RequestMapping("getHistoryByTagmac") - @ResponseBody - public Map getHistoryByTagmac() - { - Map resultMap = new HashMap<>(); - return resultMap; - } -} +//package com.casic.PgInterface.overtimeInPG.web; +// +// +//import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; +//import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; +//import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDBDto; +//import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; +//import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; +//import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; +//import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; +//import com.casic.PgInterface.patroler.domain.PgInPgPerson; +//import com.casic.PgInterface.patroler.domain.PgInPgStatus; +//import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; +//import com.casic.PgInterface.patroler.manager.PgInPgStatusManager; +//import org.springframework.stereotype.Controller; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RequestParam; +//import org.springframework.web.bind.annotation.ResponseBody; +// +//import javax.annotation.Resource; +//import javax.ws.rs.POST; +//import javax.ws.rs.Path; +//import javax.ws.rs.Produces; +//import javax.ws.rs.core.MediaType; +//import java.util.*; +// +//@Controller +//@RequestMapping("rs") +////@RequestMapping("InOutPGrec") +//public class PGInOutRecController { +//@Resource +//private PGInOutRecManager pgInOutRecManager; +//@Resource +//private PGTagPositionManager pgTagPositionManager; +//@Resource +//private PgInPgPersonManager pgInPgPersonManager; +//@Resource +//private PGTagMacManager pgTagMacManager; +//@Resource +//private PgInPgStatusManager pgInPgStatusManager; +// +// @POST +// @Path("query") +// @Produces(MediaType.APPLICATION_JSON) +// public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom,@RequestParam(value = "dtTo", required = true) String dtTo) +// { +// Map resultMap = new HashMap<>(); +// resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); +// return resultMap; +// } +// +//// @RequestMapping("getRecentPosition") +//// @ResponseBody +// @POST +// @Path("getRecentPosition") +// @Produces(MediaType.APPLICATION_JSON) +// public Map getRecentPosition(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) +// { +// Map resultMap = new HashMap<>(); +// PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); +// PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("tagMac",pgInPgPerson.getAssetCode()); +// long maxId = pgTagPositionManager.getMaxId(pgTagMac.getTagMac()); +// PGTagPosition pgTagPosition = pgTagPositionManager.get(maxId); +// resultMap.put("msg","success"); +// resultMap.put("result",pgTagPosition); +//// resultMap.put("result",new PGTagPositionDBDto(pgTagPosition)); +// return resultMap; +// } +// +// @RequestMapping("getHistoryByTagmac") +// @ResponseBody +// public Map getHistoryByTagmac(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) +// { +// Map resultMap = new HashMap<>(); +//// PgInPgStatus pgInPgStatus = pgInPgStatusManager.findUniqueBy("PGINPGPERSONID",inPgPersonId); +//// PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); +//// PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("ASSETCODE",pgInPgPerson.getAssetCode()); +// +// return resultMap; +// +// } +//} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 8b0e269..8fda3fe 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.patroler.domain.PgInPgStatus; import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; /** * Created by yxw on 2018/4/2. @@ -20,6 +22,7 @@ private String inTime;//入廊时间 private String outTime;//出廊时间 private String inPgNum;//入廊次数 + private int timeout;//超时标记 public Long getPersonId() { return personId; @@ -101,6 +104,13 @@ this.outTime = outTime; } + public int getTimeout() { + return timeout; + } + public void setTimeout(int timeout) { + this.timeout = timeout; + } + public PgInPgInfoDto(PgInPgPerson pgInPgPerson, PgInPgStatus pgInPgStatus, int inPgNum) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -110,8 +120,17 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) + this.setTimeout(0); + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) { this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(pgInPgStatus.getInTime()); + calendar.add(Calendar.HOUR,1); + Date expectDate = calendar.getTime(); + Date now = new Date(); + this.setTimeout( 0 > expectDate.compareTo(now) && pgInPgStatus.getOutTime() ==null ? 1:0); + } else this.setLastInTime(""); this.setInPgNum(String.valueOf(inPgNum)); @@ -124,10 +143,19 @@ this.setPhoneNumber(pgInPgStatus.getPgInPgPersonId().getPhoneNumber()); this.setPersonType(pgInPgStatus.getPgInPgPersonId().getPersonType()); this.setInTime(sdf.format(pgInPgStatus.getInTime())); + this.setTimeout(0); if (pgInPgStatus.getOutTime() != null) this.setOutTime(sdf.format(pgInPgStatus.getOutTime())); - else + else { this.setOutTime(""); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(pgInPgStatus.getInTime()); + calendar.add(Calendar.HOUR,1); + Date expectDate = calendar.getTime(); + Date now = new Date(); + this.setTimeout( 0 > expectDate.compareTo(now) && pgInPgStatus.getOutTime() ==null ? 1:0); + } } public PgInPgInfoDto() diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml deleted file mode 100644 index b8260a5..0000000 --- a/.idea/artifacts/PgInterface.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - $PROJECT_DIR$/../out/artifacts/PgInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java index 7740d20..a5c9721 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java @@ -1,6 +1,6 @@ package com.casic.PgInterface.overtimeInPG.domain; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +//import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java index 270703a..ef4da0d 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java @@ -12,8 +12,25 @@ // public String TagId; // public String CoordinatesId; public String coordinatesName; - public String X; - public String Y; + + public String getX() { + return x; + } + + public void setX(String x) { + this.x = x; + } + + public String getY() { + return y; + } + + public void setY(String y) { + this.y = y; + } + + public String x; + public String y; public String positionUpdateTime; public String getTagMac() { @@ -56,21 +73,7 @@ this.coordinatesName = coordinatesName; } - public String getX() { - return X; - } - public void setX(String x) { - X = x; - } - - public String getY() { - return Y; - } - - public void setY(String y) { - Y = y; - } public String getPositionUpdateTime() { return positionUpdateTime; @@ -81,6 +84,16 @@ } + public PGPositionDto(PGTagPosition pgTagPosition) + { + this.setX(pgTagPosition.getX()); + this.setY(pgTagPosition.getY()); + this.setTagName(pgTagPosition.getTagName()); + this.setTagMac(pgTagPosition.getTagMac()); + this.setCoordinatesName(pgTagPosition.getCoordinatesName()); + this.setHostId(pgTagPosition.getHostId()); + this.setHostName(pgTagPosition.getHostName()); + } @Override public String toString() { @@ -90,8 +103,8 @@ ", hostId='" + hostId + '\'' + ", hostName='" + hostName + '\'' + ", coordinatesName='" + coordinatesName + '\'' + - ", X='" + X + '\'' + - ", Y='" + Y + '\'' + + ", X='" + x + '\'' + + ", Y='" + y + '\'' + ", postionUpdateTime='" + positionUpdateTime + '\'' + '}'; } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java index a7eea2c..6736304 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java @@ -2,6 +2,7 @@ import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; @JsonIgnoreProperties(ignoreUnknown = true) public class PGTagPositionDto { @@ -14,7 +15,22 @@ public String CoordinatesName; public String X; public String Y; - public String postionUpdateTime; + + public String getHostName() { + return HostName; + } + + public void setHostName(String hostName) { + HostName = hostName; + } + + public String getTagId() { + return TagId; + } + + public void setTagId(String tagId) { + TagId = tagId; + } public String getCoordinatesId() { return CoordinatesId; @@ -52,9 +68,8 @@ return postionUpdateTime; } - public void setPostionUpdateTime(String postionUpdateTime) { - this.postionUpdateTime = postionUpdateTime; - } + public String postionUpdateTime; + /* {"Success":true,"ErrorCode":0,"ErrorText":"","TagId":11003,"TagMac":"B0:8E:1A:50:54:88", @@ -65,19 +80,9 @@ "HostId":96,"HostGroupIds":[1,9],"HostStatusId":0,"HostExternalId":"5488","HostExternalInfo":"", "postionUpdateTime":"2019-05-22T11:09:31.9387103+08:00"} */ - - public String getTagId() { - return TagId; - } - - public void setTagId(String tagId) { - TagId = tagId; - } - public String getTagMac() { - return TagMac; - } - + return TagMac; +} public void setTagMac(String tagMac) { TagMac = tagMac; } @@ -85,10 +90,11 @@ public String getTagName() { return TagName; } - +// @JsonProperty(value ="tagName") public void setTagName(String tagName) { TagName = tagName; } + public String getHostId() { return HostId; } @@ -97,24 +103,20 @@ HostId = hostId; } - public String getHostName() { - return HostName; + + + public void setPostionUpdateTime(String postionUpdateTime) { + this.postionUpdateTime = postionUpdateTime; } - public void setHostName(String hostName) { - HostName = hostName; - } - - public PGTagPositionDto(PGTagPosition pgTagPosition){ + public PGTagPositionDto(PGTagPosition pgTagPosition) + { this.setHostId(pgTagPosition.getHostId()); - this.setCoordinatesName(pgTagPosition.getCoordinatesName()); - this.setHostName(pgTagPosition.getHostName()); this.setTagMac(pgTagPosition.getTagMac()); this.setTagName(pgTagPosition.getTagName()); - this.setX(pgTagPosition.getX()); - this.setY(pgTagPosition.getY()); } + @Override public String toString() { return "PGTagPositionDto{" + diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java index 3bd4025..af85d31 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java @@ -13,6 +13,7 @@ import javax.persistence.ParameterMode; import javax.persistence.criteria.CriteriaBuilder; +import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,10 +41,10 @@ return retMap; } - public int getMaxId(String tagMac) + public long getMaxId(String tagMac) { String hSql = "select max(id) from pg_tagposition where tagmac = '"+tagMac+"'"; - return ((Integer)this.getSession().createSQLQuery(hSql).uniqueResult()).intValue(); + return ((BigDecimal)this.getSession().createSQLQuery(hSql).uniqueResult()).longValue(); } } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java b/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java index a316bd0..d36e76b 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java @@ -24,8 +24,8 @@ } public void getAllMac(){ tagmacRun.getAllMac(); - }; - public void getMacPosition() throws ParseException {tagmacRun.getMacPosition();}; + } + public void getMacPosition() throws ParseException {tagmacRun.getMacPosition();} public static void main(String[] args) { } } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java b/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java index 74f636b..11d3878 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java @@ -1,63 +1,82 @@ -package com.casic.PgInterface.overtimeInPG.web; - - -import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; -import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; -import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; -import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; -import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; -import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; -import com.casic.PgInterface.patroler.domain.PgInPgPerson; -import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.Map; - -@Controller -@RequestMapping("rs") -//@RequestMapping("InOutPGrec") -public class PGInOutRecController { -@Resource -private PGInOutRecManager pgInOutRecManager; -@Resource -private PGTagPositionManager pgTagPositionManager; -@Resource -private PgInPgPersonManager pgInPgPersonManager; -@Resource -private PGTagMacManager pgTagMacManager; - - @RequestMapping("query") - @ResponseBody - public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom,@RequestParam(value = "dtTo", required = true) String dtTo) - { - Map resultMap = new HashMap<>(); - resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); - return resultMap; - } - - @RequestMapping("getRecentPosition") - @ResponseBody - public Map getRecentPosition(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) - { - Map resultMap = new HashMap<>(); - PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); - PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("ASSETCODE",pgInPgPerson.getAssetCode()); - PGTagPosition pgTagPosition = pgTagPositionManager.get(pgTagPositionManager.getMaxId(pgTagMac.getTagMac())); - resultMap.put("msg","success"); - resultMap.put("result",new PGTagPositionDto(pgTagPosition)); - return resultMap; - } - - @RequestMapping("getHistoryByTagmac") - @ResponseBody - public Map getHistoryByTagmac() - { - Map resultMap = new HashMap<>(); - return resultMap; - } -} +//package com.casic.PgInterface.overtimeInPG.web; +// +// +//import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; +//import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; +//import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDBDto; +//import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; +//import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; +//import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; +//import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; +//import com.casic.PgInterface.patroler.domain.PgInPgPerson; +//import com.casic.PgInterface.patroler.domain.PgInPgStatus; +//import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; +//import com.casic.PgInterface.patroler.manager.PgInPgStatusManager; +//import org.springframework.stereotype.Controller; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RequestParam; +//import org.springframework.web.bind.annotation.ResponseBody; +// +//import javax.annotation.Resource; +//import javax.ws.rs.POST; +//import javax.ws.rs.Path; +//import javax.ws.rs.Produces; +//import javax.ws.rs.core.MediaType; +//import java.util.*; +// +//@Controller +//@RequestMapping("rs") +////@RequestMapping("InOutPGrec") +//public class PGInOutRecController { +//@Resource +//private PGInOutRecManager pgInOutRecManager; +//@Resource +//private PGTagPositionManager pgTagPositionManager; +//@Resource +//private PgInPgPersonManager pgInPgPersonManager; +//@Resource +//private PGTagMacManager pgTagMacManager; +//@Resource +//private PgInPgStatusManager pgInPgStatusManager; +// +// @POST +// @Path("query") +// @Produces(MediaType.APPLICATION_JSON) +// public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom,@RequestParam(value = "dtTo", required = true) String dtTo) +// { +// Map resultMap = new HashMap<>(); +// resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); +// return resultMap; +// } +// +//// @RequestMapping("getRecentPosition") +//// @ResponseBody +// @POST +// @Path("getRecentPosition") +// @Produces(MediaType.APPLICATION_JSON) +// public Map getRecentPosition(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) +// { +// Map resultMap = new HashMap<>(); +// PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); +// PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("tagMac",pgInPgPerson.getAssetCode()); +// long maxId = pgTagPositionManager.getMaxId(pgTagMac.getTagMac()); +// PGTagPosition pgTagPosition = pgTagPositionManager.get(maxId); +// resultMap.put("msg","success"); +// resultMap.put("result",pgTagPosition); +//// resultMap.put("result",new PGTagPositionDBDto(pgTagPosition)); +// return resultMap; +// } +// +// @RequestMapping("getHistoryByTagmac") +// @ResponseBody +// public Map getHistoryByTagmac(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) +// { +// Map resultMap = new HashMap<>(); +//// PgInPgStatus pgInPgStatus = pgInPgStatusManager.findUniqueBy("PGINPGPERSONID",inPgPersonId); +//// PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); +//// PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("ASSETCODE",pgInPgPerson.getAssetCode()); +// +// return resultMap; +// +// } +//} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 8b0e269..8fda3fe 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.patroler.domain.PgInPgStatus; import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; /** * Created by yxw on 2018/4/2. @@ -20,6 +22,7 @@ private String inTime;//入廊时间 private String outTime;//出廊时间 private String inPgNum;//入廊次数 + private int timeout;//超时标记 public Long getPersonId() { return personId; @@ -101,6 +104,13 @@ this.outTime = outTime; } + public int getTimeout() { + return timeout; + } + public void setTimeout(int timeout) { + this.timeout = timeout; + } + public PgInPgInfoDto(PgInPgPerson pgInPgPerson, PgInPgStatus pgInPgStatus, int inPgNum) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -110,8 +120,17 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) + this.setTimeout(0); + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) { this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(pgInPgStatus.getInTime()); + calendar.add(Calendar.HOUR,1); + Date expectDate = calendar.getTime(); + Date now = new Date(); + this.setTimeout( 0 > expectDate.compareTo(now) && pgInPgStatus.getOutTime() ==null ? 1:0); + } else this.setLastInTime(""); this.setInPgNum(String.valueOf(inPgNum)); @@ -124,10 +143,19 @@ this.setPhoneNumber(pgInPgStatus.getPgInPgPersonId().getPhoneNumber()); this.setPersonType(pgInPgStatus.getPgInPgPersonId().getPersonType()); this.setInTime(sdf.format(pgInPgStatus.getInTime())); + this.setTimeout(0); if (pgInPgStatus.getOutTime() != null) this.setOutTime(sdf.format(pgInPgStatus.getOutTime())); - else + else { this.setOutTime(""); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(pgInPgStatus.getInTime()); + calendar.add(Calendar.HOUR,1); + Date expectDate = calendar.getTime(); + Date now = new Date(); + this.setTimeout( 0 > expectDate.compareTo(now) && pgInPgStatus.getOutTime() ==null ? 1:0); + } } public PgInPgInfoDto() diff --git a/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java b/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java index 1f7b5a0..2d702e3 100644 --- a/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java @@ -1,13 +1,22 @@ package com.casic.PgInterface.rs; +import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; +import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; +import com.casic.PgInterface.overtimeInPG.dto.PGPositionDto; +import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; +import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; +import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; +import com.casic.PgInterface.patroler.domain.PgInPgPerson; +import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; +import com.casic.PgInterface.patroler.manager.PgInPgStatusManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.RequestParam; import javax.annotation.Resource; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import java.util.HashMap; import java.util.Map; @@ -18,16 +27,45 @@ @Resource private PGInOutRecManager pgInOutRecManager; + @Resource + private PGTagPositionManager pgTagPositionManager; + @Resource + private PgInPgPersonManager pgInPgPersonManager; + @Resource + private PGTagMacManager pgTagMacManager; + @Resource + private PgInPgStatusManager pgInPgStatusManager; + + private static Logger logger = LoggerFactory.getLogger(PGInOutRecRs.class); @POST @Path("query") @Produces(MediaType.APPLICATION_JSON) - public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom, - @RequestParam(value = "dtTo", required = true) String dtTo) + public Map query(@FormParam("dtFrom") String dtFrom, + @FormParam("dtTo") String dtTo) { Map resultMap = new HashMap<>(); resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); return resultMap; } + @POST + @Path("getRecentPosition") + @Produces(MediaType.APPLICATION_JSON) + public Map getRecentPosition(@FormParam("inPgPersonId") String inPgPersonId) + { + logger.info("param:"+inPgPersonId); + System.out.println("param:"+inPgPersonId); + Map resultMap = new HashMap<>(); + PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(Long.valueOf(inPgPersonId)); + PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("tagMac",pgInPgPerson.getAssetCode()); + long maxId = pgTagPositionManager.getMaxId(pgTagMac.getTagMac()); + PGTagPosition pgTagPosition = pgTagPositionManager.get(maxId); + resultMap.put("msg","success"); +// resultMap.put("result",pgTagPosition); + resultMap.put("result",new PGPositionDto(pgTagPosition)); + System.out.println("test"); + return resultMap; + } + } \ No newline at end of file diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml deleted file mode 100644 index b8260a5..0000000 --- a/.idea/artifacts/PgInterface.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - $PROJECT_DIR$/../out/artifacts/PgInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java index 7740d20..a5c9721 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java @@ -1,6 +1,6 @@ package com.casic.PgInterface.overtimeInPG.domain; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +//import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java index 270703a..ef4da0d 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java @@ -12,8 +12,25 @@ // public String TagId; // public String CoordinatesId; public String coordinatesName; - public String X; - public String Y; + + public String getX() { + return x; + } + + public void setX(String x) { + this.x = x; + } + + public String getY() { + return y; + } + + public void setY(String y) { + this.y = y; + } + + public String x; + public String y; public String positionUpdateTime; public String getTagMac() { @@ -56,21 +73,7 @@ this.coordinatesName = coordinatesName; } - public String getX() { - return X; - } - public void setX(String x) { - X = x; - } - - public String getY() { - return Y; - } - - public void setY(String y) { - Y = y; - } public String getPositionUpdateTime() { return positionUpdateTime; @@ -81,6 +84,16 @@ } + public PGPositionDto(PGTagPosition pgTagPosition) + { + this.setX(pgTagPosition.getX()); + this.setY(pgTagPosition.getY()); + this.setTagName(pgTagPosition.getTagName()); + this.setTagMac(pgTagPosition.getTagMac()); + this.setCoordinatesName(pgTagPosition.getCoordinatesName()); + this.setHostId(pgTagPosition.getHostId()); + this.setHostName(pgTagPosition.getHostName()); + } @Override public String toString() { @@ -90,8 +103,8 @@ ", hostId='" + hostId + '\'' + ", hostName='" + hostName + '\'' + ", coordinatesName='" + coordinatesName + '\'' + - ", X='" + X + '\'' + - ", Y='" + Y + '\'' + + ", X='" + x + '\'' + + ", Y='" + y + '\'' + ", postionUpdateTime='" + positionUpdateTime + '\'' + '}'; } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java index a7eea2c..6736304 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java @@ -2,6 +2,7 @@ import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; @JsonIgnoreProperties(ignoreUnknown = true) public class PGTagPositionDto { @@ -14,7 +15,22 @@ public String CoordinatesName; public String X; public String Y; - public String postionUpdateTime; + + public String getHostName() { + return HostName; + } + + public void setHostName(String hostName) { + HostName = hostName; + } + + public String getTagId() { + return TagId; + } + + public void setTagId(String tagId) { + TagId = tagId; + } public String getCoordinatesId() { return CoordinatesId; @@ -52,9 +68,8 @@ return postionUpdateTime; } - public void setPostionUpdateTime(String postionUpdateTime) { - this.postionUpdateTime = postionUpdateTime; - } + public String postionUpdateTime; + /* {"Success":true,"ErrorCode":0,"ErrorText":"","TagId":11003,"TagMac":"B0:8E:1A:50:54:88", @@ -65,19 +80,9 @@ "HostId":96,"HostGroupIds":[1,9],"HostStatusId":0,"HostExternalId":"5488","HostExternalInfo":"", "postionUpdateTime":"2019-05-22T11:09:31.9387103+08:00"} */ - - public String getTagId() { - return TagId; - } - - public void setTagId(String tagId) { - TagId = tagId; - } - public String getTagMac() { - return TagMac; - } - + return TagMac; +} public void setTagMac(String tagMac) { TagMac = tagMac; } @@ -85,10 +90,11 @@ public String getTagName() { return TagName; } - +// @JsonProperty(value ="tagName") public void setTagName(String tagName) { TagName = tagName; } + public String getHostId() { return HostId; } @@ -97,24 +103,20 @@ HostId = hostId; } - public String getHostName() { - return HostName; + + + public void setPostionUpdateTime(String postionUpdateTime) { + this.postionUpdateTime = postionUpdateTime; } - public void setHostName(String hostName) { - HostName = hostName; - } - - public PGTagPositionDto(PGTagPosition pgTagPosition){ + public PGTagPositionDto(PGTagPosition pgTagPosition) + { this.setHostId(pgTagPosition.getHostId()); - this.setCoordinatesName(pgTagPosition.getCoordinatesName()); - this.setHostName(pgTagPosition.getHostName()); this.setTagMac(pgTagPosition.getTagMac()); this.setTagName(pgTagPosition.getTagName()); - this.setX(pgTagPosition.getX()); - this.setY(pgTagPosition.getY()); } + @Override public String toString() { return "PGTagPositionDto{" + diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java index 3bd4025..af85d31 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java @@ -13,6 +13,7 @@ import javax.persistence.ParameterMode; import javax.persistence.criteria.CriteriaBuilder; +import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,10 +41,10 @@ return retMap; } - public int getMaxId(String tagMac) + public long getMaxId(String tagMac) { String hSql = "select max(id) from pg_tagposition where tagmac = '"+tagMac+"'"; - return ((Integer)this.getSession().createSQLQuery(hSql).uniqueResult()).intValue(); + return ((BigDecimal)this.getSession().createSQLQuery(hSql).uniqueResult()).longValue(); } } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java b/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java index a316bd0..d36e76b 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java @@ -24,8 +24,8 @@ } public void getAllMac(){ tagmacRun.getAllMac(); - }; - public void getMacPosition() throws ParseException {tagmacRun.getMacPosition();}; + } + public void getMacPosition() throws ParseException {tagmacRun.getMacPosition();} public static void main(String[] args) { } } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java b/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java index 74f636b..11d3878 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java @@ -1,63 +1,82 @@ -package com.casic.PgInterface.overtimeInPG.web; - - -import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; -import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; -import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; -import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; -import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; -import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; -import com.casic.PgInterface.patroler.domain.PgInPgPerson; -import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.Map; - -@Controller -@RequestMapping("rs") -//@RequestMapping("InOutPGrec") -public class PGInOutRecController { -@Resource -private PGInOutRecManager pgInOutRecManager; -@Resource -private PGTagPositionManager pgTagPositionManager; -@Resource -private PgInPgPersonManager pgInPgPersonManager; -@Resource -private PGTagMacManager pgTagMacManager; - - @RequestMapping("query") - @ResponseBody - public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom,@RequestParam(value = "dtTo", required = true) String dtTo) - { - Map resultMap = new HashMap<>(); - resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); - return resultMap; - } - - @RequestMapping("getRecentPosition") - @ResponseBody - public Map getRecentPosition(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) - { - Map resultMap = new HashMap<>(); - PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); - PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("ASSETCODE",pgInPgPerson.getAssetCode()); - PGTagPosition pgTagPosition = pgTagPositionManager.get(pgTagPositionManager.getMaxId(pgTagMac.getTagMac())); - resultMap.put("msg","success"); - resultMap.put("result",new PGTagPositionDto(pgTagPosition)); - return resultMap; - } - - @RequestMapping("getHistoryByTagmac") - @ResponseBody - public Map getHistoryByTagmac() - { - Map resultMap = new HashMap<>(); - return resultMap; - } -} +//package com.casic.PgInterface.overtimeInPG.web; +// +// +//import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; +//import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; +//import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDBDto; +//import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; +//import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; +//import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; +//import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; +//import com.casic.PgInterface.patroler.domain.PgInPgPerson; +//import com.casic.PgInterface.patroler.domain.PgInPgStatus; +//import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; +//import com.casic.PgInterface.patroler.manager.PgInPgStatusManager; +//import org.springframework.stereotype.Controller; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RequestParam; +//import org.springframework.web.bind.annotation.ResponseBody; +// +//import javax.annotation.Resource; +//import javax.ws.rs.POST; +//import javax.ws.rs.Path; +//import javax.ws.rs.Produces; +//import javax.ws.rs.core.MediaType; +//import java.util.*; +// +//@Controller +//@RequestMapping("rs") +////@RequestMapping("InOutPGrec") +//public class PGInOutRecController { +//@Resource +//private PGInOutRecManager pgInOutRecManager; +//@Resource +//private PGTagPositionManager pgTagPositionManager; +//@Resource +//private PgInPgPersonManager pgInPgPersonManager; +//@Resource +//private PGTagMacManager pgTagMacManager; +//@Resource +//private PgInPgStatusManager pgInPgStatusManager; +// +// @POST +// @Path("query") +// @Produces(MediaType.APPLICATION_JSON) +// public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom,@RequestParam(value = "dtTo", required = true) String dtTo) +// { +// Map resultMap = new HashMap<>(); +// resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); +// return resultMap; +// } +// +//// @RequestMapping("getRecentPosition") +//// @ResponseBody +// @POST +// @Path("getRecentPosition") +// @Produces(MediaType.APPLICATION_JSON) +// public Map getRecentPosition(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) +// { +// Map resultMap = new HashMap<>(); +// PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); +// PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("tagMac",pgInPgPerson.getAssetCode()); +// long maxId = pgTagPositionManager.getMaxId(pgTagMac.getTagMac()); +// PGTagPosition pgTagPosition = pgTagPositionManager.get(maxId); +// resultMap.put("msg","success"); +// resultMap.put("result",pgTagPosition); +//// resultMap.put("result",new PGTagPositionDBDto(pgTagPosition)); +// return resultMap; +// } +// +// @RequestMapping("getHistoryByTagmac") +// @ResponseBody +// public Map getHistoryByTagmac(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) +// { +// Map resultMap = new HashMap<>(); +//// PgInPgStatus pgInPgStatus = pgInPgStatusManager.findUniqueBy("PGINPGPERSONID",inPgPersonId); +//// PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); +//// PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("ASSETCODE",pgInPgPerson.getAssetCode()); +// +// return resultMap; +// +// } +//} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 8b0e269..8fda3fe 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.patroler.domain.PgInPgStatus; import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; /** * Created by yxw on 2018/4/2. @@ -20,6 +22,7 @@ private String inTime;//入廊时间 private String outTime;//出廊时间 private String inPgNum;//入廊次数 + private int timeout;//超时标记 public Long getPersonId() { return personId; @@ -101,6 +104,13 @@ this.outTime = outTime; } + public int getTimeout() { + return timeout; + } + public void setTimeout(int timeout) { + this.timeout = timeout; + } + public PgInPgInfoDto(PgInPgPerson pgInPgPerson, PgInPgStatus pgInPgStatus, int inPgNum) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -110,8 +120,17 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) + this.setTimeout(0); + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) { this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(pgInPgStatus.getInTime()); + calendar.add(Calendar.HOUR,1); + Date expectDate = calendar.getTime(); + Date now = new Date(); + this.setTimeout( 0 > expectDate.compareTo(now) && pgInPgStatus.getOutTime() ==null ? 1:0); + } else this.setLastInTime(""); this.setInPgNum(String.valueOf(inPgNum)); @@ -124,10 +143,19 @@ this.setPhoneNumber(pgInPgStatus.getPgInPgPersonId().getPhoneNumber()); this.setPersonType(pgInPgStatus.getPgInPgPersonId().getPersonType()); this.setInTime(sdf.format(pgInPgStatus.getInTime())); + this.setTimeout(0); if (pgInPgStatus.getOutTime() != null) this.setOutTime(sdf.format(pgInPgStatus.getOutTime())); - else + else { this.setOutTime(""); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(pgInPgStatus.getInTime()); + calendar.add(Calendar.HOUR,1); + Date expectDate = calendar.getTime(); + Date now = new Date(); + this.setTimeout( 0 > expectDate.compareTo(now) && pgInPgStatus.getOutTime() ==null ? 1:0); + } } public PgInPgInfoDto() diff --git a/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java b/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java index 1f7b5a0..2d702e3 100644 --- a/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java @@ -1,13 +1,22 @@ package com.casic.PgInterface.rs; +import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; +import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; +import com.casic.PgInterface.overtimeInPG.dto.PGPositionDto; +import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; +import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; +import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; +import com.casic.PgInterface.patroler.domain.PgInPgPerson; +import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; +import com.casic.PgInterface.patroler.manager.PgInPgStatusManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.RequestParam; import javax.annotation.Resource; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import java.util.HashMap; import java.util.Map; @@ -18,16 +27,45 @@ @Resource private PGInOutRecManager pgInOutRecManager; + @Resource + private PGTagPositionManager pgTagPositionManager; + @Resource + private PgInPgPersonManager pgInPgPersonManager; + @Resource + private PGTagMacManager pgTagMacManager; + @Resource + private PgInPgStatusManager pgInPgStatusManager; + + private static Logger logger = LoggerFactory.getLogger(PGInOutRecRs.class); @POST @Path("query") @Produces(MediaType.APPLICATION_JSON) - public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom, - @RequestParam(value = "dtTo", required = true) String dtTo) + public Map query(@FormParam("dtFrom") String dtFrom, + @FormParam("dtTo") String dtTo) { Map resultMap = new HashMap<>(); resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); return resultMap; } + @POST + @Path("getRecentPosition") + @Produces(MediaType.APPLICATION_JSON) + public Map getRecentPosition(@FormParam("inPgPersonId") String inPgPersonId) + { + logger.info("param:"+inPgPersonId); + System.out.println("param:"+inPgPersonId); + Map resultMap = new HashMap<>(); + PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(Long.valueOf(inPgPersonId)); + PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("tagMac",pgInPgPerson.getAssetCode()); + long maxId = pgTagPositionManager.getMaxId(pgTagMac.getTagMac()); + PGTagPosition pgTagPosition = pgTagPositionManager.get(maxId); + resultMap.put("msg","success"); +// resultMap.put("result",pgTagPosition); + resultMap.put("result",new PGPositionDto(pgTagPosition)); + System.out.println("test"); + return resultMap; + } + } \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java index b506338..2abc334 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java @@ -2,6 +2,7 @@ import com.casic.PgInterface.devTable.dto.PgDeviceDto; import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; import com.casic.PgInterface.patroler.domain.PgInPgPerson; import com.casic.PgInterface.patroler.domain.PgInPgStatus; import com.casic.PgInterface.patroler.dto.PgInPgInfoDto; @@ -35,6 +36,9 @@ @Resource private PgDeviceManager pgDeviceManager; + @Resource + private PGTagMacManager pgTagMacManager; + /** * 派发工作证(新增入廊记录) */ @@ -54,6 +58,15 @@ try { PgInPgPerson pgInPgPerson = pgInPgPersonManager.getPersonByUserName(userName); +// int iTagMac = pgTagMacManager.getCount("select count(1) from pg_tagmac where tagmac = ?",assetCode); +// if (0==iTagMac) +// { +// result = "false"; +// msg = "设备mac信息不存在"; +// resultMap.put("result", result); +// resultMap.put("msg", msg); +// return resultMap; +// } if (pgInPgPerson == null) { PgInPgPerson pgInPgPerson1=new PgInPgPerson(); diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml deleted file mode 100644 index b8260a5..0000000 --- a/.idea/artifacts/PgInterface.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - $PROJECT_DIR$/../out/artifacts/PgInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java index 7740d20..a5c9721 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java @@ -1,6 +1,6 @@ package com.casic.PgInterface.overtimeInPG.domain; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +//import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java index 270703a..ef4da0d 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java @@ -12,8 +12,25 @@ // public String TagId; // public String CoordinatesId; public String coordinatesName; - public String X; - public String Y; + + public String getX() { + return x; + } + + public void setX(String x) { + this.x = x; + } + + public String getY() { + return y; + } + + public void setY(String y) { + this.y = y; + } + + public String x; + public String y; public String positionUpdateTime; public String getTagMac() { @@ -56,21 +73,7 @@ this.coordinatesName = coordinatesName; } - public String getX() { - return X; - } - public void setX(String x) { - X = x; - } - - public String getY() { - return Y; - } - - public void setY(String y) { - Y = y; - } public String getPositionUpdateTime() { return positionUpdateTime; @@ -81,6 +84,16 @@ } + public PGPositionDto(PGTagPosition pgTagPosition) + { + this.setX(pgTagPosition.getX()); + this.setY(pgTagPosition.getY()); + this.setTagName(pgTagPosition.getTagName()); + this.setTagMac(pgTagPosition.getTagMac()); + this.setCoordinatesName(pgTagPosition.getCoordinatesName()); + this.setHostId(pgTagPosition.getHostId()); + this.setHostName(pgTagPosition.getHostName()); + } @Override public String toString() { @@ -90,8 +103,8 @@ ", hostId='" + hostId + '\'' + ", hostName='" + hostName + '\'' + ", coordinatesName='" + coordinatesName + '\'' + - ", X='" + X + '\'' + - ", Y='" + Y + '\'' + + ", X='" + x + '\'' + + ", Y='" + y + '\'' + ", postionUpdateTime='" + positionUpdateTime + '\'' + '}'; } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java index a7eea2c..6736304 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java @@ -2,6 +2,7 @@ import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; @JsonIgnoreProperties(ignoreUnknown = true) public class PGTagPositionDto { @@ -14,7 +15,22 @@ public String CoordinatesName; public String X; public String Y; - public String postionUpdateTime; + + public String getHostName() { + return HostName; + } + + public void setHostName(String hostName) { + HostName = hostName; + } + + public String getTagId() { + return TagId; + } + + public void setTagId(String tagId) { + TagId = tagId; + } public String getCoordinatesId() { return CoordinatesId; @@ -52,9 +68,8 @@ return postionUpdateTime; } - public void setPostionUpdateTime(String postionUpdateTime) { - this.postionUpdateTime = postionUpdateTime; - } + public String postionUpdateTime; + /* {"Success":true,"ErrorCode":0,"ErrorText":"","TagId":11003,"TagMac":"B0:8E:1A:50:54:88", @@ -65,19 +80,9 @@ "HostId":96,"HostGroupIds":[1,9],"HostStatusId":0,"HostExternalId":"5488","HostExternalInfo":"", "postionUpdateTime":"2019-05-22T11:09:31.9387103+08:00"} */ - - public String getTagId() { - return TagId; - } - - public void setTagId(String tagId) { - TagId = tagId; - } - public String getTagMac() { - return TagMac; - } - + return TagMac; +} public void setTagMac(String tagMac) { TagMac = tagMac; } @@ -85,10 +90,11 @@ public String getTagName() { return TagName; } - +// @JsonProperty(value ="tagName") public void setTagName(String tagName) { TagName = tagName; } + public String getHostId() { return HostId; } @@ -97,24 +103,20 @@ HostId = hostId; } - public String getHostName() { - return HostName; + + + public void setPostionUpdateTime(String postionUpdateTime) { + this.postionUpdateTime = postionUpdateTime; } - public void setHostName(String hostName) { - HostName = hostName; - } - - public PGTagPositionDto(PGTagPosition pgTagPosition){ + public PGTagPositionDto(PGTagPosition pgTagPosition) + { this.setHostId(pgTagPosition.getHostId()); - this.setCoordinatesName(pgTagPosition.getCoordinatesName()); - this.setHostName(pgTagPosition.getHostName()); this.setTagMac(pgTagPosition.getTagMac()); this.setTagName(pgTagPosition.getTagName()); - this.setX(pgTagPosition.getX()); - this.setY(pgTagPosition.getY()); } + @Override public String toString() { return "PGTagPositionDto{" + diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java index 3bd4025..af85d31 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java @@ -13,6 +13,7 @@ import javax.persistence.ParameterMode; import javax.persistence.criteria.CriteriaBuilder; +import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,10 +41,10 @@ return retMap; } - public int getMaxId(String tagMac) + public long getMaxId(String tagMac) { String hSql = "select max(id) from pg_tagposition where tagmac = '"+tagMac+"'"; - return ((Integer)this.getSession().createSQLQuery(hSql).uniqueResult()).intValue(); + return ((BigDecimal)this.getSession().createSQLQuery(hSql).uniqueResult()).longValue(); } } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java b/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java index a316bd0..d36e76b 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java @@ -24,8 +24,8 @@ } public void getAllMac(){ tagmacRun.getAllMac(); - }; - public void getMacPosition() throws ParseException {tagmacRun.getMacPosition();}; + } + public void getMacPosition() throws ParseException {tagmacRun.getMacPosition();} public static void main(String[] args) { } } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java b/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java index 74f636b..11d3878 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java @@ -1,63 +1,82 @@ -package com.casic.PgInterface.overtimeInPG.web; - - -import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; -import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; -import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; -import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; -import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; -import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; -import com.casic.PgInterface.patroler.domain.PgInPgPerson; -import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.Map; - -@Controller -@RequestMapping("rs") -//@RequestMapping("InOutPGrec") -public class PGInOutRecController { -@Resource -private PGInOutRecManager pgInOutRecManager; -@Resource -private PGTagPositionManager pgTagPositionManager; -@Resource -private PgInPgPersonManager pgInPgPersonManager; -@Resource -private PGTagMacManager pgTagMacManager; - - @RequestMapping("query") - @ResponseBody - public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom,@RequestParam(value = "dtTo", required = true) String dtTo) - { - Map resultMap = new HashMap<>(); - resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); - return resultMap; - } - - @RequestMapping("getRecentPosition") - @ResponseBody - public Map getRecentPosition(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) - { - Map resultMap = new HashMap<>(); - PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); - PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("ASSETCODE",pgInPgPerson.getAssetCode()); - PGTagPosition pgTagPosition = pgTagPositionManager.get(pgTagPositionManager.getMaxId(pgTagMac.getTagMac())); - resultMap.put("msg","success"); - resultMap.put("result",new PGTagPositionDto(pgTagPosition)); - return resultMap; - } - - @RequestMapping("getHistoryByTagmac") - @ResponseBody - public Map getHistoryByTagmac() - { - Map resultMap = new HashMap<>(); - return resultMap; - } -} +//package com.casic.PgInterface.overtimeInPG.web; +// +// +//import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; +//import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; +//import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDBDto; +//import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; +//import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; +//import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; +//import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; +//import com.casic.PgInterface.patroler.domain.PgInPgPerson; +//import com.casic.PgInterface.patroler.domain.PgInPgStatus; +//import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; +//import com.casic.PgInterface.patroler.manager.PgInPgStatusManager; +//import org.springframework.stereotype.Controller; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RequestParam; +//import org.springframework.web.bind.annotation.ResponseBody; +// +//import javax.annotation.Resource; +//import javax.ws.rs.POST; +//import javax.ws.rs.Path; +//import javax.ws.rs.Produces; +//import javax.ws.rs.core.MediaType; +//import java.util.*; +// +//@Controller +//@RequestMapping("rs") +////@RequestMapping("InOutPGrec") +//public class PGInOutRecController { +//@Resource +//private PGInOutRecManager pgInOutRecManager; +//@Resource +//private PGTagPositionManager pgTagPositionManager; +//@Resource +//private PgInPgPersonManager pgInPgPersonManager; +//@Resource +//private PGTagMacManager pgTagMacManager; +//@Resource +//private PgInPgStatusManager pgInPgStatusManager; +// +// @POST +// @Path("query") +// @Produces(MediaType.APPLICATION_JSON) +// public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom,@RequestParam(value = "dtTo", required = true) String dtTo) +// { +// Map resultMap = new HashMap<>(); +// resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); +// return resultMap; +// } +// +//// @RequestMapping("getRecentPosition") +//// @ResponseBody +// @POST +// @Path("getRecentPosition") +// @Produces(MediaType.APPLICATION_JSON) +// public Map getRecentPosition(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) +// { +// Map resultMap = new HashMap<>(); +// PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); +// PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("tagMac",pgInPgPerson.getAssetCode()); +// long maxId = pgTagPositionManager.getMaxId(pgTagMac.getTagMac()); +// PGTagPosition pgTagPosition = pgTagPositionManager.get(maxId); +// resultMap.put("msg","success"); +// resultMap.put("result",pgTagPosition); +//// resultMap.put("result",new PGTagPositionDBDto(pgTagPosition)); +// return resultMap; +// } +// +// @RequestMapping("getHistoryByTagmac") +// @ResponseBody +// public Map getHistoryByTagmac(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) +// { +// Map resultMap = new HashMap<>(); +//// PgInPgStatus pgInPgStatus = pgInPgStatusManager.findUniqueBy("PGINPGPERSONID",inPgPersonId); +//// PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); +//// PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("ASSETCODE",pgInPgPerson.getAssetCode()); +// +// return resultMap; +// +// } +//} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 8b0e269..8fda3fe 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.patroler.domain.PgInPgStatus; import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; /** * Created by yxw on 2018/4/2. @@ -20,6 +22,7 @@ private String inTime;//入廊时间 private String outTime;//出廊时间 private String inPgNum;//入廊次数 + private int timeout;//超时标记 public Long getPersonId() { return personId; @@ -101,6 +104,13 @@ this.outTime = outTime; } + public int getTimeout() { + return timeout; + } + public void setTimeout(int timeout) { + this.timeout = timeout; + } + public PgInPgInfoDto(PgInPgPerson pgInPgPerson, PgInPgStatus pgInPgStatus, int inPgNum) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -110,8 +120,17 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) + this.setTimeout(0); + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) { this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(pgInPgStatus.getInTime()); + calendar.add(Calendar.HOUR,1); + Date expectDate = calendar.getTime(); + Date now = new Date(); + this.setTimeout( 0 > expectDate.compareTo(now) && pgInPgStatus.getOutTime() ==null ? 1:0); + } else this.setLastInTime(""); this.setInPgNum(String.valueOf(inPgNum)); @@ -124,10 +143,19 @@ this.setPhoneNumber(pgInPgStatus.getPgInPgPersonId().getPhoneNumber()); this.setPersonType(pgInPgStatus.getPgInPgPersonId().getPersonType()); this.setInTime(sdf.format(pgInPgStatus.getInTime())); + this.setTimeout(0); if (pgInPgStatus.getOutTime() != null) this.setOutTime(sdf.format(pgInPgStatus.getOutTime())); - else + else { this.setOutTime(""); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(pgInPgStatus.getInTime()); + calendar.add(Calendar.HOUR,1); + Date expectDate = calendar.getTime(); + Date now = new Date(); + this.setTimeout( 0 > expectDate.compareTo(now) && pgInPgStatus.getOutTime() ==null ? 1:0); + } } public PgInPgInfoDto() diff --git a/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java b/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java index 1f7b5a0..2d702e3 100644 --- a/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java @@ -1,13 +1,22 @@ package com.casic.PgInterface.rs; +import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; +import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; +import com.casic.PgInterface.overtimeInPG.dto.PGPositionDto; +import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; +import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; +import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; +import com.casic.PgInterface.patroler.domain.PgInPgPerson; +import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; +import com.casic.PgInterface.patroler.manager.PgInPgStatusManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.RequestParam; import javax.annotation.Resource; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import java.util.HashMap; import java.util.Map; @@ -18,16 +27,45 @@ @Resource private PGInOutRecManager pgInOutRecManager; + @Resource + private PGTagPositionManager pgTagPositionManager; + @Resource + private PgInPgPersonManager pgInPgPersonManager; + @Resource + private PGTagMacManager pgTagMacManager; + @Resource + private PgInPgStatusManager pgInPgStatusManager; + + private static Logger logger = LoggerFactory.getLogger(PGInOutRecRs.class); @POST @Path("query") @Produces(MediaType.APPLICATION_JSON) - public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom, - @RequestParam(value = "dtTo", required = true) String dtTo) + public Map query(@FormParam("dtFrom") String dtFrom, + @FormParam("dtTo") String dtTo) { Map resultMap = new HashMap<>(); resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); return resultMap; } + @POST + @Path("getRecentPosition") + @Produces(MediaType.APPLICATION_JSON) + public Map getRecentPosition(@FormParam("inPgPersonId") String inPgPersonId) + { + logger.info("param:"+inPgPersonId); + System.out.println("param:"+inPgPersonId); + Map resultMap = new HashMap<>(); + PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(Long.valueOf(inPgPersonId)); + PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("tagMac",pgInPgPerson.getAssetCode()); + long maxId = pgTagPositionManager.getMaxId(pgTagMac.getTagMac()); + PGTagPosition pgTagPosition = pgTagPositionManager.get(maxId); + resultMap.put("msg","success"); +// resultMap.put("result",pgTagPosition); + resultMap.put("result",new PGPositionDto(pgTagPosition)); + System.out.println("test"); + return resultMap; + } + } \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java index b506338..2abc334 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java @@ -2,6 +2,7 @@ import com.casic.PgInterface.devTable.dto.PgDeviceDto; import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; import com.casic.PgInterface.patroler.domain.PgInPgPerson; import com.casic.PgInterface.patroler.domain.PgInPgStatus; import com.casic.PgInterface.patroler.dto.PgInPgInfoDto; @@ -35,6 +36,9 @@ @Resource private PgDeviceManager pgDeviceManager; + @Resource + private PGTagMacManager pgTagMacManager; + /** * 派发工作证(新增入廊记录) */ @@ -54,6 +58,15 @@ try { PgInPgPerson pgInPgPerson = pgInPgPersonManager.getPersonByUserName(userName); +// int iTagMac = pgTagMacManager.getCount("select count(1) from pg_tagmac where tagmac = ?",assetCode); +// if (0==iTagMac) +// { +// result = "false"; +// msg = "设备mac信息不存在"; +// resultMap.put("result", result); +// resultMap.put("msg", msg); +// return resultMap; +// } if (pgInPgPerson == null) { PgInPgPerson pgInPgPerson1=new PgInPgPerson(); diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index f2bfed0..0ee4d73 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -35,7 +35,7 @@ org.springframework.web.servlet.DispatcherServlet contextConfigLocation - classpath*:spring/applicationContext*.xml + classpath*:spring/applicationContext*.xml,classpath*:spring/taskConfig-applicationContext.xml 1 diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml deleted file mode 100644 index b8260a5..0000000 --- a/.idea/artifacts/PgInterface.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - $PROJECT_DIR$/../out/artifacts/PgInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java index 7740d20..a5c9721 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/domain/PGTagMac.java @@ -1,6 +1,6 @@ package com.casic.PgInterface.overtimeInPG.domain; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +//import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java index 270703a..ef4da0d 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGPositionDto.java @@ -12,8 +12,25 @@ // public String TagId; // public String CoordinatesId; public String coordinatesName; - public String X; - public String Y; + + public String getX() { + return x; + } + + public void setX(String x) { + this.x = x; + } + + public String getY() { + return y; + } + + public void setY(String y) { + this.y = y; + } + + public String x; + public String y; public String positionUpdateTime; public String getTagMac() { @@ -56,21 +73,7 @@ this.coordinatesName = coordinatesName; } - public String getX() { - return X; - } - public void setX(String x) { - X = x; - } - - public String getY() { - return Y; - } - - public void setY(String y) { - Y = y; - } public String getPositionUpdateTime() { return positionUpdateTime; @@ -81,6 +84,16 @@ } + public PGPositionDto(PGTagPosition pgTagPosition) + { + this.setX(pgTagPosition.getX()); + this.setY(pgTagPosition.getY()); + this.setTagName(pgTagPosition.getTagName()); + this.setTagMac(pgTagPosition.getTagMac()); + this.setCoordinatesName(pgTagPosition.getCoordinatesName()); + this.setHostId(pgTagPosition.getHostId()); + this.setHostName(pgTagPosition.getHostName()); + } @Override public String toString() { @@ -90,8 +103,8 @@ ", hostId='" + hostId + '\'' + ", hostName='" + hostName + '\'' + ", coordinatesName='" + coordinatesName + '\'' + - ", X='" + X + '\'' + - ", Y='" + Y + '\'' + + ", X='" + x + '\'' + + ", Y='" + y + '\'' + ", postionUpdateTime='" + positionUpdateTime + '\'' + '}'; } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java index a7eea2c..6736304 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/dto/PGTagPositionDto.java @@ -2,6 +2,7 @@ import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; @JsonIgnoreProperties(ignoreUnknown = true) public class PGTagPositionDto { @@ -14,7 +15,22 @@ public String CoordinatesName; public String X; public String Y; - public String postionUpdateTime; + + public String getHostName() { + return HostName; + } + + public void setHostName(String hostName) { + HostName = hostName; + } + + public String getTagId() { + return TagId; + } + + public void setTagId(String tagId) { + TagId = tagId; + } public String getCoordinatesId() { return CoordinatesId; @@ -52,9 +68,8 @@ return postionUpdateTime; } - public void setPostionUpdateTime(String postionUpdateTime) { - this.postionUpdateTime = postionUpdateTime; - } + public String postionUpdateTime; + /* {"Success":true,"ErrorCode":0,"ErrorText":"","TagId":11003,"TagMac":"B0:8E:1A:50:54:88", @@ -65,19 +80,9 @@ "HostId":96,"HostGroupIds":[1,9],"HostStatusId":0,"HostExternalId":"5488","HostExternalInfo":"", "postionUpdateTime":"2019-05-22T11:09:31.9387103+08:00"} */ - - public String getTagId() { - return TagId; - } - - public void setTagId(String tagId) { - TagId = tagId; - } - public String getTagMac() { - return TagMac; - } - + return TagMac; +} public void setTagMac(String tagMac) { TagMac = tagMac; } @@ -85,10 +90,11 @@ public String getTagName() { return TagName; } - +// @JsonProperty(value ="tagName") public void setTagName(String tagName) { TagName = tagName; } + public String getHostId() { return HostId; } @@ -97,24 +103,20 @@ HostId = hostId; } - public String getHostName() { - return HostName; + + + public void setPostionUpdateTime(String postionUpdateTime) { + this.postionUpdateTime = postionUpdateTime; } - public void setHostName(String hostName) { - HostName = hostName; - } - - public PGTagPositionDto(PGTagPosition pgTagPosition){ + public PGTagPositionDto(PGTagPosition pgTagPosition) + { this.setHostId(pgTagPosition.getHostId()); - this.setCoordinatesName(pgTagPosition.getCoordinatesName()); - this.setHostName(pgTagPosition.getHostName()); this.setTagMac(pgTagPosition.getTagMac()); this.setTagName(pgTagPosition.getTagName()); - this.setX(pgTagPosition.getX()); - this.setY(pgTagPosition.getY()); } + @Override public String toString() { return "PGTagPositionDto{" + diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java index 3bd4025..af85d31 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/manager/PGTagPositionManager.java @@ -13,6 +13,7 @@ import javax.persistence.ParameterMode; import javax.persistence.criteria.CriteriaBuilder; +import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,10 +41,10 @@ return retMap; } - public int getMaxId(String tagMac) + public long getMaxId(String tagMac) { String hSql = "select max(id) from pg_tagposition where tagmac = '"+tagMac+"'"; - return ((Integer)this.getSession().createSQLQuery(hSql).uniqueResult()).intValue(); + return ((BigDecimal)this.getSession().createSQLQuery(hSql).uniqueResult()).longValue(); } } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java b/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java index a316bd0..d36e76b 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/task/SyncPGtask.java @@ -24,8 +24,8 @@ } public void getAllMac(){ tagmacRun.getAllMac(); - }; - public void getMacPosition() throws ParseException {tagmacRun.getMacPosition();}; + } + public void getMacPosition() throws ParseException {tagmacRun.getMacPosition();} public static void main(String[] args) { } } diff --git a/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java b/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java index 74f636b..11d3878 100644 --- a/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java +++ b/src/main/java/com/casic/PgInterface/overtimeInPG/web/PGInOutRecController.java @@ -1,63 +1,82 @@ -package com.casic.PgInterface.overtimeInPG.web; - - -import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; -import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; -import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; -import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; -import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; -import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; -import com.casic.PgInterface.patroler.domain.PgInPgPerson; -import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.Map; - -@Controller -@RequestMapping("rs") -//@RequestMapping("InOutPGrec") -public class PGInOutRecController { -@Resource -private PGInOutRecManager pgInOutRecManager; -@Resource -private PGTagPositionManager pgTagPositionManager; -@Resource -private PgInPgPersonManager pgInPgPersonManager; -@Resource -private PGTagMacManager pgTagMacManager; - - @RequestMapping("query") - @ResponseBody - public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom,@RequestParam(value = "dtTo", required = true) String dtTo) - { - Map resultMap = new HashMap<>(); - resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); - return resultMap; - } - - @RequestMapping("getRecentPosition") - @ResponseBody - public Map getRecentPosition(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) - { - Map resultMap = new HashMap<>(); - PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); - PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("ASSETCODE",pgInPgPerson.getAssetCode()); - PGTagPosition pgTagPosition = pgTagPositionManager.get(pgTagPositionManager.getMaxId(pgTagMac.getTagMac())); - resultMap.put("msg","success"); - resultMap.put("result",new PGTagPositionDto(pgTagPosition)); - return resultMap; - } - - @RequestMapping("getHistoryByTagmac") - @ResponseBody - public Map getHistoryByTagmac() - { - Map resultMap = new HashMap<>(); - return resultMap; - } -} +//package com.casic.PgInterface.overtimeInPG.web; +// +// +//import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; +//import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; +//import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDBDto; +//import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; +//import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; +//import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; +//import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; +//import com.casic.PgInterface.patroler.domain.PgInPgPerson; +//import com.casic.PgInterface.patroler.domain.PgInPgStatus; +//import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; +//import com.casic.PgInterface.patroler.manager.PgInPgStatusManager; +//import org.springframework.stereotype.Controller; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RequestParam; +//import org.springframework.web.bind.annotation.ResponseBody; +// +//import javax.annotation.Resource; +//import javax.ws.rs.POST; +//import javax.ws.rs.Path; +//import javax.ws.rs.Produces; +//import javax.ws.rs.core.MediaType; +//import java.util.*; +// +//@Controller +//@RequestMapping("rs") +////@RequestMapping("InOutPGrec") +//public class PGInOutRecController { +//@Resource +//private PGInOutRecManager pgInOutRecManager; +//@Resource +//private PGTagPositionManager pgTagPositionManager; +//@Resource +//private PgInPgPersonManager pgInPgPersonManager; +//@Resource +//private PGTagMacManager pgTagMacManager; +//@Resource +//private PgInPgStatusManager pgInPgStatusManager; +// +// @POST +// @Path("query") +// @Produces(MediaType.APPLICATION_JSON) +// public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom,@RequestParam(value = "dtTo", required = true) String dtTo) +// { +// Map resultMap = new HashMap<>(); +// resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); +// return resultMap; +// } +// +//// @RequestMapping("getRecentPosition") +//// @ResponseBody +// @POST +// @Path("getRecentPosition") +// @Produces(MediaType.APPLICATION_JSON) +// public Map getRecentPosition(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) +// { +// Map resultMap = new HashMap<>(); +// PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); +// PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("tagMac",pgInPgPerson.getAssetCode()); +// long maxId = pgTagPositionManager.getMaxId(pgTagMac.getTagMac()); +// PGTagPosition pgTagPosition = pgTagPositionManager.get(maxId); +// resultMap.put("msg","success"); +// resultMap.put("result",pgTagPosition); +//// resultMap.put("result",new PGTagPositionDBDto(pgTagPosition)); +// return resultMap; +// } +// +// @RequestMapping("getHistoryByTagmac") +// @ResponseBody +// public Map getHistoryByTagmac(@RequestParam(value = "inPgPersonId",required = true) long inPgPersonId) +// { +// Map resultMap = new HashMap<>(); +//// PgInPgStatus pgInPgStatus = pgInPgStatusManager.findUniqueBy("PGINPGPERSONID",inPgPersonId); +//// PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(inPgPersonId); +//// PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("ASSETCODE",pgInPgPerson.getAssetCode()); +// +// return resultMap; +// +// } +//} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 8b0e269..8fda3fe 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.patroler.domain.PgInPgStatus; import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; /** * Created by yxw on 2018/4/2. @@ -20,6 +22,7 @@ private String inTime;//入廊时间 private String outTime;//出廊时间 private String inPgNum;//入廊次数 + private int timeout;//超时标记 public Long getPersonId() { return personId; @@ -101,6 +104,13 @@ this.outTime = outTime; } + public int getTimeout() { + return timeout; + } + public void setTimeout(int timeout) { + this.timeout = timeout; + } + public PgInPgInfoDto(PgInPgPerson pgInPgPerson, PgInPgStatus pgInPgStatus, int inPgNum) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -110,8 +120,17 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) + this.setTimeout(0); + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) { this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(pgInPgStatus.getInTime()); + calendar.add(Calendar.HOUR,1); + Date expectDate = calendar.getTime(); + Date now = new Date(); + this.setTimeout( 0 > expectDate.compareTo(now) && pgInPgStatus.getOutTime() ==null ? 1:0); + } else this.setLastInTime(""); this.setInPgNum(String.valueOf(inPgNum)); @@ -124,10 +143,19 @@ this.setPhoneNumber(pgInPgStatus.getPgInPgPersonId().getPhoneNumber()); this.setPersonType(pgInPgStatus.getPgInPgPersonId().getPersonType()); this.setInTime(sdf.format(pgInPgStatus.getInTime())); + this.setTimeout(0); if (pgInPgStatus.getOutTime() != null) this.setOutTime(sdf.format(pgInPgStatus.getOutTime())); - else + else { this.setOutTime(""); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(pgInPgStatus.getInTime()); + calendar.add(Calendar.HOUR,1); + Date expectDate = calendar.getTime(); + Date now = new Date(); + this.setTimeout( 0 > expectDate.compareTo(now) && pgInPgStatus.getOutTime() ==null ? 1:0); + } } public PgInPgInfoDto() diff --git a/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java b/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java index 1f7b5a0..2d702e3 100644 --- a/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PGInOutRecRs.java @@ -1,13 +1,22 @@ package com.casic.PgInterface.rs; +import com.casic.PgInterface.overtimeInPG.domain.PGTagMac; +import com.casic.PgInterface.overtimeInPG.domain.PGTagPosition; +import com.casic.PgInterface.overtimeInPG.dto.PGPositionDto; +import com.casic.PgInterface.overtimeInPG.dto.PGTagPositionDto; import com.casic.PgInterface.overtimeInPG.manager.PGInOutRecManager; +import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; +import com.casic.PgInterface.overtimeInPG.manager.PGTagPositionManager; +import com.casic.PgInterface.patroler.domain.PgInPgPerson; +import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; +import com.casic.PgInterface.patroler.manager.PgInPgStatusManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.RequestParam; import javax.annotation.Resource; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import java.util.HashMap; import java.util.Map; @@ -18,16 +27,45 @@ @Resource private PGInOutRecManager pgInOutRecManager; + @Resource + private PGTagPositionManager pgTagPositionManager; + @Resource + private PgInPgPersonManager pgInPgPersonManager; + @Resource + private PGTagMacManager pgTagMacManager; + @Resource + private PgInPgStatusManager pgInPgStatusManager; + + private static Logger logger = LoggerFactory.getLogger(PGInOutRecRs.class); @POST @Path("query") @Produces(MediaType.APPLICATION_JSON) - public Map query(@RequestParam(value = "dtFrom", required = true) String dtFrom, - @RequestParam(value = "dtTo", required = true) String dtTo) + public Map query(@FormParam("dtFrom") String dtFrom, + @FormParam("dtTo") String dtTo) { Map resultMap = new HashMap<>(); resultMap = pgInOutRecManager.getInOutRec(dtFrom,dtTo); return resultMap; } + @POST + @Path("getRecentPosition") + @Produces(MediaType.APPLICATION_JSON) + public Map getRecentPosition(@FormParam("inPgPersonId") String inPgPersonId) + { + logger.info("param:"+inPgPersonId); + System.out.println("param:"+inPgPersonId); + Map resultMap = new HashMap<>(); + PgInPgPerson pgInPgPerson = pgInPgPersonManager.get(Long.valueOf(inPgPersonId)); + PGTagMac pgTagMac = pgTagMacManager.findUniqueBy("tagMac",pgInPgPerson.getAssetCode()); + long maxId = pgTagPositionManager.getMaxId(pgTagMac.getTagMac()); + PGTagPosition pgTagPosition = pgTagPositionManager.get(maxId); + resultMap.put("msg","success"); +// resultMap.put("result",pgTagPosition); + resultMap.put("result",new PGPositionDto(pgTagPosition)); + System.out.println("test"); + return resultMap; + } + } \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java index b506338..2abc334 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java @@ -2,6 +2,7 @@ import com.casic.PgInterface.devTable.dto.PgDeviceDto; import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.overtimeInPG.manager.PGTagMacManager; import com.casic.PgInterface.patroler.domain.PgInPgPerson; import com.casic.PgInterface.patroler.domain.PgInPgStatus; import com.casic.PgInterface.patroler.dto.PgInPgInfoDto; @@ -35,6 +36,9 @@ @Resource private PgDeviceManager pgDeviceManager; + @Resource + private PGTagMacManager pgTagMacManager; + /** * 派发工作证(新增入廊记录) */ @@ -54,6 +58,15 @@ try { PgInPgPerson pgInPgPerson = pgInPgPersonManager.getPersonByUserName(userName); +// int iTagMac = pgTagMacManager.getCount("select count(1) from pg_tagmac where tagmac = ?",assetCode); +// if (0==iTagMac) +// { +// result = "false"; +// msg = "设备mac信息不存在"; +// resultMap.put("result", result); +// resultMap.put("msg", msg); +// return resultMap; +// } if (pgInPgPerson == null) { PgInPgPerson pgInPgPerson1=new PgInPgPerson(); diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index f2bfed0..0ee4d73 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -35,7 +35,7 @@ org.springframework.web.servlet.DispatcherServlet contextConfigLocation - classpath*:spring/applicationContext*.xml + classpath*:spring/applicationContext*.xml,classpath*:spring/taskConfig-applicationContext.xml 1 diff --git "a/\345\205\245\345\273\212\345\234\250\345\273\212\344\272\272\345\221\230\345\256\232\344\275\21520190820.docx" "b/\345\205\245\345\273\212\345\234\250\345\273\212\344\272\272\345\221\230\345\256\232\344\275\21520190820.docx" index f227417..4ee2372 100644 --- "a/\345\205\245\345\273\212\345\234\250\345\273\212\344\272\272\345\221\230\345\256\232\344\275\21520190820.docx" +++ "b/\345\205\245\345\273\212\345\234\250\345\273\212\344\272\272\345\221\230\345\256\232\344\275\21520190820.docx" Binary files differ