Commit 2d27b404 authored by zhuangzhuang's avatar zhuangzhuang

3.27--线路增删改查

parent 65f8c992
......@@ -4,7 +4,7 @@ public class AddAlarmLogVo {
private String transportationNo;
private String routeName;
private String TDLSN;
private String description;
......@@ -15,9 +15,9 @@ public class AddAlarmLogVo {
public AddAlarmLogVo() {
}
public AddAlarmLogVo(String transportationNo, String routeName, String description, Float data, Long alarmTime) {
public AddAlarmLogVo(String transportationNo, String TDLSN, String description, Float data, Long alarmTime) {
this.transportationNo = transportationNo;
this.routeName = routeName;
this.TDLSN = TDLSN;
this.description = description;
this.data = data;
this.alarmTime = alarmTime;
......@@ -31,12 +31,12 @@ public class AddAlarmLogVo {
this.transportationNo = transportationNo;
}
public String getRouteName() {
return routeName;
public String getTDLSN() {
return TDLSN;
}
public void setRouteName(String routeName) {
this.routeName = routeName;
public void setTDLSN(String TDLSN) {
this.TDLSN = TDLSN;
}
public String getDescription() {
......
package com.example.tdl.domain.vo;
public class AddCircuitVo {
private String routeNumber;
private String startCountry;
private String startProvince;
private String startCity;
private String endCountry;
private String endProvince;
private String endCity;
private String transport;
private String rRemark;
import java.util.List;
private String startLongitude;
private String startLatitude;
private String startAddress;
public class AddCircuitVo {
private String endLongitude;
private List<AddressVo> addressVoList;
private String endLatitude;
private String SN;
private String endAddress;
private String TDLSN;
private String boxNo;
private String alarmType;
private String containerNo;
private String cargoNo;//货物编号
private String deliveryAddress;
private String plateNo;//车牌号
private String transportationType;
private String cargoName;
private String remark;
public String getrRemark() {
return rRemark;
}
public void setrRemark(String rRemark) {
this.rRemark = rRemark;
}
public String getRouteNumber() {
return routeNumber;
}
public void setRouteNumber(String routeNumber) {
this.routeNumber = routeNumber;
}
public String getStartCountry() {
return startCountry;
}
public void setStartCountry(String startCountry) {
this.startCountry = startCountry;
}
public String getStartProvince() {
return startProvince;
}
public void setStartProvince(String startProvince) {
this.startProvince = startProvince;
}
public String getStartCity() {
return startCity;
}
public void setStartCity(String startCity) {
this.startCity = startCity;
}
public String getEndCountry() {
return endCountry;
}
public void setEndCountry(String endCountry) {
this.endCountry = endCountry;
}
public String getEndProvince() {
return endProvince;
}
public void setEndProvince(String endProvince) {
this.endProvince = endProvince;
}
public String getEndCity() {
return endCity;
}
public void setEndCity(String endCity) {
this.endCity = endCity;
}
public String getTransport() {
return transport;
}
public void setTransport(String transport) {
this.transport = transport;
}
public String getStartLongitude() {
return startLongitude;
}
public void setStartLongitude(String startLongitude) {
this.startLongitude = startLongitude;
}
public String getStartLatitude() {
return startLatitude;
}
public void setStartLatitude(String startLatitude) {
this.startLatitude = startLatitude;
}
public String getStartAddress() {
return startAddress;
}
public void setStartAddress(String startAddress) {
this.startAddress = startAddress;
}
public String getEndLongitude() {
return endLongitude;
public List<AddressVo> getAddressVoList() {
return addressVoList;
}
public void setEndLongitude(String endLongitude) {
this.endLongitude = endLongitude;
public void setAddressVoList(List<AddressVo> addressVoList) {
this.addressVoList = addressVoList;
}
public String getEndLatitude() {
return endLatitude;
public String getSN() {
return SN;
}
public void setEndLatitude(String endLatitude) {
this.endLatitude = endLatitude;
public void setSN(String SN) {
this.SN = SN;
}
public String getEndAddress() {
return endAddress;
public String getTDLSN() {
return TDLSN;
}
public void setEndAddress(String endAddress) {
this.endAddress = endAddress;
public void setTDLSN(String TDLSN) {
this.TDLSN = TDLSN;
}
public String getBoxNo() {
return boxNo;
public String getAlarmType() {
return alarmType;
}
public void setBoxNo(String boxNo) {
this.boxNo = boxNo;
public void setAlarmType(String alarmType) {
this.alarmType = alarmType;
}
public String getContainerNo() {
return containerNo;
public String getCargoNo() {
return cargoNo;
}
public void setContainerNo(String containerNo) {
this.containerNo = containerNo;
public void setCargoNo(String cargoNo) {
this.cargoNo = cargoNo;
}
public String getDeliveryAddress() {
return deliveryAddress;
public String getPlateNo() {
return plateNo;
}
public void setDeliveryAddress(String deliveryAddress) {
this.deliveryAddress = deliveryAddress;
public void setPlateNo(String plateNo) {
this.plateNo = plateNo;
}
public String getTransportationType() {
return transportationType;
public String getCargoName() {
return cargoName;
}
public void setTransportationType(String transportationType) {
this.transportationType = transportationType;
public void setCargoName(String cargoName) {
this.cargoName = cargoName;
}
public String getRemark() {
......
package com.example.tdl.domain.vo;
public class AddRouteVo {
private String startCountry;
private String startProvince;
private String startCity;
private String endCountry;
private String endProvince;
private String endCity;
private String transport;
private String remark;
public String getStartCountry() {
return startCountry;
}
public void setStartCountry(String startCountry) {
this.startCountry = startCountry;
}
public String getStartProvince() {
return startProvince;
}
public void setStartProvince(String startProvince) {
this.startProvince = startProvince;
}
public String getStartCity() {
return startCity;
}
public void setStartCity(String startCity) {
this.startCity = startCity;
}
public String getEndCountry() {
return endCountry;
}
public void setEndCountry(String endCountry) {
this.endCountry = endCountry;
}
public String getEndProvince() {
return endProvince;
}
public void setEndProvince(String endProvince) {
this.endProvince = endProvince;
}
public String getEndCity() {
return endCity;
}
public void setEndCity(String endCity) {
this.endCity = endCity;
}
public String getTransport() {
return transport;
}
public void setTransport(String transport) {
this.transport = transport;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
package com.example.tdl.domain.vo;
public class AddUserRouteVo {
private String name;
private String country;
private String province;
private String city;
private String address;
private String longitude;
private String latitude;
private String remark;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
package com.example.tdl.domain.vo;
public class AddressVo {
private Integer sequence;
private String country;
private String city;
private String addressDetail;
private String lng;
private String lat;
private String postCode;
private Long expTime;
private Long compTime;//预计结束时间
public Integer getSequence() {
return sequence;
}
public void setSequence(Integer sequence) {
this.sequence = sequence;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getAddressDetail() {
return addressDetail;
}
public void setAddressDetail(String addressDetail) {
this.addressDetail = addressDetail;
}
public String getLng() {
return lng;
}
public void setLng(String lng) {
this.lng = lng;
}
public String getLat() {
return lat;
}
public void setLat(String lat) {
this.lat = lat;
}
public String getPostCode() {
return postCode;
}
public void setPostCode(String postCode) {
this.postCode = postCode;
}
public Long getExpTime() {
return expTime;
}
public void setExpTime(Long expTime) {
this.expTime = expTime;
}
public Long getCompTime() {
return compTime;
}
public void setCompTime(Long compTime) {
this.compTime = compTime;
}
}
......@@ -2,7 +2,7 @@ package com.example.tdl.domain.vo;
public class AlarmLogVo {
private String routeName;
private String TDLSN;
private String description;
......@@ -10,12 +10,12 @@ public class AlarmLogVo {
private Long alarmTime;
public String getRouteName() {
return routeName;
public String getTDLSN() {
return TDLSN;
}
public void setRouteName(String routeName) {
this.routeName = routeName;
public void setTDLSN(String TDLSN) {
this.TDLSN = TDLSN;
}
public String getDescription() {
......
package com.example.tdl.domain.vo;
public class CircuitTermVo {
private String transportationNo;
private String routeNumber;
private Integer alarmType;
private String cargoNo;
private Integer circuitState;
private String startCity;
private String endCity;
private Long startTimeMin;
private Long startTimeMax;
private Long endTimeMin;
private Long endTimeMax;
private Long startTime;
private Long endTime;
public String getTransportationNo() {
return transportationNo;
}
public void setTransportationNo(String transportationNo) {
this.transportationNo = transportationNo;
}
public String getRouteNumber() {
return routeNumber;
}
public void setRouteNumber(String routeNumber) {
this.routeNumber = routeNumber;
}
public Integer getAlarmType() {
return alarmType;
public String getCargoNo() {
return cargoNo;
}
public void setAlarmType(Integer alarmType) {
this.alarmType = alarmType;
public void setCargoNo(String cargoNo) {
this.cargoNo = cargoNo;
}
public Integer getCircuitState() {
......@@ -55,51 +25,19 @@ public class CircuitTermVo {
this.circuitState = circuitState;
}
public String getStartCity() {
return startCity;
}
public void setStartCity(String startCity) {
this.startCity = startCity;
}
public String getEndCity() {
return endCity;
}
public void setEndCity(String endCity) {
this.endCity = endCity;
}
public Long getStartTimeMin() {
return startTimeMin;
}
public void setStartTimeMin(Long startTimeMin) {
this.startTimeMin = startTimeMin;
}
public Long getStartTimeMax() {
return startTimeMax;
}
public void setStartTimeMax(Long startTimeMax) {
this.startTimeMax = startTimeMax;
}
public Long getEndTimeMin() {
return endTimeMin;
public Long getStartTime() {
return startTime;
}
public void setEndTimeMin(Long endTimeMin) {
this.endTimeMin = endTimeMin;
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public Long getEndTimeMax() {
return endTimeMax;
public Long getEndTime() {
return endTime;
}
public void setEndTimeMax(Long endTimeMax) {
this.endTimeMax = endTimeMax;
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
}
package com.example.tdl.domain.vo;
public class CircuitVo {
private String transportationNo;
private String routeName;
private String startLongitude;
private String startLatitude;
private String cargoNo;
private String startCity;
private String startTime;
private String endLongitude;
private String endLatitude;
private String endCity;
private String endTime;
private String transport;
private String boxNo;
private String containerNo;
private String deliveryAddress;
private String transportationType;
private int circuitState;
private String remark;
public String getTransportationNo() {
return transportationNo;
}
public void setTransportationNo(String transportationNo) {
this.transportationNo = transportationNo;
}
public String getRouteName() {
return routeName;
}
public void setRouteName(String routeName) {
this.routeName = routeName;
}
public String getStartLongitude() {
return startLongitude;
}
public void setStartLongitude(String startLongitude) {
this.startLongitude = startLongitude;
}
public String getStartLatitude() {
return startLatitude;
}
public void setStartLatitude(String startLatitude) {
this.startLatitude = startLatitude;
}
public String getStartCity() {
return startCity;
}
public void setStartCity(String startCity) {
this.startCity = startCity;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndLongitude() {
return endLongitude;
}
public void setEndLongitude(String endLongitude) {
this.endLongitude = endLongitude;
}
public String getEndLatitude() {
return endLatitude;
}
public void setEndLatitude(String endLatitude) {
this.endLatitude = endLatitude;
}
public String getEndCity() {
return endCity;
}
public void setEndCity(String endCity) {
this.endCity = endCity;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getTransport() {
return transport;
}
public void setTransport(String transport) {
this.transport = transport;
}
public String getBoxNo() {
return boxNo;
}
public void setBoxNo(String boxNo) {
this.boxNo = boxNo;
}
public String getContainerNo() {
return containerNo;
}
public void setContainerNo(String containerNo) {
this.containerNo = containerNo;
}
public String getDeliveryAddress() {
return deliveryAddress;
}
public void setDeliveryAddress(String deliveryAddress) {
this.deliveryAddress = deliveryAddress;
}
public String getTransportationType() {
return transportationType;
}
private Long startTime;
public void setTransportationType(String transportationType) {
this.transportationType = transportationType;
}
private Long endTime;
public int getCircuitState() {
return circuitState;
}
public void setCircuitState(int circuitState) {
this.circuitState = circuitState;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
......@@ -8,16 +8,14 @@ public class HomePageDataVo {
private Integer onRoute;//在途数量
private Integer complted;//已完成
private Integer alarmed;//报警数量
private Integer alarmed;//报警线路
private Integer delay;
private List<CircuitVo> routeVoList;//线路列表
private Integer bump;//颠簸异常
//报警列表
private List<AlarmLogVo> alarmLogVoList;
//报警原因分析
public Integer getSum() {
return sum;
......@@ -35,14 +33,6 @@ public class HomePageDataVo {
this.onRoute = onRoute;
}
public Integer getComplted() {
return complted;
}
public void setComplted(Integer complted) {
this.complted = complted;
}
public Integer getAlarmed() {
return alarmed;
}
......@@ -51,12 +41,20 @@ public class HomePageDataVo {
this.alarmed = alarmed;
}
public List<CircuitVo> getRouteVoList() {
return routeVoList;
public Integer getDelay() {
return delay;
}
public void setDelay(Integer delay) {
this.delay = delay;
}
public Integer getBump() {
return bump;
}
public void setRouteVoList(List<CircuitVo> routeVoList) {
this.routeVoList = routeVoList;
public void setBump(Integer bump) {
this.bump = bump;
}
public List<AlarmLogVo> getAlarmLogVoList() {
......
......@@ -4,7 +4,7 @@ public class ResultAlarmLog {
private String transportationNo;
private String routeName;
private String TDLSN;
private String description;
......@@ -20,12 +20,12 @@ public class ResultAlarmLog {
this.transportationNo = transportationNo;
}
public String getRouteName() {
return routeName;
public String getTDLSN() {
return TDLSN;
}
public void setRouteName(String routeName) {
this.routeName = routeName;
public void setTDLSN(String TDLSN) {
this.TDLSN = TDLSN;
}
public String getDescription() {
......
......@@ -3,52 +3,20 @@ package com.example.tdl.domain.vo;
public class ResultCircuitVo {
private String transportationNo;
private String routeNumber;
private String routeName;
private String startLongitude;
private String startLatitude;
private String cargoNo;//货物编号
private String startCity;
private String startAddress;
private Long startTime;
private String endLongitude;
private String endLatitude;
private String endCity;
private String endAddress;
private Long endTime;
private String transport;
private Integer circuitState;
private String alarmType;
private String boxNo;
private String containerNo;
private String deliveryAddress;
private String transportationType;
private int circuitState;
private String remark;
private Long createTime;
private String evaluate;
private String evaluateRemark;
public String getTransportationNo() {
return transportationNo;
}
......@@ -57,36 +25,12 @@ public class ResultCircuitVo {
this.transportationNo = transportationNo;
}
public String getRouteNumber() {
return routeNumber;
}
public void setRouteNumber(String routeNumber) {
this.routeNumber = routeNumber;
}
public String getRouteName() {
return routeName;
}
public void setRouteName(String routeName) {
this.routeName = routeName;
}
public String getStartLongitude() {
return startLongitude;
public String getCargoNo() {
return cargoNo;
}
public void setStartLongitude(String startLongitude) {
this.startLongitude = startLongitude;
}
public String getStartLatitude() {
return startLatitude;
}
public void setStartLatitude(String startLatitude) {
this.startLatitude = startLatitude;
public void setCargoNo(String cargoNo) {
this.cargoNo = cargoNo;
}
public String getStartCity() {
......@@ -97,14 +41,6 @@ public class ResultCircuitVo {
this.startCity = startCity;
}
public String getStartAddress() {
return startAddress;
}
public void setStartAddress(String startAddress) {
this.startAddress = startAddress;
}
public Long getStartTime() {
return startTime;
}
......@@ -113,22 +49,6 @@ public class ResultCircuitVo {
this.startTime = startTime;
}
public String getEndLongitude() {
return endLongitude;
}
public void setEndLongitude(String endLongitude) {
this.endLongitude = endLongitude;
}
public String getEndLatitude() {
return endLatitude;
}
public void setEndLatitude(String endLatitude) {
this.endLatitude = endLatitude;
}
public String getEndCity() {
return endCity;
}
......@@ -137,14 +57,6 @@ public class ResultCircuitVo {
this.endCity = endCity;
}
public String getEndAddress() {
return endAddress;
}
public void setEndAddress(String endAddress) {
this.endAddress = endAddress;
}
public Long getEndTime() {
return endTime;
}
......@@ -153,12 +65,12 @@ public class ResultCircuitVo {
this.endTime = endTime;
}
public String getTransport() {
return transport;
public Integer getCircuitState() {
return circuitState;
}
public void setTransport(String transport) {
this.transport = transport;
public void setCircuitState(Integer circuitState) {
this.circuitState = circuitState;
}
public String getAlarmType() {
......@@ -168,76 +80,4 @@ public class ResultCircuitVo {
public void setAlarmType(String alarmType) {
this.alarmType = alarmType;
}
public String getBoxNo() {
return boxNo;
}
public void setBoxNo(String boxNo) {
this.boxNo = boxNo;
}
public String getContainerNo() {
return containerNo;
}
public void setContainerNo(String containerNo) {
this.containerNo = containerNo;
}
public String getDeliveryAddress() {
return deliveryAddress;
}
public void setDeliveryAddress(String deliveryAddress) {
this.deliveryAddress = deliveryAddress;
}
public String getTransportationType() {
return transportationType;
}
public void setTransportationType(String transportationType) {
this.transportationType = transportationType;
}
public int getCircuitState() {
return circuitState;
}
public void setCircuitState(int circuitState) {
this.circuitState = circuitState;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public String getEvaluate() {
return evaluate;
}
public void setEvaluate(String evaluate) {
this.evaluate = evaluate;
}
public String getEvaluateRemark() {
return evaluateRemark;
}
public void setEvaluateRemark(String evaluateRemark) {
this.evaluateRemark = evaluateRemark;
}
}
\ No newline at end of file
package com.example.tdl.domain.vo;
import java.util.List;
public class UpdateCircuitInfo {
private String transportationNo;
private String routeNumber;
private String startCountry;
private String startProvince;
private String startCity;
private String endCountry;
private String endProvince;
private String endCity;
private String transport;
private List<AddressVo> addressVoList;
private String rRemark;
private String SN;
private String startLongitude;
private String TDLSN;
private String startLatitude;
private String alarmType;
private String startAddress;
private String cargoNo;//货物编号
private String endLongitude;
private String plateNo;//车牌号
private String endLatitude;
private String endAddress;
private String boxNo;
private String containerNo;
private String deliveryAddress;
private String transportationType;
private String cargoName;
private String remark;
......@@ -51,156 +29,60 @@ public class UpdateCircuitInfo {
this.transportationNo = transportationNo;
}
public String getRouteNumber() {
return routeNumber;
}
public void setRouteNumber(String routeNumber) {
this.routeNumber = routeNumber;
}
public String getStartCountry() {
return startCountry;
}
public void setStartCountry(String startCountry) {
this.startCountry = startCountry;
}
public String getStartProvince() {
return startProvince;
}
public void setStartProvince(String startProvince) {
this.startProvince = startProvince;
}
public String getStartCity() {
return startCity;
}
public void setStartCity(String startCity) {
this.startCity = startCity;
}
public String getEndCountry() {
return endCountry;
}
public void setEndCountry(String endCountry) {
this.endCountry = endCountry;
}
public String getEndProvince() {
return endProvince;
}
public void setEndProvince(String endProvince) {
this.endProvince = endProvince;
}
public String getEndCity() {
return endCity;
}
public void setEndCity(String endCity) {
this.endCity = endCity;
}
public String getTransport() {
return transport;
}
public void setTransport(String transport) {
this.transport = transport;
}
public String getrRemark() {
return rRemark;
}
public void setrRemark(String rRemark) {
this.rRemark = rRemark;
}
public String getStartLongitude() {
return startLongitude;
}
public void setStartLongitude(String startLongitude) {
this.startLongitude = startLongitude;
}
public String getStartLatitude() {
return startLatitude;
}
public void setStartLatitude(String startLatitude) {
this.startLatitude = startLatitude;
}
public String getStartAddress() {
return startAddress;
}
public void setStartAddress(String startAddress) {
this.startAddress = startAddress;
}
public String getEndLongitude() {
return endLongitude;
public List<AddressVo> getAddressVoList() {
return addressVoList;
}
public void setEndLongitude(String endLongitude) {
this.endLongitude = endLongitude;
public void setAddressVoList(List<AddressVo> addressVoList) {
this.addressVoList = addressVoList;
}
public String getEndLatitude() {
return endLatitude;
public String getSN() {
return SN;
}
public void setEndLatitude(String endLatitude) {
this.endLatitude = endLatitude;
public void setSN(String SN) {
this.SN = SN;
}
public String getEndAddress() {
return endAddress;
public String getTDLSN() {
return TDLSN;
}
public void setEndAddress(String endAddress) {
this.endAddress = endAddress;
public void setTDLSN(String TDLSN) {
this.TDLSN = TDLSN;
}
public String getBoxNo() {
return boxNo;
public String getAlarmType() {
return alarmType;
}
public void setBoxNo(String boxNo) {
this.boxNo = boxNo;
public void setAlarmType(String alarmType) {
this.alarmType = alarmType;
}
public String getContainerNo() {
return containerNo;
public String getCargoNo() {
return cargoNo;
}
public void setContainerNo(String containerNo) {
this.containerNo = containerNo;
public void setCargoNo(String cargoNo) {
this.cargoNo = cargoNo;
}
public String getDeliveryAddress() {
return deliveryAddress;
public String getPlateNo() {
return plateNo;
}
public void setDeliveryAddress(String deliveryAddress) {
this.deliveryAddress = deliveryAddress;
public void setPlateNo(String plateNo) {
this.plateNo = plateNo;
}
public String getTransportationType() {
return transportationType;
public String getCargoName() {
return cargoName;
}
public void setTransportationType(String transportationType) {
this.transportationType = transportationType;
public void setCargoName(String cargoName) {
this.cargoName = cargoName;
}
public String getRemark() {
......
package com.example.tdl.domain.vo;
public class UpdateRouteVo {
private String routeNumber;
private String routeName;
private String abbreviation;
private String startLongitude;
private String startLatitude;
private String startCountry;
private String startProvince;
private String startCity;
private String startAddress;
private String endLongitude;
private String endLatitude;
private String endCountry;
private String endProvince;
private String endCity;
private String endAddress;
private String transport;
private String transportRemark;
private String remark;
public String getRouteNumber() {
return routeNumber;
}
public void setRouteNumber(String routeNumber) {
this.routeNumber = routeNumber;
}
public String getRouteName() {
return routeName;
}
public void setRouteName(String routeName) {
this.routeName = routeName;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getStartLongitude() {
return startLongitude;
}
public void setStartLongitude(String startLongitude) {
this.startLongitude = startLongitude;
}
public String getStartLatitude() {
return startLatitude;
}
public void setStartLatitude(String startLatitude) {
this.startLatitude = startLatitude;
}
public String getStartCountry() {
return startCountry;
}
public void setStartCountry(String startCountry) {
this.startCountry = startCountry;
}
public String getStartProvince() {
return startProvince;
}
public void setStartProvince(String startProvince) {
this.startProvince = startProvince;
}
public String getStartCity() {
return startCity;
}
public void setStartCity(String startCity) {
this.startCity = startCity;
}
public String getStartAddress() {
return startAddress;
}
public void setStartAddress(String startAddress) {
this.startAddress = startAddress;
}
public String getEndLongitude() {
return endLongitude;
}
public void setEndLongitude(String endLongitude) {
this.endLongitude = endLongitude;
}
public String getEndLatitude() {
return endLatitude;
}
public void setEndLatitude(String endLatitude) {
this.endLatitude = endLatitude;
}
public String getEndCountry() {
return endCountry;
}
public void setEndCountry(String endCountry) {
this.endCountry = endCountry;
}
public String getEndProvince() {
return endProvince;
}
public void setEndProvince(String endProvince) {
this.endProvince = endProvince;
}
public String getEndCity() {
return endCity;
}
public void setEndCity(String endCity) {
this.endCity = endCity;
}
public String getEndAddress() {
return endAddress;
}
public void setEndAddress(String endAddress) {
this.endAddress = endAddress;
}
public String getTransport() {
return transport;
}
public void setTransport(String transport) {
this.transport = transport;
}
public String getTransportRemark() {
return transportRemark;
}
public void setTransportRemark(String transportRemark) {
this.transportRemark = transportRemark;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
......@@ -25,6 +25,8 @@ public class Circuit implements Serializable {
private String cargoNo;//货物编号
private String cargoName;
private String plateNo;//车牌号
private String deliveryAddress;
......@@ -101,6 +103,14 @@ public class Circuit implements Serializable {
this.cargoNo = cargoNo;
}
public String getCargoName() {
return cargoName;
}
public void setCargoName(String cargoName) {
this.cargoName = cargoName;
}
public String getPlateNo() {
return plateNo;
}
......
......@@ -13,12 +13,14 @@ public interface AlarmLogMapper {
List<AlarmLogVo> getAll();
//根据条件获取报警数据
List<AlarmLogVo> getAlarmLog(String time);
List<AlarmLogVo> getAlarmLog(Integer time);
//新增报警数据
int addAlarmLog(AddAlarmLogVo addAlarmLogVo);
List<ResultAlarmLog> getByTransportationNo(String transportationNo);
Integer getCount();
Integer getCount(Integer time);
Integer getBumpCount(Integer time);
}
......@@ -8,35 +8,39 @@ import java.util.Map;
@Mapper
public interface CircuitMapper {
// List<ResultCircuitVo> getAll();
//
List<ResultCircuitVo> getAll();
List<ResultCircuitVo> getByTerm(CircuitTermVo circuitTermVo);
// List<CircuitVo> getDistinct();
//
// List<ResultCircuitVo> getByTerm(CircuitTermVo circuitTermVo);
//
// int addCircuit(Map<Object,Object> map);
//
// int updateCircuit(Map<Object,Object> map);
//
// int updateEndTime(UpdateCircuitVo updateCircuitVo);
//
// int delCircuit(String transportationNo);
//
// ResultCircuitVo getByTransportationNo(String transportation);
//
// ResultGatewayVo getByNo(String transportationNo);
//
// Integer getOnRoute();
//
// Integer getComplted();
//
// Integer getCount();
//
// List<CircuitVo> getByTime(String time);
//
// List<ResultCircuitVo> getByContainerNo(String containerNo);
//
// int updateEvaluate(UpdateEvaluateVo updateEvaluateVo);
//
// List<ResultCircuitVo> getByCircuitState(Integer circuitState);
int addCircuit(Map<Object,Object> map);
int updateCircuit(Map<Object,Object> map);
int updateEndTime(UpdateCircuitVo updateCircuitVo);
int delCircuit(String transportationNo);
ResultCircuitVo getByTransportationNo(String transportation);
Integer getOnRoute(Integer time);
Integer getDelayCount(Long compTime);
Integer getComplted(Integer time);
Integer getCount(Integer time);
List<CircuitVo> getByTime(Integer time);
List<ResultCircuitVo> getByContainerNo(String cargoNo);
int updateEvaluate(UpdateEvaluateVo updateEvaluateVo);
List<ResultCircuitVo> getByCircuitState(Integer circuitState);
Integer getNo(String transportationNo);
ResultGatewayVo getByNo(String transportationNo);
}
......@@ -23,4 +23,6 @@ public interface GatewayMapper {
int getIdBySNAndType(@Param("SN") String SN,@Param("type") String type);
int deployGateway(Map<Object,Object> map);
String getBySN(String SN);
}
package com.example.tdl.mapper;
import com.example.tdl.domain.vo.ResultGatewayVo;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TDLLogMapper {
// ResultGatewayVo getByNo(String transportationNo);
ResultGatewayVo getByNo(String transportationNo);
}
......@@ -19,7 +19,7 @@ public class AlarmLogService {
return alarmLogMapper.getAll();
}
public List<AlarmLogVo> getAlarmLog(String time){
public List<AlarmLogVo> getAlarmLog(Integer time){
return alarmLogMapper.getAlarmLog(time);
}
......@@ -31,8 +31,12 @@ public class AlarmLogService {
return alarmLogMapper.getByTransportationNo(transportationNo);
}
public Integer getCount(){
return alarmLogMapper.getCount();
public Integer getCount(Integer time){
return alarmLogMapper.getCount(time);
}
public Integer getBumpCount(Integer time){
return alarmLogMapper.getBumpCount(time);
}
......
......@@ -3,7 +3,6 @@ package com.example.tdl.service;
import com.example.tdl.domain.vo.*;
import com.example.tdl.mapper.CircuitMapper;
import com.example.tdl.mapper.RoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -12,72 +11,81 @@ import java.util.Map;
@Service
public class CircuitService {
// @Autowired
// private CircuitMapper circuitMapper;
//
// public List<ResultCircuitVo> getAll(){
// return circuitMapper.getAll();
// }
//
@Autowired
private CircuitMapper circuitMapper;
public List<ResultCircuitVo> getAll(){
return circuitMapper.getAll();
}
// public List<CircuitVo> getDistinct(){
// return circuitMapper.getDistinct();
// }
//
// public List<ResultCircuitVo> getByTerm(CircuitTermVo circuitTermVo){
// return circuitMapper.getByTerm(circuitTermVo);
// }
//
// public int addCircuit(Map<Object,Object> map){
// return circuitMapper.addCircuit(map);
// }
//
// public int updateCircuit(Map<Object,Object> map){
// return circuitMapper.updateCircuit(map);
// }
//
// public int updateEndTime(UpdateCircuitVo updateCircuitVo){
// return circuitMapper.updateEndTime(updateCircuitVo);
// }
//
// public int delCircuit(String transportationNo){
// return circuitMapper.delCircuit(transportationNo);
// }
//
// public ResultCircuitVo getByTransportationNo(String transportationNo){
// return circuitMapper.getByTransportationNo(transportationNo);
// }
//
// public ResultGatewayVo getByNo(String transportationNo){
// return circuitMapper.getByNo(transportationNo);
// }
//
// public Integer getOnRoute(){
// return circuitMapper.getOnRoute();
// }
//
// public Integer getComplted(){
// return circuitMapper.getComplted();
// }
//
//
// public Integer getCount(){
// return circuitMapper.getCount();
// }
//
// public List<CircuitVo> getByTime(String time){
// return circuitMapper.getByTime(time);
// }
//
// public List<ResultCircuitVo> getByContainerNo(String containerNo){
// return circuitMapper.getByContainerNo(containerNo);
// }
//
// public int updateEvaluate(UpdateEvaluateVo updateEvaluateVo){
// return circuitMapper.updateEvaluate(updateEvaluateVo);
// }
//
// public List<ResultCircuitVo> getByCircuitState(Integer circuitState){
// return circuitMapper.getByCircuitState(circuitState);
// }
public List<ResultCircuitVo> getByTerm(CircuitTermVo circuitTermVo){
return circuitMapper.getByTerm(circuitTermVo);
}
public int addCircuit(Map<Object,Object> map){
return circuitMapper.addCircuit(map);
}
public int updateCircuit(Map<Object,Object> map){
return circuitMapper.updateCircuit(map);
}
public int updateEndTime(UpdateCircuitVo updateCircuitVo){
return circuitMapper.updateEndTime(updateCircuitVo);
}
public int delCircuit(String transportationNo){
return circuitMapper.delCircuit(transportationNo);
}
public ResultCircuitVo getByTransportationNo(String transportationNo){
return circuitMapper.getByTransportationNo(transportationNo);
}
public Integer getOnRoute(Integer time){
return circuitMapper.getOnRoute(time);
}
public Integer getDelayCount(Long compTime){
return circuitMapper.getDelayCount(compTime);
}
public Integer getComplted(Integer time){
return circuitMapper.getComplted(time);
}
public Integer getCount(Integer time){
return circuitMapper.getCount(time);
}
public List<CircuitVo> getByTime(Integer time){
return circuitMapper.getByTime(time);
}
public List<ResultCircuitVo> getByContainerNo(String cargoNo){
return circuitMapper.getByContainerNo(cargoNo);
}
public int updateEvaluate(UpdateEvaluateVo updateEvaluateVo){
return circuitMapper.updateEvaluate(updateEvaluateVo);
}
public List<ResultCircuitVo> getByCircuitState(Integer circuitState){
return circuitMapper.getByCircuitState(circuitState);
}
public Integer getNo(String transportationNo){
return circuitMapper.getNo(transportationNo);
}
public ResultGatewayVo getByNo(String transportationNo){
return circuitMapper.getByNo(transportationNo);
}
}
......@@ -10,40 +10,40 @@ import java.util.Map;
@Service
public class ConfigService {
// @Autowired
// private ConfigMapper configMapper;
//
// //绑定getway和tdl
// /* public int addConfig(ConfigVo configVo){
// return configMapper.addConfig(configVo);
// }*/
//
// public int addConfig(Map<Object,Object> map){
// return configMapper.addConfig(map);
// }
//
//
// //获取绑定的数据信息
// public ConfigVo getConfig(String gSN,String gType){
// return configMapper.getConfig(gSN,gType);
// }
//
// //绑定成功
// public int bindiSuccess(String gSN,String gType,Integer resp){
// return configMapper.bindiSuccess(gSN,gType,resp);
// }
//
// //解绑getWay和tdl
//// public int updateConfig(String gSN,String gType,Boolean untie ){
//// return configMapper.updateConfig(gSN,gType,untie);
//// }
//
// public int updateConfig(Map<Object,Object> map ){
// return configMapper.updateConfig(map);
@Autowired
private ConfigMapper configMapper;
//绑定getway和tdl
/* public int addConfig(ConfigVo configVo){
return configMapper.addConfig(configVo);
}*/
public int addConfig(Map<Object,Object> map){
return configMapper.addConfig(map);
}
//获取绑定的数据信息
public ConfigVo getConfig(String gSN,String gType){
return configMapper.getConfig(gSN,gType);
}
//绑定成功
public int bindiSuccess(String gSN,String gType,Integer resp){
return configMapper.bindiSuccess(gSN,gType,resp);
}
//解绑getWay和tdl
// public int updateConfig(String gSN,String gType,Boolean untie ){
// return configMapper.updateConfig(gSN,gType,untie);
// }
//
// //解绑成功
// public int delConfig(String gSN,String gType){
// return configMapper.delConfig(gSN,gType);
// }
public int updateConfig(Map<Object,Object> map ){
return configMapper.updateConfig(map);
}
//解绑成功
public int delConfig(String gSN,String gType){
return configMapper.delConfig(gSN,gType);
}
}
......@@ -45,4 +45,8 @@ public class GatewayService {
public int deployGateway(Map<Object,Object> map){
return gatewayMapper.deployGateway(map);
}
public String getBySN(String SN){
return gatewayMapper.getBySN(SN);
}
}
package com.example.tdl.service;
import com.example.tdl.domain.vo.ResultRouteVo;
import com.example.tdl.domain.vo.RouteTermVo;
import com.example.tdl.domain.vo.UpdateRouteVo;
import com.example.tdl.entity.Route;
import com.example.tdl.mapper.RoleMapper;
import com.example.tdl.mapper.RouteMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class RouteService {
......
......@@ -9,11 +9,11 @@ import org.springframework.stereotype.Service;
@Service
public class TDLLogService {
// @Autowired
// private TDLLogMapper tdlLogMapper;
//
// public ResultGatewayVo getByNo(String transportationNo){
// return tdlLogMapper.getByNo(transportationNo);
// }
@Autowired
private TDLLogMapper tdlLogMapper;
public ResultGatewayVo getByNo(String transportationNo){
return tdlLogMapper.getByNo(transportationNo);
}
}
......@@ -25,15 +25,6 @@ public class AlarmLogController {
@Autowired
private AlarmLogService alarmLogServcie;
//获取所有的报警数据
@GetMapping("/getAll")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public Object getAll(){
return alarmLogServcie.getAll();
}
//新增报警消息
@PostMapping("/addAlarmLog")
@ApiImplicitParams({
......@@ -45,7 +36,7 @@ public class AlarmLogController {
fb.setMessage("运输编号不能为空");
return gson.toJson(fb);
}
if(StringUtils.isEmpty(addAlarmLogVo.getRouteName())){
if(StringUtils.isEmpty(addAlarmLogVo.getTDLSN())){
fb.setCode(0);
fb.setMessage("路由名称不能为空");
return gson.toJson(fb);
......
......@@ -6,7 +6,8 @@ import com.alibaba.fastjson.JSONObject;
import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.*;
import com.example.tdl.service.CircuitService;
import com.example.tdl.service.RouteService;
import com.example.tdl.service.GatewayService;
import com.example.tdl.service.TDLDeviceService;
import com.example.tdl.service.redis.TokenRedisService;
import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam;
......@@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
......@@ -36,754 +38,674 @@ public class CircuitController {
Gson gson=new Gson();
// @Autowired
// private CircuitService circuitService;
//
// @Autowired
// private RouteService routeService;
//
// @Autowired
// private TokenRedisService tokenRedisService;
//
//
// //获取线路信息
// @ApiOperation(value = "获取线路信息",notes = "获取线路信息,返回值说明:" +
// " transportationNo:运输编号," +
// " routeNumber:路由编号," +
// " routeName:路由名" +
// " startLongitude:起运经度," +
// " startLatitude:起运纬度," +
// " startCity:起运城市," +
// " startAddress:起运具体地址," +
// " startTime:起运时间," +
// " endLongitude:目的经度," +
// " endLatitude:目的纬度," +
// " endCity:目的城市," +
// " endAddress:目的具体地址," +
// " endTime:目的时间," +
// " transport:运输方式," +
// " alarmType:预警类型," +
// " boxNo:箱单号," +
// " containerNo:集装箱号," +
// " deliveryAddress:交付地址," +
// " transportationType:运输类型" +
// " circuitState:线路状态(0未开始,1运输中,2完成)," +
// " remark:备注," +
// " createTime:创建线路时间" +
// " evaluate:评分," +
// " evaluateRemark:评分备注")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// @RequestMapping(value="/getAll",method = RequestMethod.GET)
// public Object getAll(){
// return circuitService.getAll();
// }
//
// //根据条件查询
// @ApiOperation(value = "根据条件查询",notes = "根据条件查询:" +
// " transportationNo:运输编号," +
// " routeNumber:路由编号," +
// " alarmType:预警情况(正常传0,预警传1)" +
// " circuitState:线路状态(0未开始,1运输中,2完成)," +
// " startCity:起运城市," +
// " endCity:目的城市," +
// " startTimeMin:起运时间的最小值," +
// " startTimeMax:起运时间的最大值," +
// " endTimeMin:到达时间的最小值," +
// " endTimeMax:到达时间的最大值。" +
// "返回值说明:" +
// " transportationNo:运输编号," +
// " routeNumber:路由编号," +
// " routeName:路由名" +
// " startLongitude:起运经度," +
// " startLatitude:起运纬度," +
// " startCity:起运城市," +
// " startAddress:起运具体地址," +
// " startTime:起运时间," +
// " endLongitude:目的经度," +
// " endLatitude:目的纬度," +
// " endCity:目的城市," +
// " endAddress:目的具体地址," +
// " endTime:目的时间," +
// " transport:运输方式," +
// " alarmType:预警类型," +
// " boxNo:箱单号," +
// " containerNo:集装箱号," +
// " deliveryAddress:交付地址," +
// " transportationType:运输类型" +
// " circuitState:线路状态(0未开始,1运输中,2完成)," +
// " remark:备注," +
// " createTime:创建线路时间," +
// " evaluate:评分," +
// " evaluateRemark:评分备注")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// @RequestMapping(value="/getByTerm",method = RequestMethod.POST)
// public Object getByTerm(@RequestBody CircuitTermVo circuitTermVo){
// if(circuitTermVo.getStartTimeMin()!=null&&circuitTermVo.getStartTimeMax()==null){
// fb.setCode(0);
// fb.setMessage("起运时间的最大值不能为空");
// return gson.toJson(fb);
// }
// if(circuitTermVo.getEndTimeMin()!=null&&circuitTermVo.getEndTimeMax()==null){
// fb.setCode(0);
// fb.setMessage("到达时间的最大值不能为空");
// return gson.toJson(fb);
// }
// return circuitService.getByTerm(circuitTermVo);
// }
//
// //添加线路信息
// @ApiOperation(value = "添加线路信息",notes = "添加线路信息,如果是选择一条之前的已经建立的线路," +
// "则只用传routeNumber,startLongitude,startLatitude,startAddress,startTime,endLongitude,endLatitude,endAddress,endTime,boxNo,containerNo,deliveryAddress,transportationType,remark," +
// "如果是新建线路,则除了routeNumber都要传,传值说明:" +
// " routeNumber:路由编号," +
// " startCountry:起运国," +
// " startProvince:起运省," +
// " startCity:起运市," +
// " endCountry:目的国," +
// " endProvince:目的省," +
// " endCity:目的市," +
// " transport:运输方式," +
// " createTime:创建时间," +
// " updateTime:修改时间," +
// " rRemark:路由备注," +
// " startLongitude:起运经度," +
// " startLatitude:起运纬度," +
// " startAddress:起运具体地址," +
// " startTime:起运时间," +
// " endLongitude:目的经度," +
// " endLatitude:目的纬度," +
// " endAddress:目的具体地址," +
// " endTime:目的时间," +
// " boxNo:箱单号," +
// " containerNo:集装箱号," +
// " deliveryAddress:交付地址," +
// " transportationType:运输类型," +
// " remark:备注")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// @RequestMapping(value="/addCircuit",method = RequestMethod.POST)
// public Object addCircuit(@RequestBody AddCircuitVo addCircuitVo){
// if(StringUtils.isEmpty(addCircuitVo.getStartCountry())){
// fb.setCode(0);
// fb.setMessage("起运国不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(addCircuitVo.getStartCity())){
// fb.setCode(0);
// fb.setMessage("起运市不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(addCircuitVo.getEndCountry())){
// fb.setCode(0);
// fb.setMessage("目的国不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(addCircuitVo.getEndCity())){
// fb.setCode(0);
// fb.setMessage("目的市不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(addCircuitVo.getTransport())){
// fb.setCode(0);
// fb.setMessage("运输方式不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(addCircuitVo.getStartLongitude())){
// fb.setCode(0);
// fb.setMessage("起运经度不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(addCircuitVo.getStartLatitude())){
// fb.setCode(0);
// fb.setMessage("起运纬度不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(addCircuitVo.getStartAddress())){
// fb.setCode(0);
// fb.setMessage("起运具体地址不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(addCircuitVo.getEndLongitude())){
// fb.setCode(0);
// fb.setMessage("目的经度不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(addCircuitVo.getEndLatitude())){
// fb.setCode(0);
// fb.setMessage("目的纬度不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(addCircuitVo.getEndAddress())){
// fb.setCode(0);
// fb.setMessage("目的具体地址不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(addCircuitVo.getBoxNo())){
// fb.setCode(0);
// fb.setMessage("箱单号不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(addCircuitVo.getContainerNo())){
// fb.setCode(0);
// fb.setMessage("集装箱号/车牌号不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(addCircuitVo.getDeliveryAddress())){
// fb.setCode(0);
// fb.setMessage("交付地址不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(addCircuitVo.getTransportationType())){
// fb.setCode(0);
// fb.setMessage("运输类型不能为空");
// return gson.toJson(fb);
// }
// if(!addCircuitVo.getStartLatitude().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){
// fb.setCode(0);
// fb.setMessage("纬度的范围为-90~90");
// return gson.toJson(fb);
// }
// if(!addCircuitVo.getStartLongitude().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) {
// fb.setCode(0);
// fb.setMessage("经度的范围为-180~180");
// return gson.toJson(fb);
// }
// if(!addCircuitVo.getEndLatitude().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){
// fb.setCode(0);
// fb.setMessage("纬度的范围为-90~90");
// return gson.toJson(fb);
// }
// if(!addCircuitVo.getEndLongitude().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) {
// fb.setCode(0);
// fb.setMessage("经度的范围为-180~180");
// return gson.toJson(fb);
// }
// if (!addCircuitVo.getTransport().equals("铁路")&&
// !addCircuitVo.getTransport().equals("汽运")&&
// !addCircuitVo.getTransport().equals("海运")&&
// !addCircuitVo.getTransport().equals("空运")&&
// !addCircuitVo.getTransport().equals("快递")){
// fb.setCode(0);
// fb.setMessage("请选择正确的运输方式");
// return gson.toJson(fb);
// }
// if (!addCircuitVo.getDeliveryAddress().equals("港口")&&
// !addCircuitVo.getDeliveryAddress().equals("仓库")&&
// !addCircuitVo.getDeliveryAddress().equals("站点")){
// fb.setCode(0);
// fb.setMessage("请输入正确的交付地址");
// return gson.toJson(fb);
// }
// if (!addCircuitVo.getTransportationType().equals("本地运输")&&
// !addCircuitVo.getTransportationType().equals("国际运输")){
// fb.setCode(0);
// fb.setMessage("请输入正确的运输类型");
// return gson.toJson(fb);
// }
// Date day=new Date();
// SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
// Map<Object,Object> map=new HashMap<>();
// map.put("startCountry",addCircuitVo.getStartCountry());
// map.put("startProvince",addCircuitVo.getStartProvince());
// map.put("startCity",addCircuitVo.getStartCity());
// map.put("endCountry",addCircuitVo.getEndCountry());
// map.put("endProvince",addCircuitVo.getEndProvince());
// map.put("endCity",addCircuitVo.getEndCity());
// map.put("transport",addCircuitVo.getTransport());
// map.put("createTime",System.currentTimeMillis());
// map.put("updateTime",System.currentTimeMillis());
// map.put("rRemark",addCircuitVo.getrRemark());
// map.put("startLongitude",addCircuitVo.getStartLongitude());
// map.put("startLatitude",addCircuitVo.getStartLatitude());
// map.put("startAddress",addCircuitVo.getStartAddress());
// map.put("startTime",System.currentTimeMillis());
// map.put("endLongitude",addCircuitVo.getEndLongitude());
// map.put("endLatitude",addCircuitVo.getEndLatitude());
// map.put("endAddress",addCircuitVo.getEndAddress());
// map.put("endTime",0);
// map.put("boxNo",addCircuitVo.getBoxNo());
// map.put("containerNo",addCircuitVo.getContainerNo());
// map.put("deliveryAddress",addCircuitVo.getDeliveryAddress());
// map.put("transportationType",addCircuitVo.getTransportationType());
// map.put("remark",addCircuitVo.getRemark());
// String transportationNo = "";
// if (addCircuitVo.getTransportationType().equals("国际运输")){
// transportationNo="HUN"+df.format(day);
// }
// if (addCircuitVo.getTransportationType().equals("本地运输")){
// transportationNo="CHN"+df.format(day);
// }
// String routeNumber="RT"+df.format(day);
// String routeName=addCircuitVo.getStartCountry()+addCircuitVo.getStartCity()+"_"+addCircuitVo.getEndCountry()+addCircuitVo.getEndCity();
// if (addCircuitVo.getTransport().equals("汽运")){
// routeName=routeName+"_汽运";
// routeNumber=routeNumber+"G";
// transportationNo=transportationNo+"G";
// }
// if (addCircuitVo.getTransport().equals("铁路")){
// routeName=routeName+"_铁路";
// routeNumber=routeNumber+"T";
// transportationNo=transportationNo+"T";
// }
// if (addCircuitVo.getTransport().equals("空运")){
// routeName=routeName+"_空运";
// routeNumber=routeNumber+"K";
// transportationNo=transportationNo+"K";
// }
// if (addCircuitVo.getTransport().equals("快递")){
// routeName=routeName+"_快递";
// routeNumber=routeNumber+"D";
// transportationNo=transportationNo+"D";
// }
// if (addCircuitVo.getTransport().equals("海运")){
// routeName=routeName+"_海运";
// routeNumber=routeNumber+"H";
// transportationNo=transportationNo+"H";
// }
// routeNumber=routeNumber+((int)(Math.random()*(9999-1000+1))+1000);
// if (routeService.getByRouteNumber(routeNumber)>0){
// while (routeService.getByRouteNumber(routeNumber)>0){
// routeNumber=routeNumber+((int)(Math.random()*(9999-1000+1))+1000);
// }
// }
// transportationNo=transportationNo+((int)(Math.random()*(9999-1000+1))+1000);
// if (circuitService.getByTransportationNo(transportationNo)!=null){
// while (routeService.getByRouteNumber(transportationNo)>0){
// transportationNo=transportationNo+((int)(Math.random()*(9999-1000+1))+1000);
// }
// }
// map.put("routeName",routeName);
// map.put("routeNumber",routeNumber);
// map.put("transportationNo",transportationNo);
// circuitService.addCircuit(map);
// Map<Object,Object> msg=new HashMap<>();
// msg.put("msg",map.get("msg"));
// if (msg.get("msg").equals("添加线路成功")){
// fb.setCode(1);
// fb.setMessage("添加线路成功");
// }else {
// fb.setCode(0);
// fb.setMessage(msg.get("msg").toString());
// }
// return gson.toJson(fb);
// }
//
// //修改线路结束时间
// @ApiOperation(value = "修改线路结束时间",notes = "修改线路结束时间,传值说明:" +
// " transportationNo:运输编号," +
// " endTime:目的时间 " )
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// @RequestMapping(value="/updateEndTime",method = RequestMethod.POST)
// public Object updateEndTime(@RequestBody UpdateCircuitVo updateCircuitVo){
// if (StringUtils.isEmpty(updateCircuitVo.getTransportationNo())){
// fb.setCode(0);
// fb.setMessage("需要修改的运输编号不能为空");
// return gson.toJson(fb);
// }
// if (updateCircuitVo.getEndTime()==null){
// fb.setCode(0);
// fb.setMessage("线路结束时间不能为空");
// return gson.toJson(fb);
// }
// if (circuitService.getByTransportationNo(updateCircuitVo.getTransportationNo()).getCircuitState()!=2){
// fb.setCode(0);
// fb.setMessage("线路未完成");
// return gson.toJson(fb);
// }
// int a = circuitService.updateEndTime(updateCircuitVo);
// if (a>0){
// fb.setCode(1);
// fb.setMessage("修改线路结束时间成功");
// }else{
// fb.setCode(0);
// fb.setMessage("修改线路结束时间失败");
// }
// return gson.toJson(fb);
// }
//
// //修改线路信息
// @ApiOperation(value = "修改线路信息",notes = "修改线路信息,传值说明:" +
// " transportationNo:需要修改的运输编号," +
// " routeNumber:修改之后的路由编号(如果没有就是空)," +
// " startCountry:起运国," +
// " startProvince:起运省," +
// " startCity:起运市," +
// " endCountry:目的国," +
// " endProvince:目的省," +
// " endCity:目的市," +
// " transport:运输方式," +
// " createTime:创建时间," +
// " updateTime:修改时间," +
// " startLongitude:起运经度," +
// " startLatitude:起运纬度," +
// " startAddress:起运具体地址," +
// " startTime:起运时间," +
// " endLongitude:目的经度," +
// " endLatitude:目的纬度," +
// " endAddress:目的具体地址," +
// " endTime:目的时间," +
// " boxNo:箱单号," +
// " containerNo:集装箱号," +
// " deliveryAddress:交付地址," +
// " transportationType:运输类型," +
// " remark:备注")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// @RequestMapping(value="/updateCircuit",method = RequestMethod.POST)
// public Object updateCircuit(@RequestBody UpdateCircuitInfo updateCircuitInfo){
// if (StringUtils.isEmpty(updateCircuitInfo.getTransportationNo())){
// fb.setCode(0);
// fb.setMessage("需要修改的运输编号不能为空");
// return gson.toJson(fb);
// }
// if(StringUtils.isEmpty(updateCircuitInfo.getStartCountry())){
// fb.setCode(0);
// fb.setMessage("起运国不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(updateCircuitInfo.getStartCity())){
// fb.setCode(0);
// fb.setMessage("起运市不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(updateCircuitInfo.getEndCountry())){
// fb.setCode(0);
// fb.setMessage("目的国不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(updateCircuitInfo.getEndCity())){
// fb.setCode(0);
// fb.setMessage("目的市不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(updateCircuitInfo.getTransport())){
// fb.setCode(0);
// fb.setMessage("运输方式不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(updateCircuitInfo.getStartLongitude())){
// fb.setCode(0);
// fb.setMessage("起运经度不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(updateCircuitInfo.getStartLatitude())){
// fb.setCode(0);
// fb.setMessage("起运纬度不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(updateCircuitInfo.getStartAddress())){
// fb.setCode(0);
// fb.setMessage("起运具体地址不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(updateCircuitInfo.getEndLongitude())){
// fb.setCode(0);
// fb.setMessage("目的经度不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(updateCircuitInfo.getEndLatitude())){
// fb.setCode(0);
// fb.setMessage("目的纬度不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(updateCircuitInfo.getEndAddress())){
// fb.setCode(0);
// fb.setMessage("目的具体地址不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(updateCircuitInfo.getBoxNo())){
// fb.setCode(0);
// fb.setMessage("箱单号不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(updateCircuitInfo.getContainerNo())){
// fb.setCode(0);
// fb.setMessage("集装箱号/车牌号不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(updateCircuitInfo.getDeliveryAddress())){
// fb.setCode(0);
// fb.setMessage("交付地址不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(updateCircuitInfo.getTransportationType())){
// fb.setCode(0);
// fb.setMessage("运输类型不能为空");
// return gson.toJson(fb);
// }
// if(!updateCircuitInfo.getStartLatitude().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){
// fb.setCode(0);
// fb.setMessage("纬度的范围为-90~90");
// return gson.toJson(fb);
// }
// if(!updateCircuitInfo.getStartLongitude().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) {
// fb.setCode(0);
// fb.setMessage("经度的范围为-180~180");
// return gson.toJson(fb);
// }
// if(!updateCircuitInfo.getEndLatitude().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){
// fb.setCode(0);
// fb.setMessage("纬度的范围为-90~90");
// return gson.toJson(fb);
// }
// if(!updateCircuitInfo.getEndLongitude().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) {
// fb.setCode(0);
// fb.setMessage("经度的范围为-180~180");
// return gson.toJson(fb);
// }
// if (!updateCircuitInfo.getTransport().equals("铁路")&&
// !updateCircuitInfo.getTransport().equals("汽运")&&
// !updateCircuitInfo.getTransport().equals("海运")&&
// !updateCircuitInfo.getTransport().equals("空运")&&
// !updateCircuitInfo.getTransport().equals("快递")){
// fb.setCode(0);
// fb.setMessage("请选择正确的运输方式");
// return gson.toJson(fb);
// }
// if (!updateCircuitInfo.getDeliveryAddress().equals("港口")&&
// !updateCircuitInfo.getDeliveryAddress().equals("仓库")&&
// !updateCircuitInfo.getDeliveryAddress().equals("站点")){
// fb.setCode(0);
// fb.setMessage("请输入正确的交付地址");
// return gson.toJson(fb);
// }
// if (!updateCircuitInfo.getTransportationType().equals("本地运输")&&
// !updateCircuitInfo.getTransportationType().equals("国际运输")){
// fb.setCode(0);
// fb.setMessage("请输入正确的运输类型");
// return gson.toJson(fb);
// }
// if(circuitService.getByTransportationNo(updateCircuitInfo.getTransportationNo()).getCircuitState()!=0){
// fb.setCode(0);
// fb.setMessage("线路只能在未开始运输时才能修改");
// return gson.toJson(fb);
// }
// String routeNumber="";
// Date day=new Date();
// SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
// Map<Object,Object> map=new HashMap<>();
// map.put("routeNumber",updateCircuitInfo.getRouteNumber());
// map.put("startCountry",updateCircuitInfo.getStartCountry());
// map.put("startProvince",updateCircuitInfo.getStartProvince());
// map.put("startCity",updateCircuitInfo.getStartCity());
// map.put("endCountry",updateCircuitInfo.getEndCountry());
// map.put("endProvince",updateCircuitInfo.getEndProvince());
// map.put("endCity",updateCircuitInfo.getEndCity());
// map.put("transport",updateCircuitInfo.getTransport());
// map.put("createTime",System.currentTimeMillis());
// map.put("updateTime",System.currentTimeMillis());
// map.put("transportationNo",updateCircuitInfo.getTransportationNo());
// map.put("startLongitude",updateCircuitInfo.getStartLongitude());
// map.put("startLatitude",updateCircuitInfo.getStartLatitude());
// map.put("startAddress",updateCircuitInfo.getStartAddress());
// map.put("startTime",System.currentTimeMillis());
// map.put("endLongitude",updateCircuitInfo.getEndLongitude());
// map.put("endLatitude",updateCircuitInfo.getEndLatitude());
// map.put("endAddress",updateCircuitInfo.getEndAddress());
// map.put("endTime",0);
// map.put("boxNo",updateCircuitInfo.getBoxNo());
// map.put("containerNo",updateCircuitInfo.getContainerNo());
// map.put("deliveryAddress",updateCircuitInfo.getDeliveryAddress());
// map.put("transportationType",updateCircuitInfo.getTransportationType());
// map.put("remark",updateCircuitInfo.getRemark());
// if (StringUtils.isEmpty(updateCircuitInfo.getRouteNumber())){
// routeNumber="RT"+df.format(day);
// String routeName=updateCircuitInfo.getStartCountry()+updateCircuitInfo.getStartCity()+"_"+updateCircuitInfo.getEndCountry()+updateCircuitInfo.getEndCity();
// if (updateCircuitInfo.getTransport().equals("汽运")){
// routeName=routeName+"_汽运";
// routeNumber=routeNumber+"G";
// }
// if (updateCircuitInfo.getTransport().equals("铁路")){
// routeName=routeName+"_铁路";
// routeNumber=routeNumber+"T";
// }
// if (updateCircuitInfo.getTransport().equals("空运")){
// routeName=routeName+"_空运";
// routeNumber=routeNumber+"K";
// }
// if (updateCircuitInfo.getTransport().equals("快递")){
// routeName=routeName+"_快递";
// routeNumber=routeNumber+"D";
// }
// if (updateCircuitInfo.getTransport().equals("海运")){
// routeName=routeName+"_海运";
// routeNumber=routeNumber+"H";
// }
// routeNumber=routeNumber+((int)(Math.random()*(9999-1000+1))+1000);
// if (routeService.getByRouteNumber(routeNumber)>0){
// while (routeService.getByRouteNumber(routeNumber)>0){
// routeNumber=routeNumber+((int)(Math.random()*(9999-1000+1))+1000);
// }
// }
// map.put("routeName",routeName);
// map.put("routeNumber",routeNumber);
// }
// circuitService.updateCircuit(map);
// Map<Object,Object> msg=new HashMap<>();
// msg.put("msg",map.get("msg"));
// if (msg.get("msg").equals("修改线路成功")){
// fb.setCode(1);
// fb.setMessage("修改线路成功");
// }else{
// fb.setCode(0);
// fb.setMessage(msg.get("msg").toString());
// }
// return gson.toJson(fb);
// }
//
// //删除线路
// @ApiOperation(value = "删除线路",notes = "删除线路,传值说明:" +
// " transportationNo:运输编号" )
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// @RequestMapping(value="/delCircuit",method = RequestMethod.POST)
// public Object delCircuit(@RequestBody String transportationNo){
// JSONObject jsonObject= JSON.parseObject(transportationNo);
// transportationNo=(String)jsonObject.get("transportationNo");
// if (StringUtils.isEmpty(transportationNo)){
// fb.setCode(0);
// fb.setMessage("需要删除的运输编号不能为空");
// return gson.toJson(fb);
// }
// if (circuitService.getByTransportationNo(transportationNo).getCircuitState()==1){
// fb.setCode(0);
// fb.setMessage("线路运输中不能删除");
// return gson.toJson(fb);
// }
// int a = circuitService.delCircuit(transportationNo);
// if (a>0){
// fb.setCode(1);
// fb.setMessage("删除线路成功");
// }else{
// fb.setCode(0);
// fb.setMessage("删除线路失败");
// }
// return gson.toJson(fb);
// }
//
// //根据车牌号查线路
// @ApiOperation(value = "获取线路信息",notes = "获取线路信息,返回值说明:" +
// " transportationNo:运输编号," +
// " routeNumber:路由编号," +
// " routeName:路由名" +
// " startLongitude:起运经度," +
// " startLatitude:起运纬度," +
// " startCity:起运城市," +
// " startAddress:起运具体地址," +
// " startTime:起运时间," +
// " endLongitude:目的经度," +
// " endLatitude:目的纬度," +
// " endCity:目的城市," +
// " endAddress:目的具体地址," +
// " endTime:目的时间," +
// " transport:运输方式," +
// " alarmType:预警类型," +
// " boxNo:箱单号," +
// " containerNo:集装箱号," +
// " deliveryAddress:交付地址," +
// " transportationType:运输类型" +
// " circuitState:线路状态(0未开始,1运输中,2完成)," +
// " remark:备注," +
// " createTime:创建线路时间" +
// " evaluate:评分," +
// " evaluateRemark:评分备注")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// @RequestMapping(value="/getByContainerNo",method = RequestMethod.POST)
// public Object getByContainerNo(@RequestBody String containerNo){
// JSONObject jsonObject=JSON.parseObject(containerNo);
// containerNo=(String)jsonObject.get("containerNo");
// return circuitService.getByContainerNo(containerNo);
// }
//
// //评价
// @ApiOperation(value = "评价",notes = "评价线路传值说明:" +
// " transportationNo:运输编号," +
// " evaluate:评分," +
// " evaluateRemark:评分备注")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// @RequestMapping(value="/updateEvaluate",method = RequestMethod.POST)
// public Object updateEvaluate(@RequestBody UpdateEvaluateVo updateEvaluateVo){
// if (updateEvaluateVo.getEvaluate()==null){
// fb.setCode(0);
// fb.setMessage("评价的等级不能为空");
// return gson.toJson(fb);
// }
// if (StringUtils.isEmpty(updateEvaluateVo.getTransportationNo())){
// fb.setCode(0);
// fb.setMessage("需要评价的线路编号不能为空");
// return gson.toJson(fb);
// }
// if (circuitService.getByTransportationNo(updateEvaluateVo.getTransportationNo()).getCircuitState()!=2){
// fb.setCode(0);
// fb.setMessage("线路完成运输才能评价");
// return gson.toJson(fb);
// }
// if (circuitService.getByTransportationNo(updateEvaluateVo.getTransportationNo()).getEvaluate()!=null){
// fb.setCode(0);
// fb.setMessage("该线路已经被评价");
// return gson.toJson(fb);
// }
// int a = circuitService.updateEvaluate(updateEvaluateVo);
// if (a>0){
// fb.setCode(1);
// fb.setMessage("评价成功");
// }else{
// fb.setCode(0);
// fb.setMessage("评价失败");
// }
// return gson.toJson(fb);
// }
//
// //根据运输状态查询线路信息
// @ApiOperation(value = "根据运输状态查询线路信息",notes = "根据运输状态查询线路信息,传值说明:{\"circuitState\":2} ,circuitState:线路状态(0未开始,1运输中,2完成),返回值说明:" +
// " transportationNo:运输编号," +
// " routeNumber:路由编号," +
// " routeName:路由名" +
// " startLongitude:起运经度," +
// " startLatitude:起运纬度," +
// " startCity:起运城市," +
// " startAddress:起运具体地址," +
// " startTime:起运时间," +
// " endLongitude:目的经度," +
// " endLatitude:目的纬度," +
// " endCity:目的城市," +
// " endAddress:目的具体地址," +
// " endTime:目的时间," +
// " transport:运输方式," +
// " alarmType:预警类型," +
// " boxNo:箱单号," +
// " containerNo:集装箱号," +
// " deliveryAddress:交付地址," +
// " transportationType:运输类型" +
// " circuitState:线路状态(0未开始,1运输中,2完成)," +
// " remark:备注," +
// " createTime:创建线路时间" +
// " evaluate:评分," +
// " evaluateRemark:评分备注")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// @RequestMapping(value="/getByCircuitState",method = RequestMethod.POST)
// public Object getByCircuitState(@RequestBody Map map){
// if (!map.containsKey("circuitState")){
// fb.setCode(0);
// fb.setMessage("需要查询的线路状态不能为空");
// return gson.toJson(fb);
// }
// return circuitService.getByCircuitState(Integer.valueOf(map.get("circuitState").toString()));
// }
@Autowired
private CircuitService circuitService;
@Autowired
private GatewayService gatewayService;
@Autowired
private TDLDeviceService tdlDeviceService;
//获取线路信息
@ApiOperation(value = "获取线路信息",notes = "获取线路信息,返回值说明:" +
" transportationNo:运输编号," +
" cargoNo:货物编号" +
" startCity:起运城市," +
" startTime:起运时间," +
" endCity:目的城市," +
" endTime:目的时间," +
" circuitState:线路状态(0未开始,1运输中,2完成)," +
" alarmType:预警类型,")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value="/getAll",method = RequestMethod.GET)
public Object getAll(){
return circuitService.getAll();
}
//根据条件查询
@ApiOperation(value = "根据条件查询",notes = "根据条件查询:" +
" cargoNo:货物编号" +
" endCity:目的城市," +
" endTime:目的时间," +
" circuitState:线路状态(0未开始,1运输中,2完成),"+
"返回值说明:" +
" transportationNo:运输编号," +
" cargoNo:货物编号" +
" startCity:起运城市," +
" startTime:起运时间," +
" endCity:目的城市," +
" endTime:目的时间," +
" alarmType:预警类型," +
" circuitState:线路状态(0未开始,1运输中,2完成),")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value="/getByTerm",method = RequestMethod.POST)
public Object getByTerm(@RequestBody CircuitTermVo circuitTermVo){
return circuitService.getByTerm(circuitTermVo);
}
//添加线路信息
@ApiOperation(value = "添加线路信息",notes = "添加线路信息," +
" addressVoList: 线路集合,包含" +
"{sequence:顺序(出发地0,目的地从1依次排序)" +
"country:国家" +
"city:城市" +
"addressDetail:详细地址" +
"lng:经度" +
"lat:纬度" +
"postCode:邮编"+
"expTime:预计开始时间,(传时间戳)" +
"compTime:预计结束时间,(传时间戳)}" +
" gSN:网关编号," +
" TDLSN:tdl编号," +
" alarmType:报警类型," +
" cargoNo:货物编号," +
" plateNo:车牌号," +
" cargoName:货物别名," +
" remark:备注")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value="/addCircuit",method = RequestMethod.POST)
public Object addCircuit(@RequestBody AddCircuitVo addCircuitVo){
if(StringUtils.isEmpty(addCircuitVo.getTDLSN())){
fb.setCode(0);
fb.setMessage("TDL编号不能为空");
return gson.toJson(fb);
}
if(StringUtils.isEmpty(addCircuitVo.getSN())){
fb.setCode(0);
fb.setMessage("网关编号不能为空");
return gson.toJson(fb);
}
if(StringUtils.isEmpty(addCircuitVo.getCargoNo())){
fb.setCode(0);
fb.setMessage("货物编号不能为空");
return gson.toJson(fb);
}
if(StringUtils.isEmpty(addCircuitVo.getPlateNo())){
fb.setCode(0);
fb.setMessage("车牌号不能为空");
return gson.toJson(fb);
}
if(StringUtils.isEmpty(addCircuitVo.getCargoName())){
fb.setCode(0);
fb.setMessage("货物别名不能为空");
return gson.toJson(fb);
}
if(StringUtils.isEmpty(addCircuitVo.getAlarmType())){
fb.setCode(0);
fb.setMessage("预警类型");
return gson.toJson(fb);
}
if(addCircuitVo.getAddressVoList().size()==0){
fb.setCode(0);
fb.setMessage("出发地不能为空");
return gson.toJson(fb);
}
if(addCircuitVo.getAddressVoList().size()==1){
fb.setCode(0);
fb.setMessage("目的地不能为空");
return gson.toJson(fb);
}
if(addCircuitVo.getAddressVoList().size()>4){
fb.setCode(0);
fb.setMessage("目的地不能超过3个");
return gson.toJson(fb);
}
String countryVar="";
String cityVar="";
String addressDetailVar="";
String lngVar="";
String latVar = "";
String postCodeVar = "";
String expTimeVar = "";
String compTimeVar = "";
String arrivalTimeVar="";
String startTimeVar="";
Long time = System.currentTimeMillis();
for(int i =0;i<addCircuitVo.getAddressVoList().size();i++){
if(StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getCountry())){
fb.setCode(0);
fb.setMessage("国家不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getCity())){
fb.setCode(0);
fb.setMessage("城市不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getAddressDetail())){
fb.setCode(0);
fb.setMessage("具体地址不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getLat())){
fb.setCode(0);
fb.setMessage("纬度不能为空");
return gson.toJson(fb);
}
if(!addCircuitVo.getAddressVoList().get(i).getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){
fb.setCode(0);
fb.setMessage("纬度的范围为-90~90");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getLng())){
fb.setCode(0);
fb.setMessage("经度不能为空");
return gson.toJson(fb);
}
if(!addCircuitVo.getAddressVoList().get(i).getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) {
fb.setCode(0);
fb.setMessage("经度的范围为-180~180");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(addCircuitVo.getAddressVoList().get(i).getPostCode())){
fb.setCode(0);
fb.setMessage("邮编不能为空");
return gson.toJson(fb);
}
if (addCircuitVo.getAddressVoList().get(i).getSequence() == null) {
fb.setCode(0);
fb.setMessage("顺序不能为空");
return gson.toJson(fb);
}
if(addCircuitVo.getAddressVoList().get(i).getSequence()>=2 && addCircuitVo.getAddressVoList().get(i).getCompTime() == null){
fb.setCode(0);
fb.setMessage("预计到达时间不能为空");
return gson.toJson(fb);
}
if(addCircuitVo.getAddressVoList().get(i).getSequence()==1 && addCircuitVo.getAddressVoList().get(i).getExpTime() == null){
fb.setCode(0);
fb.setMessage("预计开始时间不能为空");
return gson.toJson(fb);
}
countryVar=countryVar +addCircuitVo.getAddressVoList().get(i).getCountry() +" ";
cityVar=cityVar +addCircuitVo.getAddressVoList().get(i).getCity() +" ";
addressDetailVar =addressDetailVar +addCircuitVo.getAddressVoList().get(i).getAddressDetail() +" ";
lngVar = lngVar + addCircuitVo.getAddressVoList().get(i).getLng() +" ";
latVar = latVar + addCircuitVo.getAddressVoList().get(i).getLat() +" ";
postCodeVar=postCodeVar + addCircuitVo.getAddressVoList().get(i).getPostCode() +" ";
if(addCircuitVo.getAddressVoList().get(i).getExpTime() ==null){
expTimeVar = expTimeVar + "0 ";
}else{
expTimeVar = expTimeVar +addCircuitVo.getAddressVoList().get(i).getExpTime() +" ";
}
if(addCircuitVo.getAddressVoList().get(i).getCompTime() == null){
compTimeVar = compTimeVar +"0 ";
}else{
compTimeVar = compTimeVar +addCircuitVo.getAddressVoList().get(i).getCompTime() +" ";
}
if(i ==0){
startTimeVar =startTimeVar + time +" ";
arrivalTimeVar = arrivalTimeVar +time +" ";
}else{
startTimeVar =startTimeVar + "0 ";
arrivalTimeVar = arrivalTimeVar +"0 ";
}
}
//根据sn获取type
String type =gatewayService.getBySN(addCircuitVo.getSN());
//获取gateway的场景
if(gatewayService.getBySNAndType(addCircuitVo.getSN(),type).getUseScene() !=2){
fb.setCode(0);
fb.setMessage("该网关的使用场景与当前不符");
return gson.toJson(fb);
}
List<String> devList = tdlDeviceService.getByGatewaySN(addCircuitVo.getSN(),type);
devList.add(addCircuitVo.getTDLSN());
ConfigCMDVo configCMDVo = new ConfigCMDVo("config",5,15,devList,1,System.currentTimeMillis()/1000l);
Map<Object,Object> map=new HashMap<>();
String transportation = "汽运";
String transportationType="本地运输";
map.put("transportationNo",getTransportNo(transportation,transportationType));
map.put("startTime",time);
map.put("expTime",addCircuitVo.getAddressVoList().get(0).getExpTime());
map.put("compTime",addCircuitVo.getAddressVoList().get(addCircuitVo.getAddressVoList().size()-1).getCompTime());
map.put("alarmType",addCircuitVo.getAlarmType());
map.put("cargoNo",addCircuitVo.getCargoNo());
map.put("cargoName",addCircuitVo.getCargoName());
map.put("plateNo",addCircuitVo.getPlateNo());
map.put("deliveryAddress","站点");
map.put("transportation",transportation);
map.put("transportationType",transportationType);
map.put("createTime",time);
map.put("remark",addCircuitVo.getRemark());
map.put("counts",addCircuitVo.getAddressVoList().size());
map.put("countryVar",countryVar);
map.put("cityVar",cityVar);
map.put("addressDetailVar",addressDetailVar);
map.put("lngVar",lngVar);
map.put("latVar",latVar);
map.put("postCodeVar",postCodeVar);
map.put("arrivalTimeVar",arrivalTimeVar);
map.put("startTimeVar",startTimeVar);
map.put("expTimeVar",expTimeVar);
map.put("compTimeVar",compTimeVar);
map.put("SN",addCircuitVo.getSN());
map.put("type",type);
map.put("TDLSN",addCircuitVo.getTDLSN());
map.put("message",gson.toJson(configCMDVo));
map.put("flag",false);
map.put("untie",false);
circuitService.addCircuit(map);
Map<Object,Object> msg=new HashMap<>();
msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("添加线路成功")){
fb.setCode(1);
fb.setMessage("添加线路成功");
}else {
fb.setCode(0);
fb.setMessage(msg.get("msg").toString());
}
return gson.toJson(fb);
}
//修改线路结束时间
@ApiOperation(value = "修改线路结束时间",notes = "修改线路结束时间,传值说明:" +
" transportationNo:运输编号," +
" endTime:目的时间 " )
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value="/updateEndTime",method = RequestMethod.POST)
public Object updateEndTime(@RequestBody UpdateCircuitVo updateCircuitVo){
if (StringUtils.isEmpty(updateCircuitVo.getTransportationNo())){
fb.setCode(0);
fb.setMessage("需要修改的运输编号不能为空");
return gson.toJson(fb);
}
if (updateCircuitVo.getEndTime()==null){
fb.setCode(0);
fb.setMessage("线路结束时间不能为空");
return gson.toJson(fb);
}
if (circuitService.getByTransportationNo(updateCircuitVo.getTransportationNo()).getCircuitState()!=2){
fb.setCode(0);
fb.setMessage("线路未完成");
return gson.toJson(fb);
}
int a = circuitService.updateEndTime(updateCircuitVo);
if (a>0){
fb.setCode(1);
fb.setMessage("修改线路结束时间成功");
}else{
fb.setCode(0);
fb.setMessage("修改线路结束时间失败");
}
return gson.toJson(fb);
}
// 修改线路信息
@ApiOperation(value = "修改线路信息",notes = "修改线路信息,传值说明:" +
" transportationNo:运输编号(自动生成,作为修改条件)" +
" addressVoList: 线路集合,包含" +
"{sequence:顺序(出发地0,目的地从1依次排序)" +
"country:国家" +
"city:城市" +
"addressDetail:详细地址" +
"lng:经度" +
"lat:纬度" +
"postCode:邮编"+
"expTime:预计开始时间,(传时间戳)" +
"compTime:预计结束时间,(传时间戳)}" +
" gSN:网关编号," +
" TDLSN:tdl编号," +
" alarmType:报警类型," +
" cargoNo:货物编号," +
" plateNo:车牌号," +
" cargoName:货物别名," +
" remark:备注")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value="/updateCircuit",method = RequestMethod.POST)
public Object updateCircuit(@RequestBody UpdateCircuitInfo updateCircuitInfo){
if (StringUtils.isEmpty(updateCircuitInfo.getTransportationNo())){
fb.setCode(0);
fb.setMessage("运输编号不能为空");
return gson.toJson(fb);
}
if(circuitService.getByTransportationNo(updateCircuitInfo.getTransportationNo()).getCircuitState()!=0){
fb.setCode(0);
fb.setMessage("只能在线路未开始运输时才能修改");
return gson.toJson(fb);
}
if(StringUtils.isEmpty(updateCircuitInfo.getSN())){
fb.setCode(0);
fb.setMessage("网关编号不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateCircuitInfo.getTDLSN())){
fb.setCode(0);
fb.setMessage("TDL编号不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateCircuitInfo.getAlarmType())){
fb.setCode(0);
fb.setMessage("报警类型不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateCircuitInfo.getCargoNo())){
fb.setCode(0);
fb.setMessage("货物编号不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateCircuitInfo.getPlateNo())){
fb.setCode(0);
fb.setMessage("车牌号不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateCircuitInfo.getCargoName())){
fb.setCode(0);
fb.setMessage("货物别名不能为空");
return gson.toJson(fb);
}
if(updateCircuitInfo.getAddressVoList().size() ==0){
fb.setCode(0);
fb.setMessage("起始城市不能为空");
return gson.toJson(fb);
}
if(updateCircuitInfo.getAddressVoList().size()==1){
fb.setCode(0);
fb.setMessage("目的地不能为空");
return gson.toJson(fb);
}
if(updateCircuitInfo.getAddressVoList().size()>4) {
fb.setCode(0);
fb.setMessage("目的地不能超过3个");
return gson.toJson(fb);
}
String countryVar="";
String cityVar="";
String addressDetailVar="";
String lngVar="";
String latVar = "";
String postCodeVar = "";
String expTimeVar = "";
String compTimeVar = "";
String arrivalTimeVar="";
String startTimeVar="";
Long time = System.currentTimeMillis();
for( int i= 0; i<updateCircuitInfo.getAddressVoList().size() ; i++){
if(updateCircuitInfo.getAddressVoList().get(i).getSequence() ==null){
fb.setCode(0);
fb.setMessage("顺序不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateCircuitInfo.getAddressVoList().get(i).getCountry())){
fb.setCode(0);
fb.setMessage("国家不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateCircuitInfo.getAddressVoList().get(i).getCity())){
fb.setCode(0);
fb.setMessage("城市不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateCircuitInfo.getAddressVoList().get(i).getAddressDetail())){
fb.setCode(0);
fb.setMessage("详细地址不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateCircuitInfo.getAddressVoList().get(i).getLng())){
fb.setCode(0);
fb.setMessage("经度不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateCircuitInfo.getAddressVoList().get(i).getLat())){
fb.setCode(0);
fb.setMessage("纬度不能为空");
return gson.toJson(fb);
}
if(!updateCircuitInfo.getAddressVoList().get(i).getLat().matches("^-?(([1-9])((\\.\\d{1,6})?)|([1-8]\\d)((\\.\\d{1,6})?)|90)$")){
fb.setCode(0);
fb.setMessage("纬度的范围为-90~90");
return gson.toJson(fb);
}
if(!updateCircuitInfo.getAddressVoList().get(i).getLng().matches("^-?(([1-9]\\d?)((\\.\\d{1,6})?)|(1[1-7]\\d)((\\.\\d{1,6})?)|180)$")) {
fb.setCode(0);
fb.setMessage("经度的范围为-180~180");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateCircuitInfo.getAddressVoList().get(i).getPostCode())){
fb.setCode(0);
fb.setMessage("邮编不能为空");
return gson.toJson(fb);
}
if(updateCircuitInfo.getAddressVoList().get(i).getSequence()>=2 && updateCircuitInfo.getAddressVoList().get(i).getCompTime() == null){
fb.setCode(0);
fb.setMessage("预计到达时间不能为空");
return gson.toJson(fb);
}
if(updateCircuitInfo.getAddressVoList().get(i).getSequence()==1 && updateCircuitInfo.getAddressVoList().get(i).getExpTime() == null){
fb.setCode(0);
fb.setMessage("预计开始时间不能为空");
return gson.toJson(fb);
}
countryVar=countryVar +updateCircuitInfo.getAddressVoList().get(i).getCountry() +" ";
cityVar=cityVar +updateCircuitInfo.getAddressVoList().get(i).getCity() +" ";
addressDetailVar =addressDetailVar +updateCircuitInfo.getAddressVoList().get(i).getAddressDetail() +" ";
lngVar = lngVar + updateCircuitInfo.getAddressVoList().get(i).getLng() +" ";
latVar = latVar + updateCircuitInfo.getAddressVoList().get(i).getLat() +" ";
postCodeVar=postCodeVar + updateCircuitInfo.getAddressVoList().get(i).getPostCode() +" ";
if(updateCircuitInfo.getAddressVoList().get(i).getExpTime() ==null){
expTimeVar = expTimeVar + "0 ";
}else{
expTimeVar = expTimeVar +updateCircuitInfo.getAddressVoList().get(i).getExpTime() +" ";
}
if(updateCircuitInfo.getAddressVoList().get(i).getCompTime() == null){
compTimeVar = compTimeVar +"0 ";
}else{
compTimeVar = compTimeVar +updateCircuitInfo.getAddressVoList().get(i).getCompTime() +" ";
}
if(i ==0){
startTimeVar =startTimeVar + time +" ";
arrivalTimeVar = arrivalTimeVar +time +" ";
}else{
startTimeVar =startTimeVar + "0 ";
arrivalTimeVar = arrivalTimeVar +"0 ";
}
}
Map<Object,Object> map=new HashMap<>();
String transportation = "汽运";
String transportationType="本地运输";
map.put("transportationNo",updateCircuitInfo.getTransportationNo());
map.put("startTime",time);
map.put("expTime",updateCircuitInfo.getAddressVoList().get(0).getExpTime());
map.put("compTime",updateCircuitInfo.getAddressVoList().get(updateCircuitInfo.getAddressVoList().size()-1).getCompTime());
map.put("alarmType",updateCircuitInfo.getAlarmType());
map.put("cargoNo",updateCircuitInfo.getCargoNo());
map.put("cargoName",updateCircuitInfo.getCargoName());
map.put("plateNo",updateCircuitInfo.getPlateNo());
map.put("deliveryAddress","站点");
map.put("transportation",transportation);
map.put("transportationType",transportationType);
map.put("createTime",time);
map.put("remark",updateCircuitInfo.getRemark());
map.put("counts",updateCircuitInfo.getAddressVoList().size());
map.put("countryVar",countryVar);
map.put("cityVar",cityVar);
map.put("addressDetailVar",addressDetailVar);
map.put("lngVar",lngVar);
map.put("latVar",latVar);
map.put("postCodeVar",postCodeVar);
map.put("arrivalTimeVar",arrivalTimeVar);
map.put("startTimeVar",startTimeVar);
map.put("expTimeVar",expTimeVar);
map.put("compTimeVar",compTimeVar);
// map.put("SN",addCircuitVo.getSN());
// map.put("type",type);
// map.put("TDLSN",addCircuitVo.getTDLSN());
// map.put("message",gson.toJson(configCMDVo));
// map.put("flag",false);
// map.put("untie",false);
circuitService.updateCircuit(map);
Map<Object,Object> msg=new HashMap<>();
msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("修改线路成功")){
fb.setCode(1);
fb.setMessage("修改线路成功");
}else{
fb.setCode(0);
fb.setMessage(msg.get("msg").toString());
}
return gson.toJson(fb);
}
//根据车牌号查线路
@ApiOperation(value = "获取线路信息",notes = "获取线路信息,返回值说明:" +
" transportationNo:运输编号," +
" cargoNo:货物编号" +
" startCity:起运城市," +
" startTime:起运时间," +
" endCity:目的城市," +
" endTime:目的时间," +
" alarmType:预警类型," +
" circuitState:线路状态(0未开始,1运输中,2完成),")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value="/getByContainerNo",method = RequestMethod.POST)
public Object getByContainerNo(@RequestBody String cargoNo){
JSONObject jsonObject= JSON.parseObject(cargoNo);
cargoNo=(String)jsonObject.get("cargoNo");
return circuitService.getByContainerNo(cargoNo);
}
//评价
@ApiOperation(value = "评价",notes = "评价线路传值说明:" +
" transportationNo:运输编号," +
" evaluate:评分," +
" evaluateRemark:评分备注")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value="/updateEvaluate",method = RequestMethod.POST)
public Object updateEvaluate(@RequestBody UpdateEvaluateVo updateEvaluateVo){
if (updateEvaluateVo.getEvaluate()==null){
fb.setCode(0);
fb.setMessage("评价的等级不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateEvaluateVo.getTransportationNo())){
fb.setCode(0);
fb.setMessage("需要评价的线路编号不能为空");
return gson.toJson(fb);
}
if (circuitService.getByTransportationNo(updateEvaluateVo.getTransportationNo()).getCircuitState()!=2){
fb.setCode(0);
fb.setMessage("线路完成运输才能评价");
return gson.toJson(fb);
}
int a = circuitService.updateEvaluate(updateEvaluateVo);
if (a>0){
fb.setCode(1);
fb.setMessage("评价成功");
}else{
fb.setCode(0);
fb.setMessage("评价失败");
}
return gson.toJson(fb);
}
//根据运输状态查询线路信息
@ApiOperation(value = "根据运输状态查询线路信息",notes = "根据运输状态查询线路信息,传值说明:{\"circuitState\":2} ,circuitState:线路状态(0未开始,1运输中,2完成),返回值说明:" +
" transportationNo:运输编号," +
" cargoNo:货物编号" +
" startCity:起运城市," +
" startTime:起运时间," +
" endCity:目的城市," +
" endTime:目的时间," +
" alarmType:预警类型," +
" circuitState:线路状态(0未开始,1运输中,2完成),")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value="/getByCircuitState",method = RequestMethod.POST)
public Object getByCircuitState(@RequestBody Map map){
if (!map.containsKey("circuitState")){
fb.setCode(0);
fb.setMessage("需要查询的线路状态不能为空");
return gson.toJson(fb);
}
return circuitService.getByCircuitState(Integer.valueOf(map.get("circuitState").toString()));
}
//删除线路
@ApiOperation(value = "删除线路",notes = "删除线路,传值说明:" +
" transportationNo:运输编号" )
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value="/delCircuit",method = RequestMethod.POST)
public Object delCircuit(@RequestBody String transportationNo){
JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=(String)jsonObject.get("transportationNo");
if (StringUtils.isEmpty(transportationNo)){
fb.setCode(0);
fb.setMessage("需要删除的运输编号不能为空");
return gson.toJson(fb);
}
if (circuitService.getByTransportationNo(transportationNo).getCircuitState()!=0){
fb.setCode(0);
fb.setMessage("该线路在运输中或已经完成运输");
return gson.toJson(fb);
}
int a = circuitService.delCircuit(transportationNo);
if (a>0){
fb.setCode(1);
fb.setMessage("删除线路成功");
}else{
fb.setCode(0);
fb.setMessage("删除线路失败");
}
return gson.toJson(fb);
}
//生成运输编号
public String getTransportNo(String transportation,String transportationType){
String transportationNo="";
if(transportationType.equals("本地运输")){
transportationNo = transportationNo+"CHN";
}else{
transportationNo = transportationNo+"HUN";
}
transportationNo=transportationNo+new SimpleDateFormat("yyyyMMdd").format(new Date());
if(transportation.equals("汽运")){
transportationNo = transportationNo +"G";
} else if (transportation.equals("铁路")){
transportationNo = transportationNo +"T";
}else if (transportation.equals("空运")){
transportationNo = transportationNo +"K";
}else if (transportation.equals("快递")){
transportationNo = transportationNo +"D";
}else if (transportation.equals("海运")){
transportationNo = transportationNo +"H";
}
transportationNo=transportationNo+((int)(Math.random()*(9999-1000+1))+1000);
if (circuitService.getNo(transportationNo)>0){
while (circuitService.getNo(transportationNo)>0){
transportationNo=transportationNo+((int)(Math.random()*(9999-1000+1))+1000);
}
}
return transportationNo;
}
}
......@@ -38,771 +38,771 @@ public class DataController {
CommFeedback fb = new CommFeedback();
// @Autowired
// private TDLDeviceService tdlDeviceService;
//
// @Autowired
// private ProbesService probesService;
//
// @Autowired
// private RealRedisService realRedisService;
//
// @Autowired
// private InfoRedisService infoRedisService;
//
// @Autowired
// private InfluxDBTemplate influxDBTemplate;
//
// @Autowired
// private AlarmLogService alarmLogService;
//
// @Autowired
// private CircuitService circuitService;
//
// @Autowired
// private TDLLogService tdlLogService;
//
// private final static String database ="original";
//
// //获取实时数据
// @ApiOperation(value = "获取实时数据",notes = "获取实时数据")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// @PostMapping("/getRealTimeData")
// public Object getRealTimeData(@RequestBody String transportationNo){
// JSONObject jsonObject= JSON.parseObject(transportationNo);
// transportationNo=jsonObject.getString("transportationNo");
// //获取gateway的信息
// ResultGatewayVo gatewayVo = circuitService.getByNo(transportationNo);
// if(gatewayVo==null){
// fb.setCode(0);
// fb.setMessage("该线路未绑定设备");
// return gson.toJson(fb);
// }
// //获取tdl信息
// List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
// //根据gateWay获取tdl信息
// List<String> key = new ArrayList<>();
// key.add(gatewayVo.getSN()+"_"+gatewayVo.getType() +":"+gatewayVo.getSN()+"_"+gatewayVo.getType());
// for (int i = 0;i<devList.size();i++){
// key.add(gatewayVo.getSN()+"_"+gatewayVo.getType()+":"+devList.get(i));
// }
// List<LiveDataVo> liveDataVos = new ArrayList<>();
// for(int j=0;j<key.size();j++){
// Map<Object,Object> ret = realRedisService.getHashAll(key.get(j));
// if(ret == null){
// continue;
// }else{
// Iterator entries = ret.entrySet().iterator();
// List<String> aliasList = new ArrayList<>();
// List<String> valueList = new ArrayList<>();
// while(entries.hasNext()){
// Map.Entry entry = (Map.Entry) entries.next();
// aliasList.add((String) entry.getKey());
// valueList.add((String) entry.getValue());
// }
// //根据通道别名获取通道信息
// List<ProbesVo> probesVoList = probesService.getByAliasList(gatewayVo.getSN(),gatewayVo.getType(),aliasList);
// for(int m = 0;m<probesVoList.size();m++){
// probesVoList.get(m).setValue(valueList.get(m));
// }
// LiveDataVo liveDataVo = new LiveDataVo();
// liveDataVo.setKey(key.get(j).substring(key.get(j).indexOf(":"),key.get(j).length()));
// liveDataVo.setProbesVoList(probesVoList);
// liveDataVos.add(liveDataVo);
// }
// }
// return gson.toJson(liveDataVos);
// }
//
//
// //获取坐标数据数据
// @ApiOperation(value = "获取坐标数据数据",notes = "获取坐标数据数据" +
// "time:时间" +
// "lng:经度" +
// "lat: 纬度")
// @PostMapping("/getLocation")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// public Object getLocation(@RequestBody String transportationNo){
// JSONObject jsonObject= JSON.parseObject(transportationNo);
// transportationNo=jsonObject.getString("transportationNo");
// //根据运输编号获取线路信息
// ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
// if(resultCircuitVo.getEndTime() !=0 && infoRedisService.hasHashKey("TransportConfig",transportationNo)){
// Object ret = infoRedisService.getHash("TransportConfig",transportationNo);
// return ret;
// }else{
// //获取gateway的信息
// ResultGatewayVo gatewayVo = new ResultGatewayVo();
// if(resultCircuitVo.getEndTime() == 0){
// gatewayVo = circuitService.getByNo(transportationNo);
// }else{
// gatewayVo = tdlLogService.getByNo(transportationNo);
// }
// if(gatewayVo==null){
// fb.setCode(0);
// fb.setMessage("该线路未绑定设备");
// return gson.toJson(fb);
// }
// String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
// Long startTime = resultCircuitVo.getStartTime() *1000000l;
// //获取tdl信息
// String sql = "SELECT \"lng\",\"lat\" FROM \"tdl_policy\".\""+device+"\"where time >= "+startTime +" ORDER BY time ";
// QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
// //解析经纬度数据
// List<LocationDataVo> locationDataVos = new ArrayList<>();
// if(queryResult.getResults().get(0).getSeries() != null){
// locationDataVos=getLocation(queryResult);
// }
// //获取震动的数据
// String sql2 = "SELECT \"b\" FROM \"tdl_policy\".\""+device+"\"where time >= "+startTime +" ORDER BY time";
// QueryResult queryResult2 = influxDBTemplate.query(new Query(sql2,database));
// List<String> timeList = new ArrayList<>();
// if(queryResult2.getResults().get(0).getSeries() != null){
// //获取震动的时间戳
// timeList = getTime(queryResult2);
// }
// //获取震动数据的坐标
// String sql3 ="";
// for(String time : timeList){
// Long t = Long.valueOf(time) *1000000l;
// sql3 = "SELECT \"lng\",\"lat\" FROM \"tdl_policy\".\""+device+"\" where time >= "+startTime +" and time<="+ t +" ORDER BY time desc limit 1;" +sql3;
// }
// QueryResult queryResult3 = influxDBTemplate.query(new Query(sql3,database));
// List<String> time= new ArrayList<>();
// if(queryResult3.getResults() !=null){
// time = getShockLocation(queryResult3);
// }
// List<LocationDataVo> locationDataVoList =new ArrayList<>();
// for(LocationDataVo locationDataVo :locationDataVos){
// if(time.contains(locationDataVo.getTime())){
// locationDataVo.setError(1);
// locationDataVoList.add(locationDataVo);
// }else{
// locationDataVo.setError(0);
// locationDataVoList.add(locationDataVo);
// }
// }
// //如果是已经完结保存到redis中
// if(resultCircuitVo.getEndTime() != 0){
// infoRedisService.setHash("TransportConfig",transportationNo,locationDataVoList.toString(),60*30);
// }
// return gson.toJson(locationDataVoList);
// }
// }
//
//
// //根据运输编号获取路线以及设备信息
// @ApiOperation(value = "获取路线以及设备信息",notes = "获取路线以及设备信息" +
// "transportationNo:运输编号" +
// "startCity:启运城市" +
// "startTime:开始时间" +
// "endCity:目的城市" +
// "endTime:结束时间(未结束为\"\")" +
// "gatewaySN:网关编号" +
// "battery:网关点量" +
// "TDLSN:tdl编号" +
// "batteryVoltage:tdl电压" +
// "lastTime:运输时长(未结束为\"\")" +
// "circuitState:运输状态(0--未开始,1--运输中,2--完成)" +
// "remark:备注信息")
// @PostMapping("/getCircuit")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// public Object getCircuit(@RequestBody String transportationNo){
// JSONObject jsonObject= JSON.parseObject(transportationNo);
// transportationNo=jsonObject.getString("transportationNo");
// ResultCircuit resultCircuit = new ResultCircuit();
// resultCircuit.setTransportationNo(transportationNo);
// //根据运输编号获取线路信息,设备信息
// ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
// resultCircuit.setStartCity(resultCircuitVo.getStartCity());
// resultCircuit.setStartTime(resultCircuitVo.getStartTime());
// resultCircuit.setEndCity(resultCircuitVo.getEndCity());
// ResultGatewayVo gatewayVo = new ResultGatewayVo();
// if(resultCircuitVo.getEndTime() == 0){
// resultCircuit.setEndTime(null);
// resultCircuit.setLastTime(null);
// gatewayVo = circuitService.getByNo(transportationNo);
// }else{
// resultCircuit.setEndTime(resultCircuitVo.getEndTime());
// resultCircuit.setLastTime(getDistanceTime(resultCircuit.getStartTime(),resultCircuit.getEndTime()));
// gatewayVo = tdlLogService.getByNo(transportationNo);
// }
// //获取gateway的信息
// if(gatewayVo==null){
// fb.setCode(0);
// fb.setMessage("该线路未绑定设备");
// return gson.toJson(fb);
// }
// resultCircuit.setGatewaySN(gatewayVo.getSN());
// String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
// Long startTime = resultCircuitVo.getStartTime() *1000000l;
// //获取tdl信息
// String sql = "SELECT \"battery\" FROM \"tdl_policy\".\""+device+"\" where time >= "+startTime +" ORDER BY time desc limit 1";
// QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
// if(queryResult.getResults().get(0).getSeries() != null){
// List<List<Object>> values = getValues(queryResult);
// for(List<Object> value:values){
// logger.info(value.get(1).toString());
// resultCircuit.setBattery(value.get(1)==null ? "": value.get(1).toString());
// }
// }
// //获取tdl信息
// List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
// String key=gatewayVo.getSN()+"_"+gatewayVo.getType() +":"+gatewayVo.getSN()+"_"+gatewayVo.getType() ;
// //获取网关以及TDL的电量
// if(devList.size() == 0 ){
// fb.setCode(0);
// fb.setMessage("该线路未绑定设备");
// return gson.toJson(fb);
// }
// for(int i = 0;i<devList.size();i++){
// String sql2 = "SELECT \"b\" FROM \"tdl_policy\".\""+device+"\" where \"tdl\"=\'tdl-"+devList.get(i)+"\'and time >= "+startTime +" ORDER BY time desc limit 1";
// QueryResult queryResult2 = influxDBTemplate.query(new Query(sql2,database));
// if(queryResult2.getResults().get(0).getSeries() != null){
// List<List<Object>> values = getValues(queryResult2);
// for(List<Object> value:values){
// resultCircuit.setTDLSN(devList.get(i));
// resultCircuit.setBatteryVoltage(value.get(1)==null ? "" :value.get(1).toString());
// }
// }
// }
// resultCircuit.setCircuitState(resultCircuitVo.getCircuitState());
// return gson.toJson(resultCircuit);
// }
//
//
// //获取温度数据
// @ApiOperation(value = "获取温度数据",notes = "获取温度数据" +
// "TDLSN:tdl编号" +
// "temperatureDataVos:" +
// "time:时间" +
// "value:温度数据")
// @PostMapping("/getTemperature")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// public Object getTemperature(@RequestBody String transportationNo){
// JSONObject jsonObject= JSON.parseObject(transportationNo);
// transportationNo=jsonObject.getString("transportationNo");
// ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
// ResultGatewayVo gatewayVo = new ResultGatewayVo();
// if(resultCircuitVo.getEndTime() == 0){
// gatewayVo = circuitService.getByNo(transportationNo);
// }else{
// gatewayVo = tdlLogService.getByNo(transportationNo);
// }
// String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
// //获取tdl信息
// List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
// String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
// Long startTime = resultCircuitVo.getStartTime() *1000000l;
@Autowired
private TDLDeviceService tdlDeviceService;
@Autowired
private ProbesService probesService;
@Autowired
private RealRedisService realRedisService;
@Autowired
private InfoRedisService infoRedisService;
@Autowired
private InfluxDBTemplate influxDBTemplate;
@Autowired
private AlarmLogService alarmLogService;
@Autowired
private CircuitService circuitService;
@Autowired
private TDLLogService tdlLogService;
private final static String database ="original";
//获取实时数据
@ApiOperation(value = "获取实时数据",notes = "获取实时数据")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@PostMapping("/getRealTimeData")
public Object getRealTimeData(@RequestBody String transportationNo){
JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=jsonObject.getString("transportationNo");
//获取gateway的信息
// ResultGatewayVo gatewayVo = circuitService.getByNo(transportationNo);
ResultGatewayVo gatewayVo = new ResultGatewayVo();
if(gatewayVo==null){
fb.setCode(0);
fb.setMessage("该线路未绑定设备");
return gson.toJson(fb);
}
//获取tdl信息
List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
//根据gateWay获取tdl信息
List<String> key = new ArrayList<>();
key.add(gatewayVo.getSN()+"_"+gatewayVo.getType() +":"+gatewayVo.getSN()+"_"+gatewayVo.getType());
for (int i = 0;i<devList.size();i++){
key.add(gatewayVo.getSN()+"_"+gatewayVo.getType()+":"+devList.get(i));
}
List<LiveDataVo> liveDataVos = new ArrayList<>();
for(int j=0;j<key.size();j++){
Map<Object,Object> ret = realRedisService.getHashAll(key.get(j));
if(ret == null){
continue;
}else{
Iterator entries = ret.entrySet().iterator();
List<String> aliasList = new ArrayList<>();
List<String> valueList = new ArrayList<>();
while(entries.hasNext()){
Map.Entry entry = (Map.Entry) entries.next();
aliasList.add((String) entry.getKey());
valueList.add((String) entry.getValue());
}
//根据通道别名获取通道信息
List<ProbesVo> probesVoList = probesService.getByAliasList(gatewayVo.getSN(),gatewayVo.getType(),aliasList);
for(int m = 0;m<probesVoList.size();m++){
probesVoList.get(m).setValue(valueList.get(m));
}
LiveDataVo liveDataVo = new LiveDataVo();
liveDataVo.setKey(key.get(j).substring(key.get(j).indexOf(":"),key.get(j).length()));
liveDataVo.setProbesVoList(probesVoList);
liveDataVos.add(liveDataVo);
}
}
return gson.toJson(liveDataVos);
}
//获取坐标数据数据
@ApiOperation(value = "获取坐标数据数据",notes = "获取坐标数据数据" +
"time:时间" +
"lng:经度" +
"lat: 纬度")
@PostMapping("/getLocation")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public Object getLocation(@RequestBody String transportationNo){
JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=jsonObject.getString("transportationNo");
//根据运输编号获取线路信息
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
if(resultCircuitVo.getEndTime() !=0 && infoRedisService.hasHashKey("TransportConfig",transportationNo)){
Object ret = infoRedisService.getHash("TransportConfig",transportationNo);
return ret;
}else{
//获取gateway的信息
ResultGatewayVo gatewayVo = new ResultGatewayVo();
if(resultCircuitVo.getEndTime() == 0){
//gatewayVo = circuitService.getByNo(transportationNo);
}else{
gatewayVo = tdlLogService.getByNo(transportationNo);
}
if(gatewayVo==null){
fb.setCode(0);
fb.setMessage("该线路未绑定设备");
return gson.toJson(fb);
}
String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
Long startTime = resultCircuitVo.getStartTime() *1000000l;
//获取tdl信息
String sql = "SELECT \"lng\",\"lat\" FROM \"tdl_policy\".\""+device+"\"where time >= "+startTime +" ORDER BY time ";
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
//解析经纬度数据
List<LocationDataVo> locationDataVos = new ArrayList<>();
if(queryResult.getResults().get(0).getSeries() != null){
locationDataVos=getLocation(queryResult);
}
//获取震动的数据
String sql2 = "SELECT \"b\" FROM \"tdl_policy\".\""+device+"\"where time >= "+startTime +" ORDER BY time";
QueryResult queryResult2 = influxDBTemplate.query(new Query(sql2,database));
List<String> timeList = new ArrayList<>();
if(queryResult2.getResults().get(0).getSeries() != null){
//获取震动的时间戳
timeList = getTime(queryResult2);
}
//获取震动数据的坐标
String sql3 ="";
for(String time : timeList){
Long t = Long.valueOf(time) *1000000l;
sql3 = "SELECT \"lng\",\"lat\" FROM \"tdl_policy\".\""+device+"\" where time >= "+startTime +" and time<="+ t +" ORDER BY time desc limit 1;" +sql3;
}
QueryResult queryResult3 = influxDBTemplate.query(new Query(sql3,database));
List<String> time= new ArrayList<>();
if(queryResult3.getResults() !=null){
time = getShockLocation(queryResult3);
}
List<LocationDataVo> locationDataVoList =new ArrayList<>();
for(LocationDataVo locationDataVo :locationDataVos){
if(time.contains(locationDataVo.getTime())){
locationDataVo.setError(1);
locationDataVoList.add(locationDataVo);
}else{
locationDataVo.setError(0);
locationDataVoList.add(locationDataVo);
}
}
//如果是已经完结保存到redis中
if(resultCircuitVo.getEndTime() != 0){
infoRedisService.setHash("TransportConfig",transportationNo,locationDataVoList.toString(),60*30);
}
return gson.toJson(locationDataVoList);
}
}
//根据运输编号获取路线以及设备信息
@ApiOperation(value = "获取路线以及设备信息",notes = "获取路线以及设备信息" +
"transportationNo:运输编号" +
"startCity:启运城市" +
"startTime:开始时间" +
"endCity:目的城市" +
"endTime:结束时间(未结束为\"\")" +
"gatewaySN:网关编号" +
"battery:网关点量" +
"TDLSN:tdl编号" +
"batteryVoltage:tdl电压" +
"lastTime:运输时长(未结束为\"\")" +
"circuitState:运输状态(0--未开始,1--运输中,2--完成)" +
"remark:备注信息")
@PostMapping("/getCircuit")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public Object getCircuit(@RequestBody String transportationNo){
JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=jsonObject.getString("transportationNo");
ResultCircuit resultCircuit = new ResultCircuit();
resultCircuit.setTransportationNo(transportationNo);
//根据运输编号获取线路信息,设备信息
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
resultCircuit.setStartCity(resultCircuitVo.getStartCity());
resultCircuit.setStartTime(resultCircuitVo.getStartTime());
resultCircuit.setEndCity(resultCircuitVo.getEndCity());
ResultGatewayVo gatewayVo = new ResultGatewayVo();
if(resultCircuitVo.getEndTime() == 0){
resultCircuit.setEndTime(null);
resultCircuit.setLastTime(null);
gatewayVo = circuitService.getByNo(transportationNo);
}else{
resultCircuit.setEndTime(resultCircuitVo.getEndTime());
resultCircuit.setLastTime(getDistanceTime(resultCircuit.getStartTime(),resultCircuit.getEndTime()));
gatewayVo = tdlLogService.getByNo(transportationNo);
}
//获取gateway的信息
if(gatewayVo==null){
fb.setCode(0);
fb.setMessage("该线路未绑定设备");
return gson.toJson(fb);
}
resultCircuit.setGatewaySN(gatewayVo.getSN());
String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
Long startTime = resultCircuitVo.getStartTime() *1000000l;
//获取tdl信息
String sql = "SELECT \"battery\" FROM \"tdl_policy\".\""+device+"\" where time >= "+startTime +" ORDER BY time desc limit 1";
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
if(queryResult.getResults().get(0).getSeries() != null){
List<List<Object>> values = getValues(queryResult);
for(List<Object> value:values){
logger.info(value.get(1).toString());
resultCircuit.setBattery(value.get(1)==null ? "": value.get(1).toString());
}
}
//获取tdl信息
List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
String key=gatewayVo.getSN()+"_"+gatewayVo.getType() +":"+gatewayVo.getSN()+"_"+gatewayVo.getType() ;
//获取网关以及TDL的电量
if(devList.size() == 0 ){
fb.setCode(0);
fb.setMessage("该线路未绑定设备");
return gson.toJson(fb);
}
for(int i = 0;i<devList.size();i++){
String sql2 = "SELECT \"b\" FROM \"tdl_policy\".\""+device+"\" where \"tdl\"=\'tdl-"+devList.get(i)+"\'and time >= "+startTime +" ORDER BY time desc limit 1";
QueryResult queryResult2 = influxDBTemplate.query(new Query(sql2,database));
if(queryResult2.getResults().get(0).getSeries() != null){
List<List<Object>> values = getValues(queryResult2);
for(List<Object> value:values){
resultCircuit.setTDLSN(devList.get(i));
resultCircuit.setBatteryVoltage(value.get(1)==null ? "" :value.get(1).toString());
}
}
}
resultCircuit.setCircuitState(resultCircuitVo.getCircuitState());
return gson.toJson(resultCircuit);
}
//获取温度数据
@ApiOperation(value = "获取温度数据",notes = "获取温度数据" +
"TDLSN:tdl编号" +
"temperatureDataVos:" +
"time:时间" +
"value:温度数据")
@PostMapping("/getTemperature")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public Object getTemperature(@RequestBody String transportationNo){
JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=jsonObject.getString("transportationNo");
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
ResultGatewayVo gatewayVo = new ResultGatewayVo();
if(resultCircuitVo.getEndTime() == 0){
gatewayVo = circuitService.getByNo(transportationNo);
}else{
gatewayVo = tdlLogService.getByNo(transportationNo);
}
String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
//获取tdl信息
List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
Long startTime = resultCircuitVo.getStartTime() *1000000l;
//SELECT "h" FROM "tdl_policy"."WTD93LG_20180314" WHERE "tdl" = 'tdl-0A0B0C0D0F' ORDER BY time DESC
if(devList.size() == 0){
fb.setCode(0);
fb.setMessage("没有数据");
return gson.toJson(fb);
}
List<Temperature> temperatures = new ArrayList<>();
for( int i =0;i<devList.size();i++){
Temperature temperature = new Temperature();
temperature.setTDLSN(devList.get(i));
String sql = "SELECT \"t\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime + " ORDER BY time ";
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
List<TemperatureDataVo> temperatureDataVos = new ArrayList<>();
if(queryResult.getResults().get(0).getSeries() != null){
//解析数据
temperatureDataVos = getTemperature(queryResult);
}
temperature.setTemperatureDataVos(temperatureDataVos);
temperatures.add(temperature);
}
/*String sql = "SELECT \"t\" FROM \"tdl_policy\".\""+devcie+"\" ORDER BY time ";
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
List<TemperatureDataVo> temperatureDataVos = new ArrayList<>();
if(queryResult.getResults().get(0).getSeries() != null){
//解析数据
temperatureDataVos = getTemperature(queryResult);
}*/
return gson.toJson(temperatures);
}
//获取湿度数据
@ApiOperation(value = "获取湿度数据",notes = "获取湿度数据")
@PostMapping("/getHumidity")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public Object getHumidity(@RequestBody String transportationNo){
JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=jsonObject.getString("transportationNo");
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
ResultGatewayVo gatewayVo = new ResultGatewayVo();
if(resultCircuitVo.getEndTime() == 0){
gatewayVo = circuitService.getByNo(transportationNo);
}else{
gatewayVo = tdlLogService.getByNo(transportationNo);
}
String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
Long startTime = resultCircuitVo.getStartTime() *1000000l;
//获取tdl信息
List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
if(devList.size() == 0){
fb.setCode(0);
fb.setMessage("没有数据");
return gson.toJson(fb);
}
List<Humidity> humidities = new ArrayList<>();
for( int i =0;i<devList.size();i++){
Humidity humidity = new Humidity();
humidity.setTDLSN(devList.get(i));
String sql = "SELECT \"h\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime+" ORDER BY time ";
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
List<HumidityDataVo> humidityDataVos = new ArrayList<>();
if(queryResult.getResults().get(0).getSeries() != null){
//解析数据
humidityDataVos = getHumidity(queryResult);
}
humidity.setHumidityDataVoList(humidityDataVos);
humidities.add(humidity);
}
// //SELECT "h" FROM "tdl_policy"."WTD93LG_20180314" WHERE "tdl" = 'tdl-0A0B0C0D0F' ORDER BY time DESC
// if(devList.size() == 0){
// fb.setCode(0);
// fb.setMessage("没有数据");
// return gson.toJson(fb);
// }
// List<Temperature> temperatures = new ArrayList<>();
// for( int i =0;i<devList.size();i++){
// Temperature temperature = new Temperature();
// temperature.setTDLSN(devList.get(i));
// String sql = "SELECT \"t\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime + " ORDER BY time ";
// QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
// List<TemperatureDataVo> temperatureDataVos = new ArrayList<>();
// if(queryResult.getResults().get(0).getSeries() != null){
// //解析数据
// temperatureDataVos = getTemperature(queryResult);
// }
// temperature.setTemperatureDataVos(temperatureDataVos);
// temperatures.add(temperature);
// }
// /*String sql = "SELECT \"t\" FROM \"tdl_policy\".\""+devcie+"\" ORDER BY time ";
// QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
// List<TemperatureDataVo> temperatureDataVos = new ArrayList<>();
// if(queryResult.getResults().get(0).getSeries() != null){
// //解析数据
// temperatureDataVos = getTemperature(queryResult);
// }*/
// return gson.toJson(temperatures);
// }
//
//
// //获取湿度数据
// @ApiOperation(value = "获取湿度数据",notes = "获取湿度数据")
// @PostMapping("/getHumidity")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// public Object getHumidity(@RequestBody String transportationNo){
// JSONObject jsonObject= JSON.parseObject(transportationNo);
// transportationNo=jsonObject.getString("transportationNo");
// ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
// ResultGatewayVo gatewayVo = new ResultGatewayVo();
// if(resultCircuitVo.getEndTime() == 0){
// gatewayVo = circuitService.getByNo(transportationNo);
// }else{
// gatewayVo = tdlLogService.getByNo(transportationNo);
// }
// String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
// Long startTime = resultCircuitVo.getStartTime() *1000000l;
// //获取tdl信息
// List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
// String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
// if(devList.size() == 0){
// fb.setCode(0);
// fb.setMessage("没有数据");
// return gson.toJson(fb);
// }
// List<Humidity> humidities = new ArrayList<>();
// for( int i =0;i<devList.size();i++){
// Humidity humidity = new Humidity();
// humidity.setTDLSN(devList.get(i));
// String sql = "SELECT \"h\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime+" ORDER BY time ";
// String sql = "SELECT \"h\" FROM \"tdl_policy\".\""+devcie+"\" ORDER BY time ";
// QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
// List<HumidityDataVo> humidityDataVos = new ArrayList<>();
// if(queryResult.getResults().get(0).getSeries() != null){
// //解析数据
// humidityDataVos = getHumidity(queryResult);
// }
// humidity.setHumidityDataVoList(humidityDataVos);
// humidities.add(humidity);
// }
//// //SELECT "h" FROM "tdl_policy"."WTD93LG_20180314" WHERE "tdl" = 'tdl-0A0B0C0D0F' ORDER BY time DESC
//// String sql = "SELECT \"h\" FROM \"tdl_policy\".\""+devcie+"\" ORDER BY time ";
//// QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
//// List<HumidityDataVo> humidityDataVos = new ArrayList<>();
//// if(queryResult.getResults().get(0).getSeries() != null){
//// //解析数据
//// humidityDataVos = getHumidity(queryResult);
//// }
// return gson.toJson(humidities);
// }
//
// //获取倾斜度数据
// @ApiOperation(value = "获取倾斜度数据",notes = "获取倾斜度数据")
// @PostMapping("/getTiltAngle")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// public Object getTiltAngle(@RequestBody String transportationNo){
// JSONObject jsonObject= JSON.parseObject(transportationNo);
// transportationNo=jsonObject.getString("transportationNo");
// ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
// ResultGatewayVo gatewayVo = new ResultGatewayVo();
// if(resultCircuitVo.getEndTime() == 0){
// gatewayVo = circuitService.getByNo(transportationNo);
// }else{
// gatewayVo = tdlLogService.getByNo(transportationNo);
// }
// String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
// Long startTime = resultCircuitVo.getStartTime() *1000000l;
// //获取tdl信息
// List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
// String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
// if(devList.size() == 0){
// fb.setCode(0);
// fb.setMessage("没有数据");
// return gson.toJson(fb);
// }
// List<TiltAngle> tiltAngles = new ArrayList<>();
// for( int i =0;i<devList.size();i++){
// TiltAngle tiltAngle = new TiltAngle();
// tiltAngle.setTDLSN(devList.get(i));
// String sql = "SELECT \"ta\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime+" ORDER BY time ";
return gson.toJson(humidities);
}
//获取倾斜度数据
@ApiOperation(value = "获取倾斜度数据",notes = "获取倾斜度数据")
@PostMapping("/getTiltAngle")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public Object getTiltAngle(@RequestBody String transportationNo){
JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=jsonObject.getString("transportationNo");
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
ResultGatewayVo gatewayVo = new ResultGatewayVo();
if(resultCircuitVo.getEndTime() == 0){
gatewayVo = circuitService.getByNo(transportationNo);
}else{
gatewayVo = tdlLogService.getByNo(transportationNo);
}
String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
Long startTime = resultCircuitVo.getStartTime() *1000000l;
//获取tdl信息
List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
if(devList.size() == 0){
fb.setCode(0);
fb.setMessage("没有数据");
return gson.toJson(fb);
}
List<TiltAngle> tiltAngles = new ArrayList<>();
for( int i =0;i<devList.size();i++){
TiltAngle tiltAngle = new TiltAngle();
tiltAngle.setTDLSN(devList.get(i));
String sql = "SELECT \"ta\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime+" ORDER BY time ";
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
List<TiltAngleVo> tiltAngleVos = new ArrayList<>();
if(queryResult.getResults().get(0).getSeries() != null){
//解析数据
tiltAngleVos = getTiltAngle(queryResult);
}
tiltAngle.setShockEnergyVoList(tiltAngleVos);
tiltAngles.add(tiltAngle);
}
// String sql = "SELECT \"ta\" FROM \"tdl_policy\".\""+devcie+"\" ORDER BY time ";
// QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
// List<TiltAngleVo> tiltAngleVos = new ArrayList<>();
// if(queryResult.getResults().get(0).getSeries() != null){
// //解析数据
// tiltAngleVos = getTiltAngle(queryResult);
// }
// tiltAngle.setShockEnergyVoList(tiltAngleVos);
// tiltAngles.add(tiltAngle);
// }
//// String sql = "SELECT \"ta\" FROM \"tdl_policy\".\""+devcie+"\" ORDER BY time ";
//// QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
//// List<TiltAngleVo> tiltAngleVos = new ArrayList<>();
//// if(queryResult.getResults().get(0).getSeries() != null){
//// //解析数据
//// tiltAngleVos = getTiltAngle(queryResult);
//// }
// return gson.toJson(tiltAngles);
// }
//
// //获取震动能量
// @ApiOperation(value = "获取震动能量",notes = "获取震动能量")
// @PostMapping("/getShockEnergy")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// public Object getShockEnergy(@RequestBody String transportationNo){
// JSONObject jsonObject= JSON.parseObject(transportationNo);
// transportationNo=jsonObject.getString("transportationNo");
// ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
// ResultGatewayVo gatewayVo = new ResultGatewayVo();
// if(resultCircuitVo.getEndTime() == 0){
// gatewayVo = circuitService.getByNo(transportationNo);
// }else{
// gatewayVo = tdlLogService.getByNo(transportationNo);
// }
// String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
// Long startTime = resultCircuitVo.getStartTime() *1000000l;
// //获取tdl信息
// List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
// String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
// if(devList.size() == 0){
// fb.setCode(0);
// fb.setMessage("没有数据");
// return gson.toJson(fb);
// }
// List<ShockEnergy> shockEnergies = new ArrayList<>();
// for( int i =0;i<devList.size();i++){
// ShockEnergy shockEnergy = new ShockEnergy();
// shockEnergy.setTDLSN(devList.get(i));
// String sql = "SELECT \"a0\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime+" ORDER BY time ";
return gson.toJson(tiltAngles);
}
//获取震动能量
@ApiOperation(value = "获取震动能量",notes = "获取震动能量")
@PostMapping("/getShockEnergy")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public Object getShockEnergy(@RequestBody String transportationNo){
JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=jsonObject.getString("transportationNo");
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
ResultGatewayVo gatewayVo = new ResultGatewayVo();
if(resultCircuitVo.getEndTime() == 0){
gatewayVo = circuitService.getByNo(transportationNo);
}else{
gatewayVo = tdlLogService.getByNo(transportationNo);
}
String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
Long startTime = resultCircuitVo.getStartTime() *1000000l;
//获取tdl信息
List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
if(devList.size() == 0){
fb.setCode(0);
fb.setMessage("没有数据");
return gson.toJson(fb);
}
List<ShockEnergy> shockEnergies = new ArrayList<>();
for( int i =0;i<devList.size();i++){
ShockEnergy shockEnergy = new ShockEnergy();
shockEnergy.setTDLSN(devList.get(i));
String sql = "SELECT \"a0\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime+" ORDER BY time ";
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
List<ShockEnergyVo> shockEnergyVos = new ArrayList<>();
if(queryResult.getResults().get(0).getSeries() != null){
//解析数据
shockEnergyVos = getShockEnergy(queryResult);
}
shockEnergy.setShockEnergyVoList(shockEnergyVos);
shockEnergies.add(shockEnergy);
}
// String sql = "SELECT \"a0\" FROM \"tdl_policy\".\""+devcie+"\" ORDER BY time ";
// QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
// List<ShockEnergyVo> shockEnergyVos = new ArrayList<>();
// if(queryResult.getResults().get(0).getSeries() != null){
// //解析数据
// shockEnergyVos = getShockEnergy(queryResult);
// }
// shockEnergy.setShockEnergyVoList(shockEnergyVos);
// shockEnergies.add(shockEnergy);
// }
//// String sql = "SELECT \"a0\" FROM \"tdl_policy\".\""+devcie+"\" ORDER BY time ";
//// QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
//// List<ShockEnergyVo> shockEnergyVos = new ArrayList<>();
//// if(queryResult.getResults().get(0).getSeries() != null){
//// //解析数据
//// shockEnergyVos = getShockEnergy(queryResult);
//// }
// return gson.toJson(shockEnergies);
// }
//
//
// //根据运输编号获取所有的报警数据
// @ApiOperation(value = "根据运输编号获取所有的报警数据????",notes = "根据运输编号获取所有的报警数据")
// @PostMapping("/getAlarmData")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// public Object getAlarmData(@RequestBody String transportationNo){
// JSONObject jsonObject= JSON.parseObject(transportationNo);
// transportationNo=jsonObject.getString("transportationNo");
// //根据运输编号获取报警信息
// List<ResultAlarmLog> alarmLogVoList = alarmLogService.getByTransportationNo(transportationNo);
// return gson.toJson(alarmLogVoList);
// }
//
//
// //根据时间获取经纬度信息
// @ApiOperation(value = "根据时间获取经纬度信息",notes = "根据时间获取经纬度信息" +
// "transportationNo:运输编号" +
// "TDLSN:tdl编号" +
// "gatewaySN:网关编号" +
// "startCity:出发城市" +
// "endCity:目的城市" +
// "startTime:出发时间" +
// "endTime:到达时间" +
// "alarmTime:报警时间" +
// "alarmType:报警类型" +
// "alarmValue:报警值" +
// "lng:经度" +
// "lat:纬度")
// @PostMapping("/getLocationByTime")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// public Object getLocationByTime(@RequestBody LocationVo locationVo ){
// //获取线路信息
// //获取网关以及tdl信息
// ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(locationVo.getTransportationNo());
// ResultGatewayVo gatewayVo = new ResultGatewayVo();
// if(resultCircuitVo.getEndTime() == 0){
// gatewayVo = circuitService.getByNo(locationVo.getTransportationNo());
// }else{
// gatewayVo = tdlLogService.getByNo(locationVo.getTransportationNo());
// }
// String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
// //获取tdl信息
// List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
// String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
// //根据时间获取坐标信息
// String sql ="SELECT \"lng\",\"lat\" FROM \"tdl_policy\".\""+devcie+"\" where time = "+locationVo.getTime() *1000000l;
// QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
// List<LocationMessageVo> locationDataVos = new ArrayList<>();
// if(queryResult.getResults().get(0).getSeries() != null){
// List<List<Object>> values = getValues(queryResult);
// for(List<Object> value:values){
// LocationMessageVo messageVo = new LocationMessageVo();
// messageVo.setTransportationNo(locationVo.getTransportationNo());
// messageVo.setGatewaySN(gatewayVo.getSN());
// messageVo.setTDLSN(devList);
// messageVo.setStartCity(resultCircuitVo.getStartCity());
// messageVo.setEndCity(resultCircuitVo.getEndCity());
// messageVo.setStartTime(resultCircuitVo.getStartTime());
// messageVo.setEndTime(resultCircuitVo.getEndTime());
// messageVo.setAlarmTime(Long.valueOf(parseTime(value.get(0).toString())));
// messageVo.setAlarmType(locationVo.getAlarmType());
// messageVo.setAlarmValue(locationVo.getVlaue());
// messageVo.setLng(value.get(1)==null ? "" : value.get(1).toString());
// messageVo.setLat(value.get(2)==null ? "" : value.get(2).toString());
// locationDataVos.add(messageVo);
// }
// }
// return gson.toJson(locationDataVos);
// }
//
//
// //获取温度、湿度、震动强度、震动能量、倾斜度
// @PostMapping("/getDeviceData")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// public Object getDeviceData(@RequestBody String transportationNo){
// JSONObject jsonObject= JSON.parseObject(transportationNo);
// transportationNo=jsonObject.getString("transportationNo");
// //获取网关以及tdl信息
// ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
// ResultGatewayVo gatewayVo = new ResultGatewayVo();
// if(resultCircuitVo.getEndTime() == 0){
// gatewayVo = circuitService.getByNo(transportationNo);
// }else{
// gatewayVo = tdlLogService.getByNo(transportationNo);
// }
// String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
// Long startTime = resultCircuitVo.getStartTime() *1000000l;
// //获取tdl信息
// List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
// String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
// //SELECT "h" FROM "tdl_policy"."WTD93LG_20180314" WHERE "tdl" = 'tdl-0A0B0C0D0F' ORDER BY time DESC
// String sql = "SELECT \"t\",\"h\",\"p\",\"a0\",\"ta\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\" = \'"+devList.get(0)+"\' and time>="+startTime+" ORDER BY time ";
// QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
// //解析经纬度数据
// List<DeviceDataVo> deviceDataVos = new ArrayList<>();
// if(queryResult.getResults().get(0).getSeries() != null){
// deviceDataVos= getDeviceData(queryResult);
// }
// return gson.toJson(deviceDataVos);
// }
//
//
// //解析数据
// public List<LocationDataVo> getLocation(QueryResult queryResult){
// List<List<Object>> values = getValues(queryResult);
// List<LocationDataVo> historyDataList = new ArrayList<>();
// for(List<Object> value:values){
// LocationDataVo historyData = new LocationDataVo();
// historyData.setTime(parseTime(value.get(0).toString()));
// historyData.setLng(Double.parseDouble(value.get(1).toString()));
// historyData.setLat(Double.parseDouble(value.get(2).toString()));
// historyData.setError(0);
// historyDataList.add(historyData);
// }
// return historyDataList;
// }
//
// public List<DeviceDataVo> getDeviceData(QueryResult queryResult){
// List<List<Object>> values = getValues(queryResult);
// List<DeviceDataVo> historyDataList = new ArrayList<>();
// for(List<Object> value:values){
// DeviceDataVo historyData = new DeviceDataVo();
// historyData.setTime(parseTime(value.get(0).toString()));
// historyData.setTemperature(value.get(1)==null ? "" :value.get(1).toString());
// historyData.setHumidity(value.get(2)==null ? "" :value.get(2).toString());
// historyData.setPressure(value.get(3)==null ? "" :value.get(3).toString());
// historyData.setShockEnergy(value.get(4)==null ? "" :value.get(4).toString());
// historyData.setTiltAngle(value.get(5)==null ? "" :value.get(5).toString());
// historyDataList.add(historyData);
// }
// return historyDataList;
// }
//
// public List<TemperatureDataVo> getTemperature(QueryResult queryResult){
// List<List<Object>> values = getValues(queryResult);
// List<TemperatureDataVo> historyDataList = new ArrayList<>();
// for(List<Object> value:values){
// TemperatureDataVo historyData = new TemperatureDataVo();
// historyData.setTime(parseTime(value.get(0).toString()));
// historyData.setValue(value.get(1)==null ? "" :value.get(1).toString());
// historyDataList.add(historyData);
// }
// return historyDataList;
// }
//
// public List<TiltAngleVo> getTiltAngle(QueryResult queryResult){
// List<List<Object>> values = getValues(queryResult);
// List<TiltAngleVo> historyDataList = new ArrayList<>();
// for(List<Object> value:values){
// TiltAngleVo historyData = new TiltAngleVo();
// historyData.setTime(parseTime(value.get(0).toString()));
// historyData.setValue(value.get(1)==null ? "" :value.get(1).toString());
// historyDataList.add(historyData);
// }
// return historyDataList;
// }
//
// public List<ShockEnergyVo> getShockEnergy(QueryResult queryResult){
// List<List<Object>> values = getValues(queryResult);
// List<ShockEnergyVo> historyDataList = new ArrayList<>();
// for(List<Object> value:values){
// ShockEnergyVo historyData = new ShockEnergyVo();
// historyData.setTime(parseTime(value.get(0).toString()));
// historyData.setValue(value.get(1)==null ? "" :value.get(1).toString());
// historyDataList.add(historyData);
// }
// return historyDataList;
// }
//
// public List<HumidityDataVo> getHumidity(QueryResult queryResult){
// List<List<Object>> values = getValues(queryResult);
// List<HumidityDataVo> historyDataList = new ArrayList<>();
// for(List<Object> value:values){
// HumidityDataVo historyData = new HumidityDataVo();
// historyData.setTime(parseTime(value.get(0).toString()));
// historyData.setValue(value.get(1)==null ? "" :value.get(1).toString());
// historyDataList.add(historyData);
// }
// return historyDataList;
// }
//
// //解析数据格式
// public List<List<Object>> getValues( QueryResult queryResult){
// List<List<Object>> values = new ArrayList<>();
// for(QueryResult.Result result : queryResult.getResults()){
// if(result.getSeries() !=null){
// for (QueryResult.Series series : result.getSeries()) {
// if(series !=null){
// values= series.getValues();
// }
// }
// }
// }
// return values;
// }
//
// //将utc时间转换成时间戳
// public static String dateToStamp(String s) throws ParseException {
// Date date =null ;
// if(s.length() !=20 ) {
// date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(s);
// }else{
// date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(s);
// }
// return String.valueOf(date.getTime());
// }
//
// //解析时间
// public String parseTime(String time){
// String dateResult =null;
// try {
// dateResult = dateToStamp(time);
// } catch (ParseException e) {
// e.printStackTrace();
// logger.info(e.toString());
// fb.setCode(0);
// fb.setMessage("解析时间异常");
// }
// return dateResult;
// }
//
// //判断两个时间相差多少
// public static String getDistanceTime(Long time1, Long time2) {
// //获取当前时区,将时间戳转化成日期时间格式
// Date t1 = new Date(time1);
// Date t2 = new Date(time2);
// int days = differentDays(t1,t2);
// if(days>0){
// return days +"天";
// }else{
// return "a little minute";
// }
// }
//
// public static int differentDays(Date date1,Date date2) {
// Calendar cal1 = Calendar.getInstance();
// cal1.setTime(date1);
//
// Calendar cal2 = Calendar.getInstance();
// cal2.setTime(date2);
// int day1= cal1.get(Calendar.DAY_OF_YEAR);
// int day2 = cal2.get(Calendar.DAY_OF_YEAR);
//
// int year1 = cal1.get(Calendar.YEAR);
// int year2 = cal2.get(Calendar.YEAR);
// if(year1 != year2) { //不同年
// int timeDistance = 0 ;
// for(int i = year1 ; i < year2 ; i ++) {
// if(i%4==0 && i%100!=0 || i%400==0) { //闰年
// timeDistance += 366;
// } else{ //不是闰年
// timeDistance += 365;
// }
// }
// return timeDistance + (day2-day1) ;
// } else{
// return day2-day1;
// }
// }
//
// //将时间戳转成时间
// public static String timeStamp2Date(Long seconds) {
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// return sdf.format(new Date(seconds));
// }
//
// //解析震动时间
// public List<String> getTime(QueryResult queryResult){
// List<List<Object>> values = getValues(queryResult);
// List<String> time = new ArrayList<>();
// for(List<Object> value:values){
// try {
// time.add(UTCToCST(value.get(0).toString()));
// }catch (Exception e){
// e.printStackTrace();
// logger.info(e.toString());
// }
// }
// return time;
// }
//
// public String UTCToCST(String UTCStr) throws ParseException {
// Date date =null ;
// if(UTCStr.length() !=20 ) {
// date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(UTCStr);
// }else{
// date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(UTCStr);
// }
// Calendar calendar = Calendar.getInstance();
// calendar.setTime(date);
// calendar.set(Calendar.HOUR, calendar.get(Calendar.HOUR) + 8);
// //calendar.getTime() 返回的是Date类型,也可以使用calendar.getTimeInMillis()获取时间戳
// //format的格式可以任意
// return String.valueOf(calendar.getTimeInMillis());
// }
//
//
// public List<String> getShockLocation(QueryResult queryResult){
// List<List<Object>> values = new ArrayList<>();
// for(QueryResult.Result result : queryResult.getResults()){
// if(result.getSeries() !=null){
// for (QueryResult.Series series : result.getSeries()) {
// if(series !=null){
// values.add(series.getValues().get(0));
// }
// }
// }
// }
// List<String> timeList = new ArrayList<>();
// for(List<Object> value:values){
// timeList.add(parseTime(value.get(0).toString()));
// }
// return timeList;
// }
return gson.toJson(shockEnergies);
}
//根据运输编号获取所有的报警数据
@ApiOperation(value = "根据运输编号获取所有的报警数据????",notes = "根据运输编号获取所有的报警数据")
@PostMapping("/getAlarmData")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public Object getAlarmData(@RequestBody String transportationNo){
JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=jsonObject.getString("transportationNo");
//根据运输编号获取报警信息
List<ResultAlarmLog> alarmLogVoList = alarmLogService.getByTransportationNo(transportationNo);
return gson.toJson(alarmLogVoList);
}
//根据时间获取经纬度信息
@ApiOperation(value = "根据时间获取经纬度信息",notes = "根据时间获取经纬度信息" +
"transportationNo:运输编号" +
"TDLSN:tdl编号" +
"gatewaySN:网关编号" +
"startCity:出发城市" +
"endCity:目的城市" +
"startTime:出发时间" +
"endTime:到达时间" +
"alarmTime:报警时间" +
"alarmType:报警类型" +
"alarmValue:报警值" +
"lng:经度" +
"lat:纬度")
@PostMapping("/getLocationByTime")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public Object getLocationByTime(@RequestBody LocationVo locationVo ){
//获取线路信息
//获取网关以及tdl信息
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(locationVo.getTransportationNo());
ResultGatewayVo gatewayVo = new ResultGatewayVo();
if(resultCircuitVo.getEndTime() == 0){
gatewayVo = circuitService.getByNo(locationVo.getTransportationNo());
}else{
gatewayVo = tdlLogService.getByNo(locationVo.getTransportationNo());
}
String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
//获取tdl信息
List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
//根据时间获取坐标信息
String sql ="SELECT \"lng\",\"lat\" FROM \"tdl_policy\".\""+devcie+"\" where time = "+locationVo.getTime() *1000000l;
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
List<LocationMessageVo> locationDataVos = new ArrayList<>();
if(queryResult.getResults().get(0).getSeries() != null){
List<List<Object>> values = getValues(queryResult);
for(List<Object> value:values){
LocationMessageVo messageVo = new LocationMessageVo();
messageVo.setTransportationNo(locationVo.getTransportationNo());
messageVo.setGatewaySN(gatewayVo.getSN());
messageVo.setTDLSN(devList);
messageVo.setStartCity(resultCircuitVo.getStartCity());
messageVo.setEndCity(resultCircuitVo.getEndCity());
messageVo.setStartTime(resultCircuitVo.getStartTime());
messageVo.setEndTime(resultCircuitVo.getEndTime());
messageVo.setAlarmTime(Long.valueOf(parseTime(value.get(0).toString())));
messageVo.setAlarmType(locationVo.getAlarmType());
messageVo.setAlarmValue(locationVo.getVlaue());
messageVo.setLng(value.get(1)==null ? "" : value.get(1).toString());
messageVo.setLat(value.get(2)==null ? "" : value.get(2).toString());
locationDataVos.add(messageVo);
}
}
return gson.toJson(locationDataVos);
}
//获取温度、湿度、震动强度、震动能量、倾斜度
@PostMapping("/getDeviceData")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public Object getDeviceData(@RequestBody String transportationNo){
JSONObject jsonObject= JSON.parseObject(transportationNo);
transportationNo=jsonObject.getString("transportationNo");
//获取网关以及tdl信息
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
ResultGatewayVo gatewayVo = new ResultGatewayVo();
if(resultCircuitVo.getEndTime() == 0){
gatewayVo = circuitService.getByNo(transportationNo);
}else{
gatewayVo = tdlLogService.getByNo(transportationNo);
}
String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
Long startTime = resultCircuitVo.getStartTime() *1000000l;
//获取tdl信息
List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
//SELECT "h" FROM "tdl_policy"."WTD93LG_20180314" WHERE "tdl" = 'tdl-0A0B0C0D0F' ORDER BY time DESC
String sql = "SELECT \"t\",\"h\",\"p\",\"a0\",\"ta\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\" = \'"+devList.get(0)+"\' and time>="+startTime+" ORDER BY time ";
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
//解析经纬度数据
List<DeviceDataVo> deviceDataVos = new ArrayList<>();
if(queryResult.getResults().get(0).getSeries() != null){
deviceDataVos= getDeviceData(queryResult);
}
return gson.toJson(deviceDataVos);
}
//解析数据
public List<LocationDataVo> getLocation(QueryResult queryResult){
List<List<Object>> values = getValues(queryResult);
List<LocationDataVo> historyDataList = new ArrayList<>();
for(List<Object> value:values){
LocationDataVo historyData = new LocationDataVo();
historyData.setTime(parseTime(value.get(0).toString()));
historyData.setLng(Double.parseDouble(value.get(1).toString()));
historyData.setLat(Double.parseDouble(value.get(2).toString()));
historyData.setError(0);
historyDataList.add(historyData);
}
return historyDataList;
}
public List<DeviceDataVo> getDeviceData(QueryResult queryResult){
List<List<Object>> values = getValues(queryResult);
List<DeviceDataVo> historyDataList = new ArrayList<>();
for(List<Object> value:values){
DeviceDataVo historyData = new DeviceDataVo();
historyData.setTime(parseTime(value.get(0).toString()));
historyData.setTemperature(value.get(1)==null ? "" :value.get(1).toString());
historyData.setHumidity(value.get(2)==null ? "" :value.get(2).toString());
historyData.setPressure(value.get(3)==null ? "" :value.get(3).toString());
historyData.setShockEnergy(value.get(4)==null ? "" :value.get(4).toString());
historyData.setTiltAngle(value.get(5)==null ? "" :value.get(5).toString());
historyDataList.add(historyData);
}
return historyDataList;
}
public List<TemperatureDataVo> getTemperature(QueryResult queryResult){
List<List<Object>> values = getValues(queryResult);
List<TemperatureDataVo> historyDataList = new ArrayList<>();
for(List<Object> value:values){
TemperatureDataVo historyData = new TemperatureDataVo();
historyData.setTime(parseTime(value.get(0).toString()));
historyData.setValue(value.get(1)==null ? "" :value.get(1).toString());
historyDataList.add(historyData);
}
return historyDataList;
}
public List<TiltAngleVo> getTiltAngle(QueryResult queryResult){
List<List<Object>> values = getValues(queryResult);
List<TiltAngleVo> historyDataList = new ArrayList<>();
for(List<Object> value:values){
TiltAngleVo historyData = new TiltAngleVo();
historyData.setTime(parseTime(value.get(0).toString()));
historyData.setValue(value.get(1)==null ? "" :value.get(1).toString());
historyDataList.add(historyData);
}
return historyDataList;
}
public List<ShockEnergyVo> getShockEnergy(QueryResult queryResult){
List<List<Object>> values = getValues(queryResult);
List<ShockEnergyVo> historyDataList = new ArrayList<>();
for(List<Object> value:values){
ShockEnergyVo historyData = new ShockEnergyVo();
historyData.setTime(parseTime(value.get(0).toString()));
historyData.setValue(value.get(1)==null ? "" :value.get(1).toString());
historyDataList.add(historyData);
}
return historyDataList;
}
public List<HumidityDataVo> getHumidity(QueryResult queryResult){
List<List<Object>> values = getValues(queryResult);
List<HumidityDataVo> historyDataList = new ArrayList<>();
for(List<Object> value:values){
HumidityDataVo historyData = new HumidityDataVo();
historyData.setTime(parseTime(value.get(0).toString()));
historyData.setValue(value.get(1)==null ? "" :value.get(1).toString());
historyDataList.add(historyData);
}
return historyDataList;
}
//解析数据格式
public List<List<Object>> getValues( QueryResult queryResult){
List<List<Object>> values = new ArrayList<>();
for(QueryResult.Result result : queryResult.getResults()){
if(result.getSeries() !=null){
for (QueryResult.Series series : result.getSeries()) {
if(series !=null){
values= series.getValues();
}
}
}
}
return values;
}
//将utc时间转换成时间戳
public static String dateToStamp(String s) throws ParseException {
Date date =null ;
if(s.length() !=20 ) {
date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(s);
}else{
date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(s);
}
return String.valueOf(date.getTime());
}
//解析时间
public String parseTime(String time){
String dateResult =null;
try {
dateResult = dateToStamp(time);
} catch (ParseException e) {
e.printStackTrace();
logger.info(e.toString());
fb.setCode(0);
fb.setMessage("解析时间异常");
}
return dateResult;
}
//判断两个时间相差多少
public static String getDistanceTime(Long time1, Long time2) {
//获取当前时区,将时间戳转化成日期时间格式
Date t1 = new Date(time1);
Date t2 = new Date(time2);
int days = differentDays(t1,t2);
if(days>0){
return days +"天";
}else{
return "a little minute";
}
}
public static int differentDays(Date date1,Date date2) {
Calendar cal1 = Calendar.getInstance();
cal1.setTime(date1);
Calendar cal2 = Calendar.getInstance();
cal2.setTime(date2);
int day1= cal1.get(Calendar.DAY_OF_YEAR);
int day2 = cal2.get(Calendar.DAY_OF_YEAR);
int year1 = cal1.get(Calendar.YEAR);
int year2 = cal2.get(Calendar.YEAR);
if(year1 != year2) { //不同年
int timeDistance = 0 ;
for(int i = year1 ; i < year2 ; i ++) {
if(i%4==0 && i%100!=0 || i%400==0) { //闰年
timeDistance += 366;
} else{ //不是闰年
timeDistance += 365;
}
}
return timeDistance + (day2-day1) ;
} else{
return day2-day1;
}
}
//将时间戳转成时间
public static String timeStamp2Date(Long seconds) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(new Date(seconds));
}
//解析震动时间
public List<String> getTime(QueryResult queryResult){
List<List<Object>> values = getValues(queryResult);
List<String> time = new ArrayList<>();
for(List<Object> value:values){
try {
time.add(UTCToCST(value.get(0).toString()));
}catch (Exception e){
e.printStackTrace();
logger.info(e.toString());
}
}
return time;
}
public String UTCToCST(String UTCStr) throws ParseException {
Date date =null ;
if(UTCStr.length() !=20 ) {
date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(UTCStr);
}else{
date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(UTCStr);
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR, calendar.get(Calendar.HOUR) + 8);
//calendar.getTime() 返回的是Date类型,也可以使用calendar.getTimeInMillis()获取时间戳
//format的格式可以任意
return String.valueOf(calendar.getTimeInMillis());
}
public List<String> getShockLocation(QueryResult queryResult){
List<List<Object>> values = new ArrayList<>();
for(QueryResult.Result result : queryResult.getResults()){
if(result.getSeries() !=null){
for (QueryResult.Series series : result.getSeries()) {
if(series !=null){
values.add(series.getValues().get(0));
}
}
}
}
List<String> timeList = new ArrayList<>();
for(List<Object> value:values){
timeList.add(parseTime(value.get(0).toString()));
}
return timeList;
}
}
\ No newline at end of file
......@@ -35,116 +35,116 @@ public class EquipmentBindingController {
Gson gson = new Gson();
// @Autowired
// private ConfigService configService;
//
// @Autowired
// private GatewayService gatewayService;
//
// @Autowired
// private TDLDeviceService tdlDeviceService;
//
// @ApiOperation(value = "绑定gateWay和tdl",notes = "绑定gateWay和tdl" +
// " SN:gateWay编号," +
// " type:gateWay类型," +
// " mode:1--运输/2--仓库," +
// " TDLSN:tdl编号," +
// " transportationNo:运输编号," +
// " warehouseNo:仓库编号" )
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// @PostMapping("/binding")
// public Object binding(@RequestBody BindingVo bindingVo){
// //获取gateWay的信息
// ResultGatewayVo resultGatewayVo = gatewayService.getBySNAndType(bindingVo.getSN(),bindingVo.getType());
// if(resultGatewayVo.getUseScene() !=0 && resultGatewayVo.getUseScene() !=bindingVo.getMode()){
// fb.setCode(0);
// fb.setMessage("该网关所属环境与当前不符");
// return gson.toJson(fb);
// }
// //判断当前tdl是否有网关在使用
// ResultTDLDeviceVo resultTDLDeviceVo = tdlDeviceService.getByTDLSN(bindingVo.getTDLSN());
// if(!StringUtils.isEmpty(resultTDLDeviceVo.getGatewaySN())){
// fb.setCode(0);
// fb.setMessage("该TDL已经被使用");
// return gson.toJson(fb);
// }
// if(StringUtils.isEmpty(bindingVo.getTransportationNo()) && !StringUtils.isEmpty(bindingVo.getWarehouseNo())){
// bindingVo.setTransportationNo("");
// }else if(StringUtils.isEmpty(bindingVo.getWarehouseNo()) && !StringUtils.isEmpty(bindingVo.getTransportationNo())){
// bindingVo.setWarehouseNo("");
// }
// //开始绑定
// //获取gateway下的所有tdl的编号
// List<String> devList = tdlDeviceService.getByGatewaySN(bindingVo.getSN(),bindingVo.getType());
// devList.add(bindingVo.getTDLSN());
// ConfigCMDVo configCMDVo = new ConfigCMDVo("config",5,15,devList,bindingVo.getMode(),System.currentTimeMillis()/1000l);
// Map<Object,Object> map=new HashMap<>();
// map.put("transportationNo",bindingVo.getTransportationNo());
// map.put("warehouseNo",bindingVo.getWarehouseNo());
// map.put("useScene",bindingVo.getMode());
// map.put("gSN",bindingVo.getSN());
// map.put("gType",bindingVo.getType());
// map.put("message",gson.toJson(configCMDVo));
// map.put("flag",false);
// map.put("resp",null);
// map.put("state",1);
// map.put("untie",false);
// map.put("TDLSN",bindingVo.getTDLSN());
// map.put("createTime",System.currentTimeMillis());
// configService.addConfig(map);
// Map<Object,Object> msg=new HashMap<>();
// msg.put("msg",map.get("msg"));
// if (msg.get("msg").equals("配置网关成功")){
// fb.setCode(1);
// fb.setMessage(msg.get("msg").toString());
// }else{
// fb.setCode(0);
// fb.setMessage(msg.get("msg").toString());
// }
// return gson.toJson(fb);
// }
//
// @ApiOperation(value = "重置tdl",notes = "重置tdl")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// @PostMapping("/untie")
// public Object untie(@RequestBody String TDLSN){
// JSONObject jsonObject= JSON.parseObject(TDLSN);
// TDLSN=(String)jsonObject.get("TDLSN");
// //判断当前tdl是否有网关在使用
// ResultTDLDeviceVo resultTDLDeviceVo = tdlDeviceService.getByTDLSN(TDLSN);
// List<String> devList = tdlDeviceService.getByGatewaySN(resultTDLDeviceVo.getGatewaySN(),resultTDLDeviceVo.getGatewayType());
// ConfigVo configVo =configService.getConfig(resultTDLDeviceVo.getGatewaySN(),resultTDLDeviceVo.getGatewayType());
// ConfigCMDVo config = gson.fromJson(configVo.getMessage(),ConfigCMDVo.class);
// ConfigCMDVo configCMDVo ;
// Boolean untie = false;
// if(devList.size()>1){
// devList.remove(TDLSN);
// configCMDVo = new ConfigCMDVo("config",config.getGpsPeriod(),config.getGprsPeriod(),devList,config.getMode(),System.currentTimeMillis()/1000l);
// }else{
// configCMDVo = config;
// untie = true;
// }
// Map<Object,Object> map=new HashMap<>();
// map.put("gSN",resultTDLDeviceVo.getGatewaySN());
// map.put("gType",resultTDLDeviceVo.getGatewayType());
// map.put("message",gson.toJson(configCMDVo));
// map.put("untie",untie);
// map.put("TDLSN",TDLSN);
// map.put("endTime",System.currentTimeMillis());
// configService.updateConfig(map);
// Map<Object,Object> msg=new HashMap<>();
// msg.put("msg",map.get("msg"));
// if (msg.get("msg").equals("解除网关成功")){
// fb.setCode(1);
// fb.setMessage(msg.get("msg").toString());
// }else{
// fb.setCode(0);
// fb.setMessage(msg.get("msg").toString());
// }
// return gson.toJson(fb);
// }
@Autowired
private ConfigService configService;
@Autowired
private GatewayService gatewayService;
@Autowired
private TDLDeviceService tdlDeviceService;
@ApiOperation(value = "绑定gateWay和tdl",notes = "绑定gateWay和tdl" +
" SN:gateWay编号," +
" type:gateWay类型," +
" mode:1--运输/2--仓库," +
" TDLSN:tdl编号," +
" transportationNo:运输编号," +
" warehouseNo:仓库编号" )
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@PostMapping("/binding")
public Object binding(@RequestBody BindingVo bindingVo){
//获取gateWay的信息
ResultGatewayVo resultGatewayVo = gatewayService.getBySNAndType(bindingVo.getSN(),bindingVo.getType());
if(resultGatewayVo.getUseScene() !=0 && resultGatewayVo.getUseScene() !=bindingVo.getMode()){
fb.setCode(0);
fb.setMessage("该网关所属环境与当前不符");
return gson.toJson(fb);
}
//判断当前tdl是否有网关在使用
ResultTDLDeviceVo resultTDLDeviceVo = tdlDeviceService.getByTDLSN(bindingVo.getTDLSN());
if(!StringUtils.isEmpty(resultTDLDeviceVo.getGatewaySN())){
fb.setCode(0);
fb.setMessage("该TDL已经被使用");
return gson.toJson(fb);
}
if(StringUtils.isEmpty(bindingVo.getTransportationNo()) && !StringUtils.isEmpty(bindingVo.getWarehouseNo())){
bindingVo.setTransportationNo("");
}else if(StringUtils.isEmpty(bindingVo.getWarehouseNo()) && !StringUtils.isEmpty(bindingVo.getTransportationNo())){
bindingVo.setWarehouseNo("");
}
//开始绑定
//获取gateway下的所有tdl的编号
List<String> devList = tdlDeviceService.getByGatewaySN(bindingVo.getSN(),bindingVo.getType());
devList.add(bindingVo.getTDLSN());
ConfigCMDVo configCMDVo = new ConfigCMDVo("config",5,15,devList,bindingVo.getMode(),System.currentTimeMillis()/1000l);
Map<Object,Object> map=new HashMap<>();
map.put("transportationNo",bindingVo.getTransportationNo());
map.put("warehouseNo",bindingVo.getWarehouseNo());
map.put("useScene",bindingVo.getMode());
map.put("gSN",bindingVo.getSN());
map.put("gType",bindingVo.getType());
map.put("message",gson.toJson(configCMDVo));
map.put("flag",false);
map.put("resp",null);
map.put("state",1);
map.put("untie",false);
map.put("TDLSN",bindingVo.getTDLSN());
map.put("createTime",System.currentTimeMillis());
configService.addConfig(map);
Map<Object,Object> msg=new HashMap<>();
msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("配置网关成功")){
fb.setCode(1);
fb.setMessage(msg.get("msg").toString());
}else{
fb.setCode(0);
fb.setMessage(msg.get("msg").toString());
}
return gson.toJson(fb);
}
@ApiOperation(value = "重置tdl",notes = "重置tdl")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@PostMapping("/untie")
public Object untie(@RequestBody String TDLSN){
JSONObject jsonObject= JSON.parseObject(TDLSN);
TDLSN=(String)jsonObject.get("TDLSN");
//判断当前tdl是否有网关在使用
ResultTDLDeviceVo resultTDLDeviceVo = tdlDeviceService.getByTDLSN(TDLSN);
List<String> devList = tdlDeviceService.getByGatewaySN(resultTDLDeviceVo.getGatewaySN(),resultTDLDeviceVo.getGatewayType());
ConfigVo configVo =configService.getConfig(resultTDLDeviceVo.getGatewaySN(),resultTDLDeviceVo.getGatewayType());
ConfigCMDVo config = gson.fromJson(configVo.getMessage(),ConfigCMDVo.class);
ConfigCMDVo configCMDVo ;
Boolean untie = false;
if(devList.size()>1){
devList.remove(TDLSN);
configCMDVo = new ConfigCMDVo("config",config.getGpsPeriod(),config.getGprsPeriod(),devList,config.getMode(),System.currentTimeMillis()/1000l);
}else{
configCMDVo = config;
untie = true;
}
Map<Object,Object> map=new HashMap<>();
map.put("gSN",resultTDLDeviceVo.getGatewaySN());
map.put("gType",resultTDLDeviceVo.getGatewayType());
map.put("message",gson.toJson(configCMDVo));
map.put("untie",untie);
map.put("TDLSN",TDLSN);
map.put("endTime",System.currentTimeMillis());
configService.updateConfig(map);
Map<Object,Object> msg=new HashMap<>();
msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("解除网关成功")){
fb.setCode(1);
fb.setMessage(msg.get("msg").toString());
}else{
fb.setCode(0);
fb.setMessage(msg.get("msg").toString());
}
return gson.toJson(fb);
}
}
......@@ -4,7 +4,7 @@ import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.*;
import com.example.tdl.service.AlarmLogService;
import com.example.tdl.service.CircuitService;
import com.example.tdl.service.RouteService;
import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
......@@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@RestController
......@@ -25,92 +26,68 @@ public class HomePageController {
CommFeedback fb = new CommFeedback();
// @Autowired
// private CircuitService circuitService;
//
// @Autowired
// private AlarmLogService alarmLogServcie;
//
// //获取当天所有的设备数据
// @ApiOperation(value = "获取所有的运输数据",notes = "获取运输设备数据:" +
// "sum:总数量" +
// "onRoute:在途数量" +
// "complted:已完成数量" +
// "alarmed: 报警数量" +
// "routeVoList: " +
// "transportationNo:线路编号(R+TyyyyMMdd+运输方式+四位随机数)"+
// "routeName:路由名称(出发地-启运地)"+
// "startLongitude:启运经度"+
// "startLatitude:启运纬度"+
// "startCity:启运市"+
// "startTime:开始时间"+
// "endLongitude:目的经度"+
// "endLatitude:目的纬度"+
// "endCity:目的市"+
// "endTime:结束时间"+
// "transport:运输方式(T铁路,G汽运,H海运,K空运,D快递)"+
// "boxNo:箱单号" +
// "containerNo:集装箱号/车牌号" +
// "deliveryAddress:交付地点" +
// "transportationType:运输类型" +
// "circuitState:线路状态"+
// "remark:备注" +
// "alarmLogVoList :"+
// "routeName:线路名称"+
// "description:报警描述" +
// "data:数据"+
// "alarmTime:报警时间")
// @GetMapping("/getAll")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// public Object getAll(){
// HomePageDataVo dataVo = new HomePageDataVo();
// //获取所有的线路信息
// List<CircuitVo> resultCircuitVos = circuitService.getDistinct();
// //获取所有的报警
// List<AlarmLogVo> alarmLogVos = alarmLogServcie.getAll();
// // 获取所有的路线数量
// dataVo.setRouteVoList(resultCircuitVos);//路线列表
// dataVo.setAlarmLogVoList(alarmLogVos);//报警列表
// Integer sum = circuitService.getCount();
// dataVo.setSum(sum);//总数量
// Integer onRoute = circuitService.getOnRoute();
// dataVo.setOnRoute(onRoute);//在途数量
// //获取已经完成的数量
// Integer finished = circuitService.getComplted();
// dataVo.setComplted(finished);//已完成数量
// Integer alarmed = alarmLogServcie.getCount();
// dataVo.setAlarmed(alarmed);//报警数量
// return gson.toJson(dataVo);
// }
//
//
// //根据条件获取路线数据(所有的)
// @ApiOperation(value = "根据条件获取运输数据",notes = "传值:" +
// "time:时间(1,3,7,30...)" +
// "evaluation:评价" )
// @PostMapping("/getByTerm")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// })
// public Object getByTerm(@RequestBody TermVo termVo){
// HomePageDataVo dataVo = new HomePageDataVo();
// List<CircuitVo> resultCircuitVoList = circuitService.getByTime(termVo.getTime());//所有的路线
// List<AlarmLogVo> alarmLogVos = alarmLogServcie.getAlarmLog(termVo.getTime());
// dataVo.setRouteVoList(resultCircuitVoList);//路线列表
// dataVo.setAlarmLogVoList(alarmLogVos);//报警列表
// Integer sum = circuitService.getCount();
// dataVo.setSum(sum);//总数量
// //获取已经完成的数量
// Integer onRoute = circuitService.getOnRoute();
// dataVo.setOnRoute(onRoute);//在途数量
// //获取已经完成的数量
// Integer finished = circuitService.getComplted();
// dataVo.setComplted(finished);//已完成数量
// Integer alarmed = alarmLogServcie.getCount();
// dataVo.setAlarmed(alarmed);//报警数量
// return gson.toJson(dataVo);
// }
@Autowired
private CircuitService circuitService;
@Autowired
private AlarmLogService alarmLogServcie;
//获取当天所有的设备数据
@ApiOperation(value = "获取所有的运输数据",notes = "获取运输设备数据:" +
"sum:总数量" +
"onRoute:在途数量" +
"complted:已完成数量" +
"alarmed: 报警数量" +
"routeVoList: " +
"transportationNo:线路编号(R+TyyyyMMdd+运输方式+四位随机数)"+
"routeName:路由名称(出发地-启运地)"+
"startLongitude:启运经度"+
"startLatitude:启运纬度"+
"startCity:启运市"+
"startTime:开始时间"+
"endLongitude:目的经度"+
"endLatitude:目的纬度"+
"endCity:目的市"+
"endTime:结束时间"+
"transport:运输方式(T铁路,G汽运,H海运,K空运,D快递)"+
"boxNo:箱单号" +
"containerNo:集装箱号/车牌号" +
"deliveryAddress:交付地点" +
"transportationType:运输类型" +
"circuitState:线路状态"+
"remark:备注" +
"alarmLogVoList :"+
"routeName:线路名称"+
"description:报警描述" +
"data:数据"+
"alarmTime:报警时间")
@PostMapping("/getAll")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public Object getAll(@RequestBody Integer time){
//获取数量
HomePageDataVo dataVo = new HomePageDataVo();
//获取所有的线路数量
Integer sum = circuitService.getCount(time);
dataVo.setSum(sum);//总数量
Integer onRoute = circuitService.getOnRoute(time);
dataVo.setOnRoute(onRoute);//在途数量
//获取延误数量
Integer delay = circuitService.getDelayCount(System.currentTimeMillis());
dataVo.setDelay(delay);
//获取已经完成的数量
Integer alarmed = alarmLogServcie.getCount(time);
dataVo.setAlarmed(alarmed);//报警数量
//获取颠簸数量
Integer bump = alarmLogServcie.getBumpCount(time);
dataVo.setBump(bump);
//获取所有的报警
// 获取所有的路线数量
List<AlarmLogVo> alarmLogVos = new ArrayList<>();
dataVo.setAlarmLogVoList(alarmLogVos);//报警列表
return gson.toJson(dataVo);
}
}
package com.example.tdl.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.AddRouteVo;
import com.example.tdl.domain.vo.RouteTermVo;
import com.example.tdl.domain.vo.UpdateRouteVo;
import com.example.tdl.entity.Route;
import com.example.tdl.service.RouteService;
import com.example.tdl.service.redis.TokenRedisService;
import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/route")
......
......@@ -4,7 +4,6 @@ package com.example.tdl.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.AddUserRouteVo;
import com.example.tdl.domain.vo.UpdateUserRouteVo;
import com.example.tdl.domain.vo.UserRedisVo;
import com.example.tdl.service.UserRouteService;
......
......@@ -3,19 +3,21 @@
<mapper namespace="com.example.tdl.mapper.AlarmLogMapper">
<!--获取所有的报警数据-->
<select id="getAll" resultType="com.example.tdl.domain.vo.AlarmLogVo">
select routeName,description,data,alarmTime from alarm_log order by alarmTime desc limit 10;
select TDLSN,description,data,alarmTime from alarm_log
where DATE_SUB(CURDATE(), INTERVAL 3 DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
order by alarmTime desc;
</select>
<select id="getByTransportationNo" resultType="com.example.tdl.domain.vo.ResultAlarmLog" parameterType="String">
select transportationNo,routeName,description,data,alarmTime from alarm_log where transportationNo=#{transportationNo,jdbcType=VARCHAR};
select transportationNo,TDLSN,description,data,alarmTime from alarm_log where transportationNo=#{transportationNo,jdbcType=VARCHAR};
</select>
<!--根据条件获取报警数据-->
<select id="getAlarmLog" resultType="com.example.tdl.domain.vo.AlarmLogVo">
select routeName,description,data,alarmTime
select TDLSN,description,data,alarmTime
from alarm_log
where DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
order by alarmTime desc limit 10;
order by alarmTime desc;
</select>
<insert id="addAlarmLog" parameterType="com.example.tdl.domain.vo.AddAlarmLogVo">
......@@ -23,7 +25,7 @@
values(
null,
#{transportationNo,jdbcType=VARCHAR},
#{routeName,jdbcType=VARCHAR},
#{TDLSN,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
#{data,jdbcType=FLOAT},
#{alarmTime,jdbcType=INTEGER}
......@@ -32,5 +34,32 @@
<select id="getCount" resultType="java.lang.Integer">
select count(DISTINCT transportationNo) from alarm_log
where DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=INTEGER} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
</select>
<select id="getBumpCount" resultType="java.lang.Integer">
select count(DISTINCT transportationNo) from alarm_log
where description like CONCAT(CONCAT('%',"震动"),'%')
and DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=INTEGER} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
</select>
<select id = "getByCount" parameterType="java.lang.Integer" >
SELECT description,count(description) FROM alarm_log WHERE description LIKE "温度%"
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=INTEGER} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
UNION ALL
SELECT description,count(description) FROM alarm_log WHERE description LIKE "震动%"
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=INTEGER} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
UNION ALL
SELECT description,count(description) FROM alarm_log WHERE description LIKE "湿度%"
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=INTEGER} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
UNION ALL
SELECT description,count(description) FROM alarm_log WHERE description LIKE "光爆%"
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=INTEGER} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
UNION ALL
SELECT description,count(description) FROM alarm_log WHERE description LIKE "延迟%"
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=INTEGER} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
UNION ALL
SELECT description,count(description) FROM alarm_log WHERE description LIKE "离线%"
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=INTEGER} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.tdl.mapper.CircuitMapper">
<!-- <select id="getAll" resultType="com.example.tdl.domain.vo.ResultCircuitVo">
SELECT transportationNo,routeNumber,routeName,startLongitude,startLatitude,(select city from city_config where id=r.start_id) startCity,
startAddress,startTime,endLongitude,endLatitude,(select city from city_config where id=r.end_id) endCity,endAddress,endTime,transport,
IFNULL((SELECT alarmType FROM alarm WHERE id=c.alarm_id),"正常") alarmType,boxNo,containerNo,deliveryAddress,transportationType,
circuitState,c.remark,c.createTime,c.evaluate,c.evaluateRemark
from circuit c,route r WHERE c.route_id=r.id AND r.state=1 AND c.state=1 order BY c.id DESC
<!--获取所有线路的信息-->
<select id="getAll" resultType="com.example.tdl.domain.vo.ResultCircuitVo">
SELECT transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,
startTime,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
IFNULL((SELECT alarmType FROM alarm WHERE id=c.alarm_id),"正常") alarmType from circuit c where c.state=1
</select>
<select id="getDistinct" resultType="com.example.tdl.domain.vo.CircuitVo">
SELECT transportationNo,routeName,startLongitude,startLatitude,(select city from city_config where id=r.start_id) startCity,startTime,endLongitude,endLatitude,
(select city from city_config where id=r.end_id) endCity,endTime,transport,boxNo,containerNo,deliveryAddress,
transportationType,circuitState,c.remark ,SUBSTRING_INDEX(routeName,'_',2) routes
from circuit c,route r
WHERE c.route_id=r.id
AND r.state=1
AND c.state=1
GROUP BY routes
order BY c.id
</select>
<!--根据条件查询线路信息-->
<select id="getByTerm" resultType="com.example.tdl.domain.vo.ResultCircuitVo" parameterType="com.example.tdl.domain.vo.CircuitTermVo">
SELECT transportationNo,routeNumber,routeName,startLongitude,startLatitude,(select city from city_config where id=r.start_id) startCity,
startAddress,startTime,endLongitude,endLatitude,(select city from city_config where id=r.end_id) endCity,endAddress,endTime,transport,
IFNULL((SELECT alarmType FROM alarm WHERE id=c.alarm_id),"正常") alarmType,boxNo,containerNo,deliveryAddress,transportationType,
circuitState,c.remark,c.createTime,c.evaluate,c.evaluateRemark
from circuit c,route r WHERE c.route_id=r.id AND r.state=1 AND c.state=1
<if test="transportationNo!=null">
AND transportationNo like CONCAT(CONCAT('%',#{transportationNo,jdbcType=VARCHAR}),'%')
</if>
<if test="routeNumber!=null">
AND routeNumber like CONCAT(CONCAT('%',#{routeNumber,jdbcType=VARCHAR}),'%')
</if>
<if test="alarmType!=null and alarmType==0">
AND alarm_id is NULL
</if>
<if test="alarmType!=null and alarmType==1">
AND alarm_id is NOT NULL
</if>
SELECT transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,
startTime,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
IFNULL((SELECT alarmType FROM alarm WHERE id=c.alarm_id),"正常") alarmType from circuit c where c.state=1
<if test="circuitState!=null">
AND circuitState=#{circuitState,jdbcType=INTEGER}
</if>
<if test="startCity!=null">
AND startCity like CONCAT(CONCAT('%',#{startCity,jdbcType=VARCHAR}),'%')
</if>
<if test="endCity!=null">
AND endCity like CONCAT(CONCAT('%',#{endCity,jdbcType=VARCHAR}),'%')
<if test="cargoNo!=null">
AND cargoNo like CONCAT(CONCAT('%',#{cargoNo,jdbcType=VARCHAR}),'%')
</if>
<if test="startTimeMin!=null">
AND startTime BETWEEN #{startTimeMin,jdbcType=BIGINT} AND #{startTimeMax,jdbcType=BIGINT}
<if test="startTime!=null">
AND startTime &gt;= #{startTime,jdbcType=BIGINT}
</if>
<if test="endTimeMin!=null">
AND endTime BETWEEN #{endTimeMin,jdbcType=BIGINT} AND #{endTimeMax,jdbcType=BIGINT}
<if test="endTime!=null">
AND endTime &lt;= #{endTime,jdbcType=BIGINT}
</if>
</select>
<insert id="addCircuit" parameterType="java.util.Map" statementType="CALLABLE">
<![CDATA[
{
call pro_addCircuit(
#{routeNumber,mode=IN,jdbcType=VARCHAR},
#{routeName,mode=IN,jdbcType=VARCHAR},
#{startCountry,mode=IN,jdbcType=VARCHAR},
#{startProvince,mode=IN,jdbcType=VARCHAR},
#{startCity,mode=IN,jdbcType=VARCHAR},
#{endCountry,mode=IN,jdbcType=VARCHAR},
#{endProvince,mode=IN,jdbcType=VARCHAR},
#{endCity,mode=IN,jdbcType=VARCHAR},
#{transport,mode=IN,jdbcType=VARCHAR},
#{createTime,mode=IN,jdbcType=BIGINT},
#{updateTime,mode=IN,jdbcType=BIGINT},
#{rRemark,mode=IN,jdbcType=BIGINT},
#{transportationNo,mode=IN,jdbcType=VARCHAR},
#{startLongitude,mode=IN,jdbcType=VARCHAR},
#{startLatitude,mode=IN,jdbcType=VARCHAR},
#{startAddress,mode=IN,jdbcType=VARCHAR},
#{startTime,mode=IN,jdbcType=BIGINT},
#{endLongitude,mode=IN,jdbcType=VARCHAR},
#{endLatitude,mode=IN,jdbcType=VARCHAR},
#{endAddress,mode=IN,jdbcType=VARCHAR},
#{endTime,mode=IN,jdbcType=BIGINT},
#{boxNo,mode=IN,jdbcType=VARCHAR},
#{containerNo,mode=IN,jdbcType=VARCHAR},
#{expTime,mode=IN,jdbcType=BIGINT},
#{compTime,mode=IN,jdbcType=BIGINT},
#{alarmType,mode=IN,jdbcType=VARCHAR},
#{cargoNo,mode=IN,jdbcType=VARCHAR},
#{cargoName,mode=IN,jdbcType=VARCHAR},
#{plateNo,mode=IN,jdbcType=VARCHAR},
#{deliveryAddress,mode=IN,jdbcType=VARCHAR},
#{transportation,mode=IN,jdbcType=VARCHAR},
#{transportationType,mode=IN,jdbcType=VARCHAR},
#{createTime,mode=IN,jdbcType=BIGINT},
#{remark,mode=IN,jdbcType=VARCHAR},
#{counts,mode=IN,jdbcType=INTEGER},
#{countryVar,mode=IN,jdbcType=VARCHAR},
#{cityVar,mode=IN,jdbcType=VARCHAR},
#{addressDetailVar,mode=IN,jdbcType=VARCHAR},
#{lngVar,mode=IN,jdbcType=VARCHAR},
#{latVar,mode=IN,jdbcType=VARCHAR},
#{postCodeVar,mode=IN,jdbcType=VARCHAR},
#{arrivalTimeVar,mode=IN,jdbcType=VARCHAR},
#{startTimeVar,mode=IN,jdbcType=VARCHAR},
#{expTimeVar,mode=IN,jdbcType=BIGINT},
#{compTimeVar,mode=IN,jdbcType=VARCHAR},
#{SN,mode=IN,jdbcType=VARCHAR},
#{type,mode=IN,jdbcType=VARCHAR},
#{TDLSN,mode=IN,jdbcType=VARCHAR},
#{message,mode=IN,jdbcType=VARCHAR},
#{flag,mode=IN,jdbcType=INTEGER},
#{untie,mode=IN,jdbcType=INTEGER},
#{msg,mode=OUT,jdbcType=VARCHAR}
)
}
]]>
</insert>
<update id="updateEndTime" parameterType="com.example.tdl.domain.vo.UpdateCircuitVo">
UPDATE circuit set
endTime=#{endTime,jdbcType=BIGINT},circuitState=2
WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR}
</update>
<update id="updateCircuit" parameterType="java.util.Map" statementType="CALLABLE">
<![CDATA[
{
call pro_updateCircuit(
#{routeNumber,mode=IN,jdbcType=VARCHAR},
#{routeName,mode=IN,jdbcType=VARCHAR},
#{startCountry,mode=IN,jdbcType=VARCHAR},
#{startProvince,mode=IN,jdbcType=VARCHAR},
#{startCity,mode=IN,jdbcType=VARCHAR},
#{endCountry,mode=IN,jdbcType=VARCHAR},
#{endProvince,mode=IN,jdbcType=VARCHAR},
#{endCity,mode=IN,jdbcType=VARCHAR},
#{transport,mode=IN,jdbcType=VARCHAR},
#{createTime,mode=IN,jdbcType=BIGINT},
#{updateTime,mode=IN,jdbcType=BIGINT},
#{rRemark,mode=IN,jdbcType=BIGINT},
#{transportationNo,mode=IN,jdbcType=VARCHAR},
#{startLongitude,mode=IN,jdbcType=VARCHAR},
#{startLatitude,mode=IN,jdbcType=VARCHAR},
#{startAddress,mode=IN,jdbcType=VARCHAR},
#{startTime,mode=IN,jdbcType=VARCHAR},
#{endLongitude,mode=IN,jdbcType=VARCHAR},
#{endLatitude,mode=IN,jdbcType=VARCHAR},
#{endAddress,mode=IN,jdbcType=VARCHAR},
#{endTime,mode=IN,jdbcType=VARCHAR},
#{boxNo,mode=IN,jdbcType=VARCHAR},
#{containerNo,mode=IN,jdbcType=VARCHAR},
#{startTime,mode=IN,jdbcType=BIGINT},
#{expTime,mode=IN,jdbcType=VARCHAR},
#{compTime,mode=IN,jdbcType=VARCHAR},
#{alarmType,mode=IN,jdbcType=VARCHAR},
#{cargoNo,mode=IN,jdbcType=VARCHAR},
#{cargoName,mode=IN,jdbcType=VARCHAR},
#{plateNo,mode=IN,jdbcType=VARCHAR},
#{deliveryAddress,mode=IN,jdbcType=VARCHAR},
#{transportationType,mode=IN,jdbcType=VARCHAR},
#{transportation,mode=IN,jdbcType=BIGINT},
#{transportationType,mode=IN,jdbcType=BIGINT},
#{createTime,mode=IN,jdbcType=BIGINT},
#{remark,mode=IN,jdbcType=VARCHAR},
#{counts,mode=IN,jdbcType=VARCHAR},
#{countryVar,mode=IN,jdbcType=VARCHAR},
#{cityVar,mode=IN,jdbcType=VARCHAR},
#{addressDetailVar,mode=IN,jdbcType=VARCHAR},
#{lngVar,mode=IN,jdbcType=VARCHAR},
#{latVar,mode=IN,jdbcType=VARCHAR},
#{postCodeVar,mode=IN,jdbcType=VARCHAR},
#{arrivalTimeVar,mode=IN,jdbcType=VARCHAR},
#{startTimeVar,mode=IN,jdbcType=VARCHAR},
#{expTimeVar,mode=IN,jdbcType=VARCHAR},
#{compTimeVar,mode=IN,jdbcType=VARCHAR},
#{msg,mode=OUT,jdbcType=VARCHAR}
)
}
]]>
</update>
<!-- 修改结束时间-->
<update id="updateEndTime" parameterType="com.example.tdl.domain.vo.UpdateCircuitVo">
UPDATE circuit set
endTime=#{endTime,jdbcType=BIGINT},circuitState=2
WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR}
</update>
<!--删除线路-->
<delete id="delCircuit" parameterType="String">
UPDATE circuit set state=0
WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR}
</delete>
<!-- 运输中数量-->
<select id="getOnRoute" resultType="java.lang.Integer">
select count( startTime) from circuit where circuitState=1
</select>
<!--延误数量-->
<select id="getDelayCount" resultType="java.lang.Integer" parameterType="java.lang.Integer">
select count(id) from circuit where state =1 and endtime &lt;=compTime or compTime >= #{compTime,jdbcType=BIGINT}
</select>
<!--总数量-->
<select id="getCount" resultType="java.lang.Integer">
select count(id) from circuit
</select>
<!--根据线路编号获取线路信息-->
<select id="getByTransportationNo" resultType="com.example.tdl.domain.vo.ResultCircuitVo" parameterType="String">
SELECT transportationNo,routeNumber,routeName,startLongitude,startLatitude,(select city from city_config where id=r.start_id) startCity,
startAddress,startTime,endLongitude,endLatitude,(select city from city_config where id=r.end_id) endCity,endAddress,endTime,transport,
IFNULL((SELECT alarmType FROM alarm WHERE id=c.alarm_id),"正常") alarmType,boxNo,containerNo,deliveryAddress,transportationType,
circuitState,c.remark,c.createTime,c.evaluate,c.evaluateRemark
from circuit c,route r WHERE c.route_id=r.id AND r.state=1 AND c.state=1 AND transportationNo=#{transportationNo,jdbcType=VARCHAR}
SELECT transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,
startTime,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
IFNULL((SELECT alarmType FROM alarm WHERE id=c.alarm_id),"正常") alarmType from circuit c
where c.state=1
AND transportationNo=#{transportationNo,jdbcType=VARCHAR}
</select>
<!--根据车牌号查线路-->
<select id="getByContainerNo" parameterType="String" resultType="com.example.tdl.domain.vo.ResultCircuitVo">
SELECT transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,
startTime,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
IFNULL((SELECT alarmType FROM alarm WHERE id=c.alarm_id),"正常") alarmType from circuit c
where c.state=1 AND cargoNo=#{cargoNo,jdbcType=VARCHAR}
</select>
<!--根据运输状态查询线路信息-->
<select id="getByCircuitState" parameterType="java.lang.Integer" resultType="com.example.tdl.domain.vo.ResultCircuitVo">
SELECT transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,
startTime,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
IFNULL((SELECT alarmType FROM alarm WHERE id=c.alarm_id),"正常") alarmType from circuit c where c.state=1
AND circuitState=#{circuitState,jdbcType=INTEGER}
</select>
<!--评价-->
<update id="updateEvaluate" parameterType="com.example.tdl.domain.vo.UpdateEvaluateVo">
update circuit set
evaluate=#{evaluate,jdbcType=FLOAT},
evaluateRemark=#{evaluateRemark,jdbcType=VARCHAR}
WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR}
</update>
<select id="getNo" parameterType="String" resultType="java.lang.Integer">
SELECT count(transportationNo) from circuit WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR}
</select>
<select id="getByNo" parameterType="String" resultType="com.example.tdl.domain.vo.ResultGatewayVo">
SELECT SN,`name`,type,state,bConfig,useScene,from_unixtime((createTime/1000),'%Y-%m-%d %T') createTime,from_unixtime((updateTime/1000),'%Y-%m-%d %T') updateTime
......@@ -155,17 +181,19 @@
SELECT id from circuit WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR}) LIMIT 1)
</select>
<select id="getOnRoute" resultType="java.lang.Integer">
select count( startTime) from circuit where circuitState=1
</select>
<select id="getComplted" resultType="java.lang.Integer">
select count(id) from circuit where circuitState=2
<!--
<select id="getDistinct" resultType="com.example.tdl.domain.vo.CircuitVo">
SELECT transportationNo,routeName,startLongitude,startLatitude,(select city from city_config where id=r.start_id) startCity,startTime,endLongitude,endLatitude,
(select city from city_config where id=r.end_id) endCity,endTime,transport,boxNo,containerNo,deliveryAddress,
transportationType,circuitState,c.remark ,SUBSTRING_INDEX(routeName,'_',2) routes
from circuit c,route r
WHERE c.route_id=r.id
AND r.state=1
AND c.state=1
GROUP BY routes
order BY c.id
</select>
<select id="getCount" resultType="java.lang.Integer">
select count(id) from circuit
</select>
<select id="getByTime" resultType="com.example.tdl.domain.vo.CircuitVo">
SELECT transportationNo,routeName,startLongitude,startLatitude,(select city from city_config where id=r.start_id) startCity,startTime,endLongitude,endLatitude,
......@@ -179,28 +207,5 @@
GROUP BY routes
order BY c.id
</select>
<select id="getByContainerNo" parameterType="String" resultType="com.example.tdl.domain.vo.ResultCircuitVo">
SELECT transportationNo,routeNumber,routeName,startLongitude,startLatitude,(select city from city_config where id=r.start_id) startCity,
startAddress,startTime,endLongitude,endLatitude,(select city from city_config where id=r.end_id) endCity,endAddress,endTime,transport,
IFNULL((SELECT alarmType FROM alarm WHERE id=c.alarm_id),"正常") alarmType,boxNo,containerNo,deliveryAddress,transportationType,
circuitState,c.remark,c.createTime,c.evaluate,c.evaluateRemark
from circuit c,route r WHERE c.route_id=r.id AND r.state=1 AND c.state=1 AND containerNo=#{containerNo,jdbcType=VARCHAR}
</select>
<update id="updateEvaluate" parameterType="com.example.tdl.domain.vo.UpdateEvaluateVo">
update circuit set
evaluate=#{evaluate,jdbcType=FLOAT},
evaluateRemark=#{evaluateRemark,jdbcType=VARCHAR}
WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR}
</update>
<select id="getByCircuitState" parameterType="java.lang.Integer" resultType="com.example.tdl.domain.vo.ResultCircuitVo">
SELECT transportationNo,routeNumber,routeName,startLongitude,startLatitude,(select city from city_config where id=r.start_id) startCity,
startAddress,startTime,endLongitude,endLatitude,(select city from city_config where id=r.end_id) endCity,endAddress,endTime,transport,
IFNULL((SELECT alarmType FROM alarm WHERE id=c.alarm_id),"正常") alarmType,boxNo,containerNo,deliveryAddress,transportationType,
circuitState,c.remark,c.createTime,c.evaluate,c.evaluateRemark
from circuit c,route r WHERE c.route_id=r.id AND r.state=1 AND c.state=1
AND circuitState=#{circuitState,jdbcType=INTEGER}
</select>-->
-->
</mapper>
\ No newline at end of file
......@@ -6,6 +6,10 @@
from gateway
</select>
<select id="getBySN" resultType="String" parameterType="String">
SELECT type from gateway where SN=#{SN,jdbcType=VARCHAR}
</select>
<insert id="addGateway" parameterType="java.util.Map" statementType="CALLABLE">
<![CDATA[
{
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.tdl.mapper.TDLLogMapper">
<!-- <select id="getByNo" parameterType="String" resultType="com.example.tdl.domain.vo.ResultGatewayVo">
<select id="getByNo" parameterType="String" resultType="com.example.tdl.domain.vo.ResultGatewayVo">
select gatewaySN SN,gatewayType type from tdl_gateway_log
where transportationNo = #{transportationNo,jdbcType=VARCHAR}
GROUP BY gatewaySN
</select>-->
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment