Commit 2d27b404 authored by zhuangzhuang's avatar zhuangzhuang

3.27--线路增删改查

parent 65f8c992
...@@ -4,7 +4,7 @@ public class AddAlarmLogVo { ...@@ -4,7 +4,7 @@ public class AddAlarmLogVo {
private String transportationNo; private String transportationNo;
private String routeName; private String TDLSN;
private String description; private String description;
...@@ -15,9 +15,9 @@ public class AddAlarmLogVo { ...@@ -15,9 +15,9 @@ public class AddAlarmLogVo {
public 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.transportationNo = transportationNo;
this.routeName = routeName; this.TDLSN = TDLSN;
this.description = description; this.description = description;
this.data = data; this.data = data;
this.alarmTime = alarmTime; this.alarmTime = alarmTime;
...@@ -31,12 +31,12 @@ public class AddAlarmLogVo { ...@@ -31,12 +31,12 @@ public class AddAlarmLogVo {
this.transportationNo = transportationNo; this.transportationNo = transportationNo;
} }
public String getRouteName() { public String getTDLSN() {
return routeName; return TDLSN;
} }
public void setRouteName(String routeName) { public void setTDLSN(String TDLSN) {
this.routeName = routeName; this.TDLSN = TDLSN;
} }
public String getDescription() { public String getDescription() {
......
package com.example.tdl.domain.vo; 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; public class AddCircuitVo {
private String startLatitude;
private String startAddress;
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; private String remark;
public String getrRemark() { public List<AddressVo> getAddressVoList() {
return rRemark; return addressVoList;
}
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 void setEndLongitude(String endLongitude) { public void setAddressVoList(List<AddressVo> addressVoList) {
this.endLongitude = endLongitude; this.addressVoList = addressVoList;
} }
public String getEndLatitude() { public String getSN() {
return endLatitude; return SN;
} }
public void setEndLatitude(String endLatitude) { public void setSN(String SN) {
this.endLatitude = endLatitude; this.SN = SN;
} }
public String getEndAddress() { public String getTDLSN() {
return endAddress; return TDLSN;
} }
public void setEndAddress(String endAddress) { public void setTDLSN(String TDLSN) {
this.endAddress = endAddress; this.TDLSN = TDLSN;
} }
public String getBoxNo() { public String getAlarmType() {
return boxNo; return alarmType;
} }
public void setBoxNo(String boxNo) { public void setAlarmType(String alarmType) {
this.boxNo = boxNo; this.alarmType = alarmType;
} }
public String getContainerNo() { public String getCargoNo() {
return containerNo; return cargoNo;
} }
public void setContainerNo(String containerNo) { public void setCargoNo(String cargoNo) {
this.containerNo = containerNo; this.cargoNo = cargoNo;
} }
public String getDeliveryAddress() { public String getPlateNo() {
return deliveryAddress; return plateNo;
} }
public void setDeliveryAddress(String deliveryAddress) { public void setPlateNo(String plateNo) {
this.deliveryAddress = deliveryAddress; this.plateNo = plateNo;
} }
public String getTransportationType() { public String getCargoName() {
return transportationType; return cargoName;
} }
public void setTransportationType(String transportationType) { public void setCargoName(String cargoName) {
this.transportationType = transportationType; this.cargoName = cargoName;
} }
public String getRemark() { 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; ...@@ -2,7 +2,7 @@ package com.example.tdl.domain.vo;
public class AlarmLogVo { public class AlarmLogVo {
private String routeName; private String TDLSN;
private String description; private String description;
...@@ -10,12 +10,12 @@ public class AlarmLogVo { ...@@ -10,12 +10,12 @@ public class AlarmLogVo {
private Long alarmTime; private Long alarmTime;
public String getRouteName() { public String getTDLSN() {
return routeName; return TDLSN;
} }
public void setRouteName(String routeName) { public void setTDLSN(String TDLSN) {
this.routeName = routeName; this.TDLSN = TDLSN;
} }
public String getDescription() { public String getDescription() {
......
package com.example.tdl.domain.vo; package com.example.tdl.domain.vo;
public class CircuitTermVo { public class CircuitTermVo {
private String transportationNo; private String cargoNo;
private String routeNumber;
private Integer alarmType;
private Integer circuitState; private Integer circuitState;
private String startCity; private Long startTime;
private String endCity;
private Long startTimeMin;
private Long startTimeMax;
private Long endTimeMin;
private Long endTimeMax;
private Long endTime;
public String getTransportationNo() { public String getCargoNo() {
return transportationNo; return cargoNo;
}
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 void setAlarmType(Integer alarmType) { public void setCargoNo(String cargoNo) {
this.alarmType = alarmType; this.cargoNo = cargoNo;
} }
public Integer getCircuitState() { public Integer getCircuitState() {
...@@ -55,51 +25,19 @@ public class CircuitTermVo { ...@@ -55,51 +25,19 @@ public class CircuitTermVo {
this.circuitState = circuitState; this.circuitState = circuitState;
} }
public String getStartCity() { public Long getStartTime() {
return startCity; return startTime;
}
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 void setEndTimeMin(Long endTimeMin) { public void setStartTime(Long startTime) {
this.endTimeMin = endTimeMin; this.startTime = startTime;
} }
public Long getEndTimeMax() { public Long getEndTime() {
return endTimeMax; return endTime;
} }
public void setEndTimeMax(Long endTimeMax) { public void setEndTime(Long endTime) {
this.endTimeMax = endTimeMax; this.endTime = endTime;
} }
} }
package com.example.tdl.domain.vo; package com.example.tdl.domain.vo;
public class CircuitVo { public class CircuitVo {
private String transportationNo; private String transportationNo;
private String routeName; private String cargoNo;
private String startLongitude;
private String startLatitude;
private String startCity; private String startCity;
private String startTime;
private String endLongitude;
private String endLatitude;
private String endCity; private String endCity;
private String endTime; private Long startTime;
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;
}
public void setTransportationType(String transportationType) { private Long endTime;
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;
}
} }
...@@ -8,16 +8,14 @@ public class HomePageDataVo { ...@@ -8,16 +8,14 @@ public class HomePageDataVo {
private Integer onRoute;//在途数量 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; private List<AlarmLogVo> alarmLogVoList;
//报警原因分析
public Integer getSum() { public Integer getSum() {
return sum; return sum;
...@@ -35,14 +33,6 @@ public class HomePageDataVo { ...@@ -35,14 +33,6 @@ public class HomePageDataVo {
this.onRoute = onRoute; this.onRoute = onRoute;
} }
public Integer getComplted() {
return complted;
}
public void setComplted(Integer complted) {
this.complted = complted;
}
public Integer getAlarmed() { public Integer getAlarmed() {
return alarmed; return alarmed;
} }
...@@ -51,12 +41,20 @@ public class HomePageDataVo { ...@@ -51,12 +41,20 @@ public class HomePageDataVo {
this.alarmed = alarmed; this.alarmed = alarmed;
} }
public List<CircuitVo> getRouteVoList() { public Integer getDelay() {
return routeVoList; return delay;
}
public void setDelay(Integer delay) {
this.delay = delay;
}
public Integer getBump() {
return bump;
} }
public void setRouteVoList(List<CircuitVo> routeVoList) { public void setBump(Integer bump) {
this.routeVoList = routeVoList; this.bump = bump;
} }
public List<AlarmLogVo> getAlarmLogVoList() { public List<AlarmLogVo> getAlarmLogVoList() {
......
...@@ -4,7 +4,7 @@ public class ResultAlarmLog { ...@@ -4,7 +4,7 @@ public class ResultAlarmLog {
private String transportationNo; private String transportationNo;
private String routeName; private String TDLSN;
private String description; private String description;
...@@ -20,12 +20,12 @@ public class ResultAlarmLog { ...@@ -20,12 +20,12 @@ public class ResultAlarmLog {
this.transportationNo = transportationNo; this.transportationNo = transportationNo;
} }
public String getRouteName() { public String getTDLSN() {
return routeName; return TDLSN;
} }
public void setRouteName(String routeName) { public void setTDLSN(String TDLSN) {
this.routeName = routeName; this.TDLSN = TDLSN;
} }
public String getDescription() { public String getDescription() {
......
...@@ -3,52 +3,20 @@ package com.example.tdl.domain.vo; ...@@ -3,52 +3,20 @@ package com.example.tdl.domain.vo;
public class ResultCircuitVo { public class ResultCircuitVo {
private String transportationNo; private String transportationNo;
private String routeNumber; private String cargoNo;//货物编号
private String routeName;
private String startLongitude;
private String startLatitude;
private String startCity; private String startCity;
private String startAddress;
private Long startTime; private Long startTime;
private String endLongitude;
private String endLatitude;
private String endCity; private String endCity;
private String endAddress;
private Long endTime; private Long endTime;
private String transport; private Integer circuitState;
private String alarmType; 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() { public String getTransportationNo() {
return transportationNo; return transportationNo;
} }
...@@ -57,36 +25,12 @@ public class ResultCircuitVo { ...@@ -57,36 +25,12 @@ public class ResultCircuitVo {
this.transportationNo = transportationNo; this.transportationNo = transportationNo;
} }
public String getRouteNumber() { public String getCargoNo() {
return routeNumber; return cargoNo;
}
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 void setStartLongitude(String startLongitude) { public void setCargoNo(String cargoNo) {
this.startLongitude = startLongitude; this.cargoNo = cargoNo;
}
public String getStartLatitude() {
return startLatitude;
}
public void setStartLatitude(String startLatitude) {
this.startLatitude = startLatitude;
} }
public String getStartCity() { public String getStartCity() {
...@@ -97,14 +41,6 @@ public class ResultCircuitVo { ...@@ -97,14 +41,6 @@ public class ResultCircuitVo {
this.startCity = startCity; this.startCity = startCity;
} }
public String getStartAddress() {
return startAddress;
}
public void setStartAddress(String startAddress) {
this.startAddress = startAddress;
}
public Long getStartTime() { public Long getStartTime() {
return startTime; return startTime;
} }
...@@ -113,22 +49,6 @@ public class ResultCircuitVo { ...@@ -113,22 +49,6 @@ public class ResultCircuitVo {
this.startTime = 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() { public String getEndCity() {
return endCity; return endCity;
} }
...@@ -137,14 +57,6 @@ public class ResultCircuitVo { ...@@ -137,14 +57,6 @@ public class ResultCircuitVo {
this.endCity = endCity; this.endCity = endCity;
} }
public String getEndAddress() {
return endAddress;
}
public void setEndAddress(String endAddress) {
this.endAddress = endAddress;
}
public Long getEndTime() { public Long getEndTime() {
return endTime; return endTime;
} }
...@@ -153,12 +65,12 @@ public class ResultCircuitVo { ...@@ -153,12 +65,12 @@ public class ResultCircuitVo {
this.endTime = endTime; this.endTime = endTime;
} }
public String getTransport() { public Integer getCircuitState() {
return transport; return circuitState;
} }
public void setTransport(String transport) { public void setCircuitState(Integer circuitState) {
this.transport = transport; this.circuitState = circuitState;
} }
public String getAlarmType() { public String getAlarmType() {
...@@ -168,76 +80,4 @@ public class ResultCircuitVo { ...@@ -168,76 +80,4 @@ public class ResultCircuitVo {
public void setAlarmType(String alarmType) { public void setAlarmType(String alarmType) {
this.alarmType = 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; package com.example.tdl.domain.vo;
import java.util.List;
public class UpdateCircuitInfo { public class UpdateCircuitInfo {
private String transportationNo; private String transportationNo;
private String routeNumber; private List<AddressVo> addressVoList;
private String startCountry;
private String startProvince;
private String startCity;
private String endCountry;
private String endProvince;
private String endCity;
private String transport;
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 cargoName;
private String endAddress;
private String boxNo;
private String containerNo;
private String deliveryAddress;
private String transportationType;
private String remark; private String remark;
...@@ -51,156 +29,60 @@ public class UpdateCircuitInfo { ...@@ -51,156 +29,60 @@ public class UpdateCircuitInfo {
this.transportationNo = transportationNo; this.transportationNo = transportationNo;
} }
public String getRouteNumber() { public List<AddressVo> getAddressVoList() {
return routeNumber; return addressVoList;
}
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 void setEndLongitude(String endLongitude) { public void setAddressVoList(List<AddressVo> addressVoList) {
this.endLongitude = endLongitude; this.addressVoList = addressVoList;
} }
public String getEndLatitude() { public String getSN() {
return endLatitude; return SN;
} }
public void setEndLatitude(String endLatitude) { public void setSN(String SN) {
this.endLatitude = endLatitude; this.SN = SN;
} }
public String getEndAddress() { public String getTDLSN() {
return endAddress; return TDLSN;
} }
public void setEndAddress(String endAddress) { public void setTDLSN(String TDLSN) {
this.endAddress = endAddress; this.TDLSN = TDLSN;
} }
public String getBoxNo() { public String getAlarmType() {
return boxNo; return alarmType;
} }
public void setBoxNo(String boxNo) { public void setAlarmType(String alarmType) {
this.boxNo = boxNo; this.alarmType = alarmType;
} }
public String getContainerNo() { public String getCargoNo() {
return containerNo; return cargoNo;
} }
public void setContainerNo(String containerNo) { public void setCargoNo(String cargoNo) {
this.containerNo = containerNo; this.cargoNo = cargoNo;
} }
public String getDeliveryAddress() { public String getPlateNo() {
return deliveryAddress; return plateNo;
} }
public void setDeliveryAddress(String deliveryAddress) { public void setPlateNo(String plateNo) {
this.deliveryAddress = deliveryAddress; this.plateNo = plateNo;
} }
public String getTransportationType() { public String getCargoName() {
return transportationType; return cargoName;
} }
public void setTransportationType(String transportationType) { public void setCargoName(String cargoName) {
this.transportationType = transportationType; this.cargoName = cargoName;
} }
public String getRemark() { 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 { ...@@ -25,6 +25,8 @@ public class Circuit implements Serializable {
private String cargoNo;//货物编号 private String cargoNo;//货物编号
private String cargoName;
private String plateNo;//车牌号 private String plateNo;//车牌号
private String deliveryAddress; private String deliveryAddress;
...@@ -101,6 +103,14 @@ public class Circuit implements Serializable { ...@@ -101,6 +103,14 @@ public class Circuit implements Serializable {
this.cargoNo = cargoNo; this.cargoNo = cargoNo;
} }
public String getCargoName() {
return cargoName;
}
public void setCargoName(String cargoName) {
this.cargoName = cargoName;
}
public String getPlateNo() { public String getPlateNo() {
return plateNo; return plateNo;
} }
......
...@@ -13,12 +13,14 @@ public interface AlarmLogMapper { ...@@ -13,12 +13,14 @@ public interface AlarmLogMapper {
List<AlarmLogVo> getAll(); List<AlarmLogVo> getAll();
//根据条件获取报警数据 //根据条件获取报警数据
List<AlarmLogVo> getAlarmLog(String time); List<AlarmLogVo> getAlarmLog(Integer time);
//新增报警数据 //新增报警数据
int addAlarmLog(AddAlarmLogVo addAlarmLogVo); int addAlarmLog(AddAlarmLogVo addAlarmLogVo);
List<ResultAlarmLog> getByTransportationNo(String transportationNo); List<ResultAlarmLog> getByTransportationNo(String transportationNo);
Integer getCount(); Integer getCount(Integer time);
Integer getBumpCount(Integer time);
} }
...@@ -8,35 +8,39 @@ import java.util.Map; ...@@ -8,35 +8,39 @@ import java.util.Map;
@Mapper @Mapper
public interface CircuitMapper { public interface CircuitMapper {
// List<ResultCircuitVo> getAll(); List<ResultCircuitVo> getAll();
//
List<ResultCircuitVo> getByTerm(CircuitTermVo circuitTermVo);
// List<CircuitVo> getDistinct(); // List<CircuitVo> getDistinct();
//
// List<ResultCircuitVo> getByTerm(CircuitTermVo circuitTermVo); int addCircuit(Map<Object,Object> map);
//
// int addCircuit(Map<Object,Object> map); int updateCircuit(Map<Object,Object> map);
//
// int updateCircuit(Map<Object,Object> map); int updateEndTime(UpdateCircuitVo updateCircuitVo);
//
// int updateEndTime(UpdateCircuitVo updateCircuitVo); int delCircuit(String transportationNo);
//
// int delCircuit(String transportationNo); ResultCircuitVo getByTransportationNo(String transportation);
//
// ResultCircuitVo getByTransportationNo(String transportation); Integer getOnRoute(Integer time);
//
// ResultGatewayVo getByNo(String transportationNo); Integer getDelayCount(Long compTime);
//
// Integer getOnRoute(); Integer getComplted(Integer time);
//
// Integer getComplted(); Integer getCount(Integer time);
//
// Integer getCount(); List<CircuitVo> getByTime(Integer time);
//
// List<CircuitVo> getByTime(String time); List<ResultCircuitVo> getByContainerNo(String cargoNo);
//
// List<ResultCircuitVo> getByContainerNo(String containerNo); int updateEvaluate(UpdateEvaluateVo updateEvaluateVo);
//
// int updateEvaluate(UpdateEvaluateVo updateEvaluateVo); List<ResultCircuitVo> getByCircuitState(Integer circuitState);
//
// List<ResultCircuitVo> getByCircuitState(Integer circuitState); Integer getNo(String transportationNo);
ResultGatewayVo getByNo(String transportationNo);
} }
...@@ -23,4 +23,6 @@ public interface GatewayMapper { ...@@ -23,4 +23,6 @@ public interface GatewayMapper {
int getIdBySNAndType(@Param("SN") String SN,@Param("type") String type); int getIdBySNAndType(@Param("SN") String SN,@Param("type") String type);
int deployGateway(Map<Object,Object> map); int deployGateway(Map<Object,Object> map);
String getBySN(String SN);
} }
package com.example.tdl.mapper; package com.example.tdl.mapper;
import com.example.tdl.domain.vo.ResultGatewayVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface TDLLogMapper { public interface TDLLogMapper {
// ResultGatewayVo getByNo(String transportationNo); ResultGatewayVo getByNo(String transportationNo);
} }
...@@ -19,7 +19,7 @@ public class AlarmLogService { ...@@ -19,7 +19,7 @@ public class AlarmLogService {
return alarmLogMapper.getAll(); return alarmLogMapper.getAll();
} }
public List<AlarmLogVo> getAlarmLog(String time){ public List<AlarmLogVo> getAlarmLog(Integer time){
return alarmLogMapper.getAlarmLog(time); return alarmLogMapper.getAlarmLog(time);
} }
...@@ -31,8 +31,12 @@ public class AlarmLogService { ...@@ -31,8 +31,12 @@ public class AlarmLogService {
return alarmLogMapper.getByTransportationNo(transportationNo); return alarmLogMapper.getByTransportationNo(transportationNo);
} }
public Integer getCount(){ public Integer getCount(Integer time){
return alarmLogMapper.getCount(); return alarmLogMapper.getCount(time);
}
public Integer getBumpCount(Integer time){
return alarmLogMapper.getBumpCount(time);
} }
......
...@@ -3,7 +3,6 @@ package com.example.tdl.service; ...@@ -3,7 +3,6 @@ package com.example.tdl.service;
import com.example.tdl.domain.vo.*; import com.example.tdl.domain.vo.*;
import com.example.tdl.mapper.CircuitMapper; import com.example.tdl.mapper.CircuitMapper;
import com.example.tdl.mapper.RoleMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -12,72 +11,81 @@ import java.util.Map; ...@@ -12,72 +11,81 @@ import java.util.Map;
@Service @Service
public class CircuitService { public class CircuitService {
// @Autowired @Autowired
// private CircuitMapper circuitMapper; private CircuitMapper circuitMapper;
//
// public List<ResultCircuitVo> getAll(){ public List<ResultCircuitVo> getAll(){
// return circuitMapper.getAll(); return circuitMapper.getAll();
// } }
//
// public List<CircuitVo> getDistinct(){ // public List<CircuitVo> getDistinct(){
// return circuitMapper.getDistinct(); // return circuitMapper.getDistinct();
// } // }
//
// public List<ResultCircuitVo> getByTerm(CircuitTermVo circuitTermVo){ public List<ResultCircuitVo> getByTerm(CircuitTermVo circuitTermVo){
// return circuitMapper.getByTerm(circuitTermVo); return circuitMapper.getByTerm(circuitTermVo);
// } }
//
// public int addCircuit(Map<Object,Object> map){ public int addCircuit(Map<Object,Object> map){
// return circuitMapper.addCircuit(map); return circuitMapper.addCircuit(map);
// } }
//
// public int updateCircuit(Map<Object,Object> map){ public int updateCircuit(Map<Object,Object> map){
// return circuitMapper.updateCircuit(map); return circuitMapper.updateCircuit(map);
// } }
//
// public int updateEndTime(UpdateCircuitVo updateCircuitVo){
// return circuitMapper.updateEndTime(updateCircuitVo); public int updateEndTime(UpdateCircuitVo updateCircuitVo){
// } return circuitMapper.updateEndTime(updateCircuitVo);
// }
// public int delCircuit(String transportationNo){
// return circuitMapper.delCircuit(transportationNo); public int delCircuit(String transportationNo){
// } return circuitMapper.delCircuit(transportationNo);
// }
// public ResultCircuitVo getByTransportationNo(String transportationNo){
// return circuitMapper.getByTransportationNo(transportationNo); public ResultCircuitVo getByTransportationNo(String transportationNo){
// } return circuitMapper.getByTransportationNo(transportationNo);
// }
// public ResultGatewayVo getByNo(String transportationNo){
// return circuitMapper.getByNo(transportationNo); public Integer getOnRoute(Integer time){
// } return circuitMapper.getOnRoute(time);
// }
// public Integer getOnRoute(){
// return circuitMapper.getOnRoute(); public Integer getDelayCount(Long compTime){
// } return circuitMapper.getDelayCount(compTime);
// }
// public Integer getComplted(){
// return circuitMapper.getComplted(); public Integer getComplted(Integer time){
// } return circuitMapper.getComplted(time);
// }
//
// public Integer getCount(){
// return circuitMapper.getCount(); public Integer getCount(Integer time){
// } return circuitMapper.getCount(time);
// }
// public List<CircuitVo> getByTime(String time){
// return circuitMapper.getByTime(time); public List<CircuitVo> getByTime(Integer time){
// } return circuitMapper.getByTime(time);
// }
// public List<ResultCircuitVo> getByContainerNo(String containerNo){
// return circuitMapper.getByContainerNo(containerNo); public List<ResultCircuitVo> getByContainerNo(String cargoNo){
// } return circuitMapper.getByContainerNo(cargoNo);
// }
// public int updateEvaluate(UpdateEvaluateVo updateEvaluateVo){
// return circuitMapper.updateEvaluate(updateEvaluateVo); public int updateEvaluate(UpdateEvaluateVo updateEvaluateVo){
// } return circuitMapper.updateEvaluate(updateEvaluateVo);
// }
// public List<ResultCircuitVo> getByCircuitState(Integer circuitState){
// return circuitMapper.getByCircuitState(circuitState); 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; ...@@ -10,40 +10,40 @@ import java.util.Map;
@Service @Service
public class ConfigService { public class ConfigService {
// @Autowired @Autowired
// private ConfigMapper configMapper; private ConfigMapper configMapper;
//
// //绑定getway和tdl //绑定getway和tdl
// /* public int addConfig(ConfigVo configVo){ /* public int addConfig(ConfigVo configVo){
// return configMapper.addConfig(configVo); return configMapper.addConfig(configVo);
// }*/ }*/
//
// public int addConfig(Map<Object,Object> map){ public int addConfig(Map<Object,Object> map){
// return configMapper.addConfig(map); return configMapper.addConfig(map);
// } }
//
//
// //获取绑定的数据信息 //获取绑定的数据信息
// public ConfigVo getConfig(String gSN,String gType){ public ConfigVo getConfig(String gSN,String gType){
// return configMapper.getConfig(gSN,gType); return configMapper.getConfig(gSN,gType);
// } }
//
// //绑定成功 //绑定成功
// public int bindiSuccess(String gSN,String gType,Integer resp){ public int bindiSuccess(String gSN,String gType,Integer resp){
// return configMapper.bindiSuccess(gSN,gType,resp); return configMapper.bindiSuccess(gSN,gType,resp);
// } }
//
// //解绑getWay和tdl //解绑getWay和tdl
//// public int updateConfig(String gSN,String gType,Boolean untie ){ // public int updateConfig(String gSN,String gType,Boolean untie ){
//// return configMapper.updateConfig(gSN,gType,untie); // return configMapper.updateConfig(gSN,gType,untie);
//// }
//
// public int updateConfig(Map<Object,Object> map ){
// return configMapper.updateConfig(map);
// } // }
// //
// //解绑成功 public int updateConfig(Map<Object,Object> map ){
// public int delConfig(String gSN,String gType){ return configMapper.updateConfig(map);
// return configMapper.delConfig(gSN,gType); }
// }
//解绑成功
public int delConfig(String gSN,String gType){
return configMapper.delConfig(gSN,gType);
}
} }
...@@ -45,4 +45,8 @@ public class GatewayService { ...@@ -45,4 +45,8 @@ public class GatewayService {
public int deployGateway(Map<Object,Object> map){ public int deployGateway(Map<Object,Object> map){
return gatewayMapper.deployGateway(map); return gatewayMapper.deployGateway(map);
} }
public String getBySN(String SN){
return gatewayMapper.getBySN(SN);
}
} }
package com.example.tdl.service; 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 org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service @Service
public class RouteService { public class RouteService {
......
...@@ -9,11 +9,11 @@ import org.springframework.stereotype.Service; ...@@ -9,11 +9,11 @@ import org.springframework.stereotype.Service;
@Service @Service
public class TDLLogService { public class TDLLogService {
// @Autowired @Autowired
// private TDLLogMapper tdlLogMapper; private TDLLogMapper tdlLogMapper;
//
// public ResultGatewayVo getByNo(String transportationNo){ public ResultGatewayVo getByNo(String transportationNo){
// return tdlLogMapper.getByNo(transportationNo); return tdlLogMapper.getByNo(transportationNo);
// } }
} }
...@@ -25,15 +25,6 @@ public class AlarmLogController { ...@@ -25,15 +25,6 @@ public class AlarmLogController {
@Autowired @Autowired
private AlarmLogService alarmLogServcie; 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") @PostMapping("/addAlarmLog")
@ApiImplicitParams({ @ApiImplicitParams({
...@@ -45,7 +36,7 @@ public class AlarmLogController { ...@@ -45,7 +36,7 @@ public class AlarmLogController {
fb.setMessage("运输编号不能为空"); fb.setMessage("运输编号不能为空");
return gson.toJson(fb); return gson.toJson(fb);
} }
if(StringUtils.isEmpty(addAlarmLogVo.getRouteName())){ if(StringUtils.isEmpty(addAlarmLogVo.getTDLSN())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("路由名称不能为空"); fb.setMessage("路由名称不能为空");
return gson.toJson(fb); return gson.toJson(fb);
......
...@@ -6,7 +6,8 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,7 +6,8 @@ import com.alibaba.fastjson.JSONObject;
import com.example.tdl.domain.dto.CommFeedback; import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.*; import com.example.tdl.domain.vo.*;
import com.example.tdl.service.CircuitService; 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.example.tdl.service.redis.TokenRedisService;
import com.google.gson.Gson; import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@RestController @RestController
...@@ -36,754 +38,674 @@ public class CircuitController { ...@@ -36,754 +38,674 @@ public class CircuitController {
Gson gson=new Gson(); Gson gson=new Gson();
// @Autowired @Autowired
// private CircuitService circuitService; 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 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 { ...@@ -38,771 +38,771 @@ public class DataController {
CommFeedback fb = new CommFeedback(); CommFeedback fb = new CommFeedback();
// @Autowired @Autowired
// private TDLDeviceService tdlDeviceService; private TDLDeviceService tdlDeviceService;
//
// @Autowired @Autowired
// private ProbesService probesService; private ProbesService probesService;
//
// @Autowired @Autowired
// private RealRedisService realRedisService; private RealRedisService realRedisService;
//
// @Autowired @Autowired
// private InfoRedisService infoRedisService; private InfoRedisService infoRedisService;
//
// @Autowired @Autowired
// private InfluxDBTemplate influxDBTemplate; private InfluxDBTemplate influxDBTemplate;
//
// @Autowired @Autowired
// private AlarmLogService alarmLogService; private AlarmLogService alarmLogService;
//
// @Autowired @Autowired
// private CircuitService circuitService; private CircuitService circuitService;
//
// @Autowired @Autowired
// private TDLLogService tdlLogService; private TDLLogService tdlLogService;
//
// private final static String database ="original"; private final static String database ="original";
//
// //获取实时数据 //获取实时数据
// @ApiOperation(value = "获取实时数据",notes = "获取实时数据") @ApiOperation(value = "获取实时数据",notes = "获取实时数据")
// @ApiImplicitParams({ @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// }) })
// @PostMapping("/getRealTimeData") @PostMapping("/getRealTimeData")
// public Object getRealTimeData(@RequestBody String transportationNo){ public Object getRealTimeData(@RequestBody String transportationNo){
// JSONObject jsonObject= JSON.parseObject(transportationNo); JSONObject jsonObject= JSON.parseObject(transportationNo);
// transportationNo=jsonObject.getString("transportationNo"); transportationNo=jsonObject.getString("transportationNo");
// //获取gateway的信息 //获取gateway的信息
// ResultGatewayVo gatewayVo = circuitService.getByNo(transportationNo); // ResultGatewayVo gatewayVo = circuitService.getByNo(transportationNo);
// if(gatewayVo==null){ ResultGatewayVo gatewayVo = new ResultGatewayVo();
// fb.setCode(0); if(gatewayVo==null){
// fb.setMessage("该线路未绑定设备"); fb.setCode(0);
// return gson.toJson(fb); fb.setMessage("该线路未绑定设备");
// } return gson.toJson(fb);
// //获取tdl信息 }
// List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType()); //获取tdl信息
// //根据gateWay获取tdl信息 List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
// List<String> key = new ArrayList<>(); //根据gateWay获取tdl信息
// key.add(gatewayVo.getSN()+"_"+gatewayVo.getType() +":"+gatewayVo.getSN()+"_"+gatewayVo.getType()); List<String> key = new ArrayList<>();
// for (int i = 0;i<devList.size();i++){ key.add(gatewayVo.getSN()+"_"+gatewayVo.getType() +":"+gatewayVo.getSN()+"_"+gatewayVo.getType());
// key.add(gatewayVo.getSN()+"_"+gatewayVo.getType()+":"+devList.get(i)); 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++){ List<LiveDataVo> liveDataVos = new ArrayList<>();
// Map<Object,Object> ret = realRedisService.getHashAll(key.get(j)); for(int j=0;j<key.size();j++){
// if(ret == null){ Map<Object,Object> ret = realRedisService.getHashAll(key.get(j));
// continue; if(ret == null){
// }else{ continue;
// Iterator entries = ret.entrySet().iterator(); }else{
// List<String> aliasList = new ArrayList<>(); Iterator entries = ret.entrySet().iterator();
// List<String> valueList = new ArrayList<>(); List<String> aliasList = new ArrayList<>();
// while(entries.hasNext()){ List<String> valueList = new ArrayList<>();
// Map.Entry entry = (Map.Entry) entries.next(); while(entries.hasNext()){
// aliasList.add((String) entry.getKey()); Map.Entry entry = (Map.Entry) entries.next();
// valueList.add((String) entry.getValue()); 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++){ List<ProbesVo> probesVoList = probesService.getByAliasList(gatewayVo.getSN(),gatewayVo.getType(),aliasList);
// probesVoList.get(m).setValue(valueList.get(m)); 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 liveDataVo = new LiveDataVo();
// liveDataVo.setProbesVoList(probesVoList); liveDataVo.setKey(key.get(j).substring(key.get(j).indexOf(":"),key.get(j).length()));
// liveDataVos.add(liveDataVo); liveDataVo.setProbesVoList(probesVoList);
// } liveDataVos.add(liveDataVo);
// } }
// return gson.toJson(liveDataVos); }
// } return gson.toJson(liveDataVos);
// }
//
// //获取坐标数据数据 //获取坐标数据数据
// @ApiOperation(value = "获取坐标数据数据",notes = "获取坐标数据数据" + @ApiOperation(value = "获取坐标数据数据",notes = "获取坐标数据数据" +
// "time:时间" + "time:时间" +
// "lng:经度" + "lng:经度" +
// "lat: 纬度") "lat: 纬度")
// @PostMapping("/getLocation") @PostMapping("/getLocation")
// @ApiImplicitParams({ @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// }) })
// public Object getLocation(@RequestBody String transportationNo){ public Object getLocation(@RequestBody String transportationNo){
// JSONObject jsonObject= JSON.parseObject(transportationNo); JSONObject jsonObject= JSON.parseObject(transportationNo);
// transportationNo=jsonObject.getString("transportationNo"); transportationNo=jsonObject.getString("transportationNo");
// //根据运输编号获取线路信息 //根据运输编号获取线路信息
// ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo); ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
// if(resultCircuitVo.getEndTime() !=0 && infoRedisService.hasHashKey("TransportConfig",transportationNo)){ if(resultCircuitVo.getEndTime() !=0 && infoRedisService.hasHashKey("TransportConfig",transportationNo)){
// Object ret = infoRedisService.getHash("TransportConfig",transportationNo); Object ret = infoRedisService.getHash("TransportConfig",transportationNo);
// return ret; return ret;
// }else{ }else{
// //获取gateway的信息 //获取gateway的信息
// ResultGatewayVo gatewayVo = new ResultGatewayVo(); ResultGatewayVo gatewayVo = new ResultGatewayVo();
// if(resultCircuitVo.getEndTime() == 0){ if(resultCircuitVo.getEndTime() == 0){
// gatewayVo = circuitService.getByNo(transportationNo); //gatewayVo = circuitService.getByNo(transportationNo);
// }else{ }else{
// gatewayVo = tdlLogService.getByNo(transportationNo); gatewayVo = tdlLogService.getByNo(transportationNo);
// } }
// if(gatewayVo==null){ if(gatewayVo==null){
// fb.setCode(0); fb.setCode(0);
// fb.setMessage("该线路未绑定设备"); fb.setMessage("该线路未绑定设备");
// return gson.toJson(fb); return gson.toJson(fb);
// } }
// String device = gatewayVo.getType() +"_" +gatewayVo.getSN(); String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
// Long startTime = resultCircuitVo.getStartTime() *1000000l; Long startTime = resultCircuitVo.getStartTime() *1000000l;
// //获取tdl信息 //获取tdl信息
// String sql = "SELECT \"lng\",\"lat\" FROM \"tdl_policy\".\""+device+"\"where time >= "+startTime +" ORDER BY time "; String sql = "SELECT \"lng\",\"lat\" FROM \"tdl_policy\".\""+device+"\"where time >= "+startTime +" ORDER BY time ";
// QueryResult queryResult = influxDBTemplate.query(new Query(sql,database)); QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
// //解析经纬度数据 //解析经纬度数据
// List<LocationDataVo> locationDataVos = new ArrayList<>(); List<LocationDataVo> locationDataVos = new ArrayList<>();
// if(queryResult.getResults().get(0).getSeries() != null){ if(queryResult.getResults().get(0).getSeries() != null){
// locationDataVos=getLocation(queryResult); locationDataVos=getLocation(queryResult);
// } }
// //获取震动的数据 //获取震动的数据
// String sql2 = "SELECT \"b\" FROM \"tdl_policy\".\""+device+"\"where time >= "+startTime +" ORDER BY time"; String sql2 = "SELECT \"b\" FROM \"tdl_policy\".\""+device+"\"where time >= "+startTime +" ORDER BY time";
// QueryResult queryResult2 = influxDBTemplate.query(new Query(sql2,database)); QueryResult queryResult2 = influxDBTemplate.query(new Query(sql2,database));
// List<String> timeList = new ArrayList<>(); List<String> timeList = new ArrayList<>();
// if(queryResult2.getResults().get(0).getSeries() != null){ if(queryResult2.getResults().get(0).getSeries() != null){
// //获取震动的时间戳 //获取震动的时间戳
// timeList = getTime(queryResult2); timeList = getTime(queryResult2);
// } }
// //获取震动数据的坐标 //获取震动数据的坐标
// String sql3 =""; String sql3 ="";
// for(String time : timeList){ for(String time : timeList){
// Long t = Long.valueOf(time) *1000000l; 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; 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)); QueryResult queryResult3 = influxDBTemplate.query(new Query(sql3,database));
// List<String> time= new ArrayList<>(); List<String> time= new ArrayList<>();
// if(queryResult3.getResults() !=null){ if(queryResult3.getResults() !=null){
// time = getShockLocation(queryResult3); time = getShockLocation(queryResult3);
// } }
// List<LocationDataVo> locationDataVoList =new ArrayList<>(); List<LocationDataVo> locationDataVoList =new ArrayList<>();
// for(LocationDataVo locationDataVo :locationDataVos){ for(LocationDataVo locationDataVo :locationDataVos){
// if(time.contains(locationDataVo.getTime())){ if(time.contains(locationDataVo.getTime())){
// locationDataVo.setError(1); locationDataVo.setError(1);
// locationDataVoList.add(locationDataVo); locationDataVoList.add(locationDataVo);
// }else{ }else{
// locationDataVo.setError(0); locationDataVo.setError(0);
// locationDataVoList.add(locationDataVo); locationDataVoList.add(locationDataVo);
// } }
// } }
// //如果是已经完结保存到redis中 //如果是已经完结保存到redis中
// if(resultCircuitVo.getEndTime() != 0){ if(resultCircuitVo.getEndTime() != 0){
// infoRedisService.setHash("TransportConfig",transportationNo,locationDataVoList.toString(),60*30); infoRedisService.setHash("TransportConfig",transportationNo,locationDataVoList.toString(),60*30);
// } }
// return gson.toJson(locationDataVoList); return gson.toJson(locationDataVoList);
// } }
// } }
//
//
// //根据运输编号获取路线以及设备信息 //根据运输编号获取路线以及设备信息
// @ApiOperation(value = "获取路线以及设备信息",notes = "获取路线以及设备信息" + @ApiOperation(value = "获取路线以及设备信息",notes = "获取路线以及设备信息" +
// "transportationNo:运输编号" + "transportationNo:运输编号" +
// "startCity:启运城市" + "startCity:启运城市" +
// "startTime:开始时间" + "startTime:开始时间" +
// "endCity:目的城市" + "endCity:目的城市" +
// "endTime:结束时间(未结束为\"\")" + "endTime:结束时间(未结束为\"\")" +
// "gatewaySN:网关编号" + "gatewaySN:网关编号" +
// "battery:网关点量" + "battery:网关点量" +
// "TDLSN:tdl编号" + "TDLSN:tdl编号" +
// "batteryVoltage:tdl电压" + "batteryVoltage:tdl电压" +
// "lastTime:运输时长(未结束为\"\")" + "lastTime:运输时长(未结束为\"\")" +
// "circuitState:运输状态(0--未开始,1--运输中,2--完成)" + "circuitState:运输状态(0--未开始,1--运输中,2--完成)" +
// "remark:备注信息") "remark:备注信息")
// @PostMapping("/getCircuit") @PostMapping("/getCircuit")
// @ApiImplicitParams({ @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// }) })
// public Object getCircuit(@RequestBody String transportationNo){ public Object getCircuit(@RequestBody String transportationNo){
// JSONObject jsonObject= JSON.parseObject(transportationNo); JSONObject jsonObject= JSON.parseObject(transportationNo);
// transportationNo=jsonObject.getString("transportationNo"); transportationNo=jsonObject.getString("transportationNo");
// ResultCircuit resultCircuit = new ResultCircuit(); ResultCircuit resultCircuit = new ResultCircuit();
// resultCircuit.setTransportationNo(transportationNo); resultCircuit.setTransportationNo(transportationNo);
// //根据运输编号获取线路信息,设备信息 //根据运输编号获取线路信息,设备信息
// ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo); ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
// resultCircuit.setStartCity(resultCircuitVo.getStartCity()); resultCircuit.setStartCity(resultCircuitVo.getStartCity());
// resultCircuit.setStartTime(resultCircuitVo.getStartTime()); resultCircuit.setStartTime(resultCircuitVo.getStartTime());
// resultCircuit.setEndCity(resultCircuitVo.getEndCity()); resultCircuit.setEndCity(resultCircuitVo.getEndCity());
// ResultGatewayVo gatewayVo = new ResultGatewayVo(); ResultGatewayVo gatewayVo = new ResultGatewayVo();
// if(resultCircuitVo.getEndTime() == 0){ if(resultCircuitVo.getEndTime() == 0){
// resultCircuit.setEndTime(null); resultCircuit.setEndTime(null);
// resultCircuit.setLastTime(null); resultCircuit.setLastTime(null);
// gatewayVo = circuitService.getByNo(transportationNo); gatewayVo = circuitService.getByNo(transportationNo);
// }else{ }else{
// resultCircuit.setEndTime(resultCircuitVo.getEndTime()); resultCircuit.setEndTime(resultCircuitVo.getEndTime());
// resultCircuit.setLastTime(getDistanceTime(resultCircuit.getStartTime(),resultCircuit.getEndTime())); resultCircuit.setLastTime(getDistanceTime(resultCircuit.getStartTime(),resultCircuit.getEndTime()));
// gatewayVo = tdlLogService.getByNo(transportationNo); gatewayVo = tdlLogService.getByNo(transportationNo);
// } }
// //获取gateway的信息 //获取gateway的信息
// if(gatewayVo==null){ if(gatewayVo==null){
// fb.setCode(0); fb.setCode(0);
// fb.setMessage("该线路未绑定设备"); fb.setMessage("该线路未绑定设备");
// return gson.toJson(fb); return gson.toJson(fb);
// } }
// resultCircuit.setGatewaySN(gatewayVo.getSN()); resultCircuit.setGatewaySN(gatewayVo.getSN());
// String device = gatewayVo.getType() +"_" +gatewayVo.getSN(); String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
// Long startTime = resultCircuitVo.getStartTime() *1000000l; Long startTime = resultCircuitVo.getStartTime() *1000000l;
// //获取tdl信息 //获取tdl信息
// String sql = "SELECT \"battery\" FROM \"tdl_policy\".\""+device+"\" where time >= "+startTime +" ORDER BY time desc limit 1"; 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)); QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
// if(queryResult.getResults().get(0).getSeries() != null){ if(queryResult.getResults().get(0).getSeries() != null){
// List<List<Object>> values = getValues(queryResult); List<List<Object>> values = getValues(queryResult);
// for(List<Object> value:values){ for(List<Object> value:values){
// logger.info(value.get(1).toString()); logger.info(value.get(1).toString());
// resultCircuit.setBattery(value.get(1)==null ? "": value.get(1).toString()); resultCircuit.setBattery(value.get(1)==null ? "": value.get(1).toString());
// } }
// } }
// //获取tdl信息 //获取tdl信息
// List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType()); List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
// String key=gatewayVo.getSN()+"_"+gatewayVo.getType() +":"+gatewayVo.getSN()+"_"+gatewayVo.getType() ; String key=gatewayVo.getSN()+"_"+gatewayVo.getType() +":"+gatewayVo.getSN()+"_"+gatewayVo.getType() ;
// //获取网关以及TDL的电量 //获取网关以及TDL的电量
// if(devList.size() == 0 ){ if(devList.size() == 0 ){
// fb.setCode(0); fb.setCode(0);
// fb.setMessage("该线路未绑定设备"); fb.setMessage("该线路未绑定设备");
// return gson.toJson(fb); return gson.toJson(fb);
// } }
// for(int i = 0;i<devList.size();i++){ 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"; 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)); QueryResult queryResult2 = influxDBTemplate.query(new Query(sql2,database));
// if(queryResult2.getResults().get(0).getSeries() != null){ if(queryResult2.getResults().get(0).getSeries() != null){
// List<List<Object>> values = getValues(queryResult2); List<List<Object>> values = getValues(queryResult2);
// for(List<Object> value:values){ for(List<Object> value:values){
// resultCircuit.setTDLSN(devList.get(i)); resultCircuit.setTDLSN(devList.get(i));
// resultCircuit.setBatteryVoltage(value.get(1)==null ? "" :value.get(1).toString()); resultCircuit.setBatteryVoltage(value.get(1)==null ? "" :value.get(1).toString());
// } }
// } }
// } }
// resultCircuit.setCircuitState(resultCircuitVo.getCircuitState()); resultCircuit.setCircuitState(resultCircuitVo.getCircuitState());
// return gson.toJson(resultCircuit); return gson.toJson(resultCircuit);
// } }
//
//
// //获取温度数据 //获取温度数据
// @ApiOperation(value = "获取温度数据",notes = "获取温度数据" + @ApiOperation(value = "获取温度数据",notes = "获取温度数据" +
// "TDLSN:tdl编号" + "TDLSN:tdl编号" +
// "temperatureDataVos:" + "temperatureDataVos:" +
// "time:时间" + "time:时间" +
// "value:温度数据") "value:温度数据")
// @PostMapping("/getTemperature") @PostMapping("/getTemperature")
// @ApiImplicitParams({ @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// }) })
// public Object getTemperature(@RequestBody String transportationNo){ public Object getTemperature(@RequestBody String transportationNo){
// JSONObject jsonObject= JSON.parseObject(transportationNo); JSONObject jsonObject= JSON.parseObject(transportationNo);
// transportationNo=jsonObject.getString("transportationNo"); transportationNo=jsonObject.getString("transportationNo");
// ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo); ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
// ResultGatewayVo gatewayVo = new ResultGatewayVo(); ResultGatewayVo gatewayVo = new ResultGatewayVo();
// if(resultCircuitVo.getEndTime() == 0){ if(resultCircuitVo.getEndTime() == 0){
// gatewayVo = circuitService.getByNo(transportationNo); gatewayVo = circuitService.getByNo(transportationNo);
// }else{ }else{
// gatewayVo = tdlLogService.getByNo(transportationNo); gatewayVo = tdlLogService.getByNo(transportationNo);
// } }
// String device = gatewayVo.getType() +"_" +gatewayVo.getSN(); String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
// //获取tdl信息 //获取tdl信息
// List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType()); List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
// String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ; String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
// Long startTime = resultCircuitVo.getStartTime() *1000000l; 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 // //SELECT "h" FROM "tdl_policy"."WTD93LG_20180314" WHERE "tdl" = 'tdl-0A0B0C0D0F' ORDER BY time DESC
// if(devList.size() == 0){ // String sql = "SELECT \"h\" FROM \"tdl_policy\".\""+devcie+"\" ORDER BY time ";
// 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)); // QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
// List<TemperatureDataVo> temperatureDataVos = new ArrayList<>(); // List<HumidityDataVo> humidityDataVos = new ArrayList<>();
// if(queryResult.getResults().get(0).getSeries() != null){ // if(queryResult.getResults().get(0).getSeries() != null){
// //解析数据 // //解析数据
// temperatureDataVos = getTemperature(queryResult); // humidityDataVos = getHumidity(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
//// 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(); return gson.toJson(humidities);
// Long startTime = resultCircuitVo.getStartTime() *1000000l; }
// //获取tdl信息
// List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType()); //获取倾斜度数据
// String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ; @ApiOperation(value = "获取倾斜度数据",notes = "获取倾斜度数据")
// if(devList.size() == 0){ @PostMapping("/getTiltAngle")
// fb.setCode(0); @ApiImplicitParams({
// fb.setMessage("没有数据"); @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// return gson.toJson(fb); })
// } public Object getTiltAngle(@RequestBody String transportationNo){
// List<TiltAngle> tiltAngles = new ArrayList<>(); JSONObject jsonObject= JSON.parseObject(transportationNo);
// for( int i =0;i<devList.size();i++){ transportationNo=jsonObject.getString("transportationNo");
// TiltAngle tiltAngle = new TiltAngle(); ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo);
// tiltAngle.setTDLSN(devList.get(i)); ResultGatewayVo gatewayVo = new ResultGatewayVo();
// String sql = "SELECT \"ta\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\"=\'"+devList.get(i)+"\' and time >="+startTime+" ORDER BY time "; if(resultCircuitVo.getEndTime() == 0){
// QueryResult queryResult = influxDBTemplate.query(new Query(sql,database)); gatewayVo = circuitService.getByNo(transportationNo);
// List<TiltAngleVo> tiltAngleVos = new ArrayList<>(); }else{
// if(queryResult.getResults().get(0).getSeries() != null){ gatewayVo = tdlLogService.getByNo(transportationNo);
// //解析数据 }
// tiltAngleVos = getTiltAngle(queryResult); String device = gatewayVo.getType() +"_" +gatewayVo.getSN();
// } Long startTime = resultCircuitVo.getStartTime() *1000000l;
// tiltAngle.setShockEnergyVoList(tiltAngleVos); //获取tdl信息
// tiltAngles.add(tiltAngle); List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType());
// } String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ;
//// String sql = "SELECT \"ta\" FROM \"tdl_policy\".\""+devcie+"\" ORDER BY time "; if(devList.size() == 0){
//// QueryResult queryResult = influxDBTemplate.query(new Query(sql,database)); fb.setCode(0);
//// List<TiltAngleVo> tiltAngleVos = new ArrayList<>(); fb.setMessage("没有数据");
//// if(queryResult.getResults().get(0).getSeries() != null){ return gson.toJson(fb);
//// //解析数据 }
//// tiltAngleVos = getTiltAngle(queryResult); List<TiltAngle> tiltAngles = new ArrayList<>();
//// } for( int i =0;i<devList.size();i++){
// return gson.toJson(tiltAngles); 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));
// @ApiOperation(value = "获取震动能量",notes = "获取震动能量") List<TiltAngleVo> tiltAngleVos = new ArrayList<>();
// @PostMapping("/getShockEnergy") if(queryResult.getResults().get(0).getSeries() != null){
// @ApiImplicitParams({ //解析数据
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), tiltAngleVos = getTiltAngle(queryResult);
// }) }
// public Object getShockEnergy(@RequestBody String transportationNo){ tiltAngle.setShockEnergyVoList(tiltAngleVos);
// JSONObject jsonObject= JSON.parseObject(transportationNo); tiltAngles.add(tiltAngle);
// transportationNo=jsonObject.getString("transportationNo"); }
// ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo); // String sql = "SELECT \"ta\" FROM \"tdl_policy\".\""+devcie+"\" ORDER BY time ";
// 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);
//// }
// 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)); // QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
// List<LocationMessageVo> locationDataVos = new ArrayList<>(); // List<TiltAngleVo> tiltAngleVos = new ArrayList<>();
// if(queryResult.getResults().get(0).getSeries() != null){ // if(queryResult.getResults().get(0).getSeries() != null){
// List<List<Object>> values = getValues(queryResult); // //解析数据
// for(List<Object> value:values){ // tiltAngleVos = getTiltAngle(queryResult);
// 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(); return gson.toJson(tiltAngles);
// Long startTime = resultCircuitVo.getStartTime() *1000000l; }
// //获取tdl信息
// List<String> devList = tdlDeviceService.getByGatewaySN(gatewayVo.getSN(),gatewayVo.getType()); //获取震动能量
// String devcie=gatewayVo.getType()+"_"+gatewayVo.getSN() ; @ApiOperation(value = "获取震动能量",notes = "获取震动能量")
// //SELECT "h" FROM "tdl_policy"."WTD93LG_20180314" WHERE "tdl" = 'tdl-0A0B0C0D0F' ORDER BY time DESC @PostMapping("/getShockEnergy")
// String sql = "SELECT \"t\",\"h\",\"p\",\"a0\",\"ta\" FROM \"tdl_policy\".\""+devcie+"\" where \"tdl\" = \'"+devList.get(0)+"\' and time>="+startTime+" ORDER BY time "; @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)); // QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
// //解析经纬度数据 // List<ShockEnergyVo> shockEnergyVos = new ArrayList<>();
// List<DeviceDataVo> deviceDataVos = new ArrayList<>();
// if(queryResult.getResults().get(0).getSeries() != null){ // if(queryResult.getResults().get(0).getSeries() != null){
// deviceDataVos= getDeviceData(queryResult); // //解析数据
// } // shockEnergyVos = getShockEnergy(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 { ...@@ -35,116 +35,116 @@ public class EquipmentBindingController {
Gson gson = new Gson(); Gson gson = new Gson();
// @Autowired @Autowired
// private ConfigService configService; private ConfigService configService;
//
// @Autowired @Autowired
// private GatewayService gatewayService; private GatewayService gatewayService;
//
// @Autowired @Autowired
// private TDLDeviceService tdlDeviceService; private TDLDeviceService tdlDeviceService;
//
// @ApiOperation(value = "绑定gateWay和tdl",notes = "绑定gateWay和tdl" + @ApiOperation(value = "绑定gateWay和tdl",notes = "绑定gateWay和tdl" +
// " SN:gateWay编号," + " SN:gateWay编号," +
// " type:gateWay类型," + " type:gateWay类型," +
// " mode:1--运输/2--仓库," + " mode:1--运输/2--仓库," +
// " TDLSN:tdl编号," + " TDLSN:tdl编号," +
// " transportationNo:运输编号," + " transportationNo:运输编号," +
// " warehouseNo:仓库编号" ) " warehouseNo:仓库编号" )
// @ApiImplicitParams({ @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// }) })
// @PostMapping("/binding") @PostMapping("/binding")
// public Object binding(@RequestBody BindingVo bindingVo){ public Object binding(@RequestBody BindingVo bindingVo){
// //获取gateWay的信息 //获取gateWay的信息
// ResultGatewayVo resultGatewayVo = gatewayService.getBySNAndType(bindingVo.getSN(),bindingVo.getType()); ResultGatewayVo resultGatewayVo = gatewayService.getBySNAndType(bindingVo.getSN(),bindingVo.getType());
// if(resultGatewayVo.getUseScene() !=0 && resultGatewayVo.getUseScene() !=bindingVo.getMode()){ if(resultGatewayVo.getUseScene() !=0 && resultGatewayVo.getUseScene() !=bindingVo.getMode()){
// fb.setCode(0); fb.setCode(0);
// fb.setMessage("该网关所属环境与当前不符"); fb.setMessage("该网关所属环境与当前不符");
// return gson.toJson(fb); return gson.toJson(fb);
// } }
// //判断当前tdl是否有网关在使用 //判断当前tdl是否有网关在使用
// ResultTDLDeviceVo resultTDLDeviceVo = tdlDeviceService.getByTDLSN(bindingVo.getTDLSN()); ResultTDLDeviceVo resultTDLDeviceVo = tdlDeviceService.getByTDLSN(bindingVo.getTDLSN());
// if(!StringUtils.isEmpty(resultTDLDeviceVo.getGatewaySN())){ if(!StringUtils.isEmpty(resultTDLDeviceVo.getGatewaySN())){
// fb.setCode(0); fb.setCode(0);
// fb.setMessage("该TDL已经被使用"); fb.setMessage("该TDL已经被使用");
// return gson.toJson(fb); return gson.toJson(fb);
// } }
// if(StringUtils.isEmpty(bindingVo.getTransportationNo()) && !StringUtils.isEmpty(bindingVo.getWarehouseNo())){ if(StringUtils.isEmpty(bindingVo.getTransportationNo()) && !StringUtils.isEmpty(bindingVo.getWarehouseNo())){
// bindingVo.setTransportationNo(""); bindingVo.setTransportationNo("");
// }else if(StringUtils.isEmpty(bindingVo.getWarehouseNo()) && !StringUtils.isEmpty(bindingVo.getTransportationNo())){ }else if(StringUtils.isEmpty(bindingVo.getWarehouseNo()) && !StringUtils.isEmpty(bindingVo.getTransportationNo())){
// bindingVo.setWarehouseNo(""); bindingVo.setWarehouseNo("");
// } }
// //开始绑定 //开始绑定
// //获取gateway下的所有tdl的编号 //获取gateway下的所有tdl的编号
// List<String> devList = tdlDeviceService.getByGatewaySN(bindingVo.getSN(),bindingVo.getType()); List<String> devList = tdlDeviceService.getByGatewaySN(bindingVo.getSN(),bindingVo.getType());
// devList.add(bindingVo.getTDLSN()); devList.add(bindingVo.getTDLSN());
// ConfigCMDVo configCMDVo = new ConfigCMDVo("config",5,15,devList,bindingVo.getMode(),System.currentTimeMillis()/1000l); ConfigCMDVo configCMDVo = new ConfigCMDVo("config",5,15,devList,bindingVo.getMode(),System.currentTimeMillis()/1000l);
// Map<Object,Object> map=new HashMap<>(); Map<Object,Object> map=new HashMap<>();
// map.put("transportationNo",bindingVo.getTransportationNo()); map.put("transportationNo",bindingVo.getTransportationNo());
// map.put("warehouseNo",bindingVo.getWarehouseNo()); map.put("warehouseNo",bindingVo.getWarehouseNo());
// map.put("useScene",bindingVo.getMode()); map.put("useScene",bindingVo.getMode());
// map.put("gSN",bindingVo.getSN()); map.put("gSN",bindingVo.getSN());
// map.put("gType",bindingVo.getType()); map.put("gType",bindingVo.getType());
// map.put("message",gson.toJson(configCMDVo)); map.put("message",gson.toJson(configCMDVo));
// map.put("flag",false); map.put("flag",false);
// map.put("resp",null); map.put("resp",null);
// map.put("state",1); map.put("state",1);
// map.put("untie",false); map.put("untie",false);
// map.put("TDLSN",bindingVo.getTDLSN()); map.put("TDLSN",bindingVo.getTDLSN());
// map.put("createTime",System.currentTimeMillis()); map.put("createTime",System.currentTimeMillis());
// configService.addConfig(map); configService.addConfig(map);
// Map<Object,Object> msg=new HashMap<>(); Map<Object,Object> msg=new HashMap<>();
// msg.put("msg",map.get("msg")); msg.put("msg",map.get("msg"));
// if (msg.get("msg").equals("配置网关成功")){ if (msg.get("msg").equals("配置网关成功")){
// fb.setCode(1); fb.setCode(1);
// fb.setMessage(msg.get("msg").toString()); fb.setMessage(msg.get("msg").toString());
// }else{ }else{
// fb.setCode(0); fb.setCode(0);
// fb.setMessage(msg.get("msg").toString()); fb.setMessage(msg.get("msg").toString());
// } }
// return gson.toJson(fb); return gson.toJson(fb);
// } }
//
// @ApiOperation(value = "重置tdl",notes = "重置tdl") @ApiOperation(value = "重置tdl",notes = "重置tdl")
// @ApiImplicitParams({ @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// }) })
// @PostMapping("/untie") @PostMapping("/untie")
// public Object untie(@RequestBody String TDLSN){ public Object untie(@RequestBody String TDLSN){
// JSONObject jsonObject= JSON.parseObject(TDLSN); JSONObject jsonObject= JSON.parseObject(TDLSN);
// TDLSN=(String)jsonObject.get("TDLSN"); TDLSN=(String)jsonObject.get("TDLSN");
// //判断当前tdl是否有网关在使用 //判断当前tdl是否有网关在使用
// ResultTDLDeviceVo resultTDLDeviceVo = tdlDeviceService.getByTDLSN(TDLSN); ResultTDLDeviceVo resultTDLDeviceVo = tdlDeviceService.getByTDLSN(TDLSN);
// List<String> devList = tdlDeviceService.getByGatewaySN(resultTDLDeviceVo.getGatewaySN(),resultTDLDeviceVo.getGatewayType()); List<String> devList = tdlDeviceService.getByGatewaySN(resultTDLDeviceVo.getGatewaySN(),resultTDLDeviceVo.getGatewayType());
// ConfigVo configVo =configService.getConfig(resultTDLDeviceVo.getGatewaySN(),resultTDLDeviceVo.getGatewayType()); ConfigVo configVo =configService.getConfig(resultTDLDeviceVo.getGatewaySN(),resultTDLDeviceVo.getGatewayType());
// ConfigCMDVo config = gson.fromJson(configVo.getMessage(),ConfigCMDVo.class); ConfigCMDVo config = gson.fromJson(configVo.getMessage(),ConfigCMDVo.class);
// ConfigCMDVo configCMDVo ; ConfigCMDVo configCMDVo ;
// Boolean untie = false; Boolean untie = false;
// if(devList.size()>1){ if(devList.size()>1){
// devList.remove(TDLSN); devList.remove(TDLSN);
// configCMDVo = new ConfigCMDVo("config",config.getGpsPeriod(),config.getGprsPeriod(),devList,config.getMode(),System.currentTimeMillis()/1000l); configCMDVo = new ConfigCMDVo("config",config.getGpsPeriod(),config.getGprsPeriod(),devList,config.getMode(),System.currentTimeMillis()/1000l);
// }else{ }else{
// configCMDVo = config; configCMDVo = config;
// untie = true; untie = true;
// } }
// Map<Object,Object> map=new HashMap<>(); Map<Object,Object> map=new HashMap<>();
// map.put("gSN",resultTDLDeviceVo.getGatewaySN()); map.put("gSN",resultTDLDeviceVo.getGatewaySN());
// map.put("gType",resultTDLDeviceVo.getGatewayType()); map.put("gType",resultTDLDeviceVo.getGatewayType());
// map.put("message",gson.toJson(configCMDVo)); map.put("message",gson.toJson(configCMDVo));
// map.put("untie",untie); map.put("untie",untie);
// map.put("TDLSN",TDLSN); map.put("TDLSN",TDLSN);
// map.put("endTime",System.currentTimeMillis()); map.put("endTime",System.currentTimeMillis());
// configService.updateConfig(map); configService.updateConfig(map);
// Map<Object,Object> msg=new HashMap<>(); Map<Object,Object> msg=new HashMap<>();
// msg.put("msg",map.get("msg")); msg.put("msg",map.get("msg"));
// if (msg.get("msg").equals("解除网关成功")){ if (msg.get("msg").equals("解除网关成功")){
// fb.setCode(1); fb.setCode(1);
// fb.setMessage(msg.get("msg").toString()); fb.setMessage(msg.get("msg").toString());
// }else{ }else{
// fb.setCode(0); fb.setCode(0);
// fb.setMessage(msg.get("msg").toString()); fb.setMessage(msg.get("msg").toString());
// } }
// return gson.toJson(fb); return gson.toJson(fb);
// } }
} }
...@@ -4,7 +4,7 @@ import com.example.tdl.domain.dto.CommFeedback; ...@@ -4,7 +4,7 @@ import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.*; import com.example.tdl.domain.vo.*;
import com.example.tdl.service.AlarmLogService; import com.example.tdl.service.AlarmLogService;
import com.example.tdl.service.CircuitService; import com.example.tdl.service.CircuitService;
import com.example.tdl.service.RouteService;
import com.google.gson.Gson; import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
...@@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory; ...@@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@RestController @RestController
...@@ -25,92 +26,68 @@ public class HomePageController { ...@@ -25,92 +26,68 @@ public class HomePageController {
CommFeedback fb = new CommFeedback(); CommFeedback fb = new CommFeedback();
// @Autowired @Autowired
// private CircuitService circuitService; private CircuitService circuitService;
//
// @Autowired @Autowired
// private AlarmLogService alarmLogServcie; private AlarmLogService alarmLogServcie;
//
// //获取当天所有的设备数据 //获取当天所有的设备数据
// @ApiOperation(value = "获取所有的运输数据",notes = "获取运输设备数据:" + @ApiOperation(value = "获取所有的运输数据",notes = "获取运输设备数据:" +
// "sum:总数量" + "sum:总数量" +
// "onRoute:在途数量" + "onRoute:在途数量" +
// "complted:已完成数量" + "complted:已完成数量" +
// "alarmed: 报警数量" + "alarmed: 报警数量" +
// "routeVoList: " + "routeVoList: " +
// "transportationNo:线路编号(R+TyyyyMMdd+运输方式+四位随机数)"+ "transportationNo:线路编号(R+TyyyyMMdd+运输方式+四位随机数)"+
// "routeName:路由名称(出发地-启运地)"+ "routeName:路由名称(出发地-启运地)"+
// "startLongitude:启运经度"+ "startLongitude:启运经度"+
// "startLatitude:启运纬度"+ "startLatitude:启运纬度"+
// "startCity:启运市"+ "startCity:启运市"+
// "startTime:开始时间"+ "startTime:开始时间"+
// "endLongitude:目的经度"+ "endLongitude:目的经度"+
// "endLatitude:目的纬度"+ "endLatitude:目的纬度"+
// "endCity:目的市"+ "endCity:目的市"+
// "endTime:结束时间"+ "endTime:结束时间"+
// "transport:运输方式(T铁路,G汽运,H海运,K空运,D快递)"+ "transport:运输方式(T铁路,G汽运,H海运,K空运,D快递)"+
// "boxNo:箱单号" + "boxNo:箱单号" +
// "containerNo:集装箱号/车牌号" + "containerNo:集装箱号/车牌号" +
// "deliveryAddress:交付地点" + "deliveryAddress:交付地点" +
// "transportationType:运输类型" + "transportationType:运输类型" +
// "circuitState:线路状态"+ "circuitState:线路状态"+
// "remark:备注" + "remark:备注" +
// "alarmLogVoList :"+ "alarmLogVoList :"+
// "routeName:线路名称"+ "routeName:线路名称"+
// "description:报警描述" + "description:报警描述" +
// "data:数据"+ "data:数据"+
// "alarmTime:报警时间") "alarmTime:报警时间")
// @GetMapping("/getAll") @PostMapping("/getAll")
// @ApiImplicitParams({ @ApiImplicitParams({
// @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
// }) })
// public Object getAll(){ public Object getAll(@RequestBody Integer time){
// HomePageDataVo dataVo = new HomePageDataVo(); //获取数量
// //获取所有的线路信息 HomePageDataVo dataVo = new HomePageDataVo();
// List<CircuitVo> resultCircuitVos = circuitService.getDistinct(); //获取所有的线路数量
// //获取所有的报警 Integer sum = circuitService.getCount(time);
// List<AlarmLogVo> alarmLogVos = alarmLogServcie.getAll(); dataVo.setSum(sum);//总数量
// // 获取所有的路线数量 Integer onRoute = circuitService.getOnRoute(time);
// dataVo.setRouteVoList(resultCircuitVos);//路线列表 dataVo.setOnRoute(onRoute);//在途数量
// dataVo.setAlarmLogVoList(alarmLogVos);//报警列表 //获取延误数量
// Integer sum = circuitService.getCount(); Integer delay = circuitService.getDelayCount(System.currentTimeMillis());
// dataVo.setSum(sum);//总数量 dataVo.setDelay(delay);
// Integer onRoute = circuitService.getOnRoute(); //获取已经完成的数量
// dataVo.setOnRoute(onRoute);//在途数量 Integer alarmed = alarmLogServcie.getCount(time);
// //获取已经完成的数量 dataVo.setAlarmed(alarmed);//报警数量
// Integer finished = circuitService.getComplted(); //获取颠簸数量
// dataVo.setComplted(finished);//已完成数量 Integer bump = alarmLogServcie.getBumpCount(time);
// Integer alarmed = alarmLogServcie.getCount(); dataVo.setBump(bump);
// dataVo.setAlarmed(alarmed);//报警数量 //获取所有的报警
// return gson.toJson(dataVo); // 获取所有的路线数量
// } List<AlarmLogVo> alarmLogVos = new ArrayList<>();
// dataVo.setAlarmLogVoList(alarmLogVos);//报警列表
//
// //根据条件获取路线数据(所有的)
// @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);
// }
return gson.toJson(dataVo);
}
} }
package com.example.tdl.web; 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.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 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.Logger;
import org.slf4j.LoggerFactory; 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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@RestController @RestController
@RequestMapping("/route") @RequestMapping("/route")
......
...@@ -4,7 +4,6 @@ package com.example.tdl.web; ...@@ -4,7 +4,6 @@ package com.example.tdl.web;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.example.tdl.domain.dto.CommFeedback; 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.UpdateUserRouteVo;
import com.example.tdl.domain.vo.UserRedisVo; import com.example.tdl.domain.vo.UserRedisVo;
import com.example.tdl.service.UserRouteService; import com.example.tdl.service.UserRouteService;
......
...@@ -3,19 +3,21 @@ ...@@ -3,19 +3,21 @@
<mapper namespace="com.example.tdl.mapper.AlarmLogMapper"> <mapper namespace="com.example.tdl.mapper.AlarmLogMapper">
<!--获取所有的报警数据--> <!--获取所有的报警数据-->
<select id="getAll" resultType="com.example.tdl.domain.vo.AlarmLogVo"> <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>
<select id="getByTransportationNo" resultType="com.example.tdl.domain.vo.ResultAlarmLog" parameterType="String"> <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>
<!--根据条件获取报警数据--> <!--根据条件获取报警数据-->
<select id="getAlarmLog" resultType="com.example.tdl.domain.vo.AlarmLogVo"> <select id="getAlarmLog" resultType="com.example.tdl.domain.vo.AlarmLogVo">
select routeName,description,data,alarmTime select TDLSN,description,data,alarmTime
from alarm_log from alarm_log
where DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s')) 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> </select>
<insert id="addAlarmLog" parameterType="com.example.tdl.domain.vo.AddAlarmLogVo"> <insert id="addAlarmLog" parameterType="com.example.tdl.domain.vo.AddAlarmLogVo">
...@@ -23,7 +25,7 @@ ...@@ -23,7 +25,7 @@
values( values(
null, null,
#{transportationNo,jdbcType=VARCHAR}, #{transportationNo,jdbcType=VARCHAR},
#{routeName,jdbcType=VARCHAR}, #{TDLSN,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{data,jdbcType=FLOAT}, #{data,jdbcType=FLOAT},
#{alarmTime,jdbcType=INTEGER} #{alarmTime,jdbcType=INTEGER}
...@@ -31,6 +33,33 @@ ...@@ -31,6 +33,33 @@
</insert> </insert>
<select id="getCount" resultType="java.lang.Integer"> <select id="getCount" resultType="java.lang.Integer">
select count(DISTINCT transportationNo) from alarm_log 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> </select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <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, <select id="getAll" resultType="com.example.tdl.domain.vo.ResultCircuitVo">
startAddress,startTime,endLongitude,endLatitude,(select city from city_config where id=r.end_id) endCity,endAddress,endTime,transport, 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,
IFNULL((SELECT alarmType FROM alarm WHERE id=c.alarm_id),"正常") alarmType,boxNo,containerNo,deliveryAddress,transportationType, 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,
circuitState,c.remark,c.createTime,c.evaluate,c.evaluateRemark IFNULL((SELECT alarmType FROM alarm WHERE id=c.alarm_id),"正常") alarmType from circuit c where c.state=1
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>
</select>
<!--根据条件查询线路信息-->
<select id="getDistinct" resultType="com.example.tdl.domain.vo.CircuitVo"> <select id="getByTerm" resultType="com.example.tdl.domain.vo.ResultCircuitVo" parameterType="com.example.tdl.domain.vo.CircuitTermVo">
SELECT transportationNo,routeName,startLongitude,startLatitude,(select city from city_config where id=r.start_id) startCity,startTime,endLongitude,endLatitude, 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,
(select city from city_config where id=r.end_id) endCity,endTime,transport,boxNo,containerNo,deliveryAddress, 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,
transportationType,circuitState,c.remark ,SUBSTRING_INDEX(routeName,'_',2) routes IFNULL((SELECT alarmType FROM alarm WHERE id=c.alarm_id),"正常") alarmType from circuit c where c.state=1
from circuit c,route r <if test="circuitState!=null">
WHERE c.route_id=r.id AND circuitState=#{circuitState,jdbcType=INTEGER}
AND r.state=1 </if>
AND c.state=1 <if test="cargoNo!=null">
GROUP BY routes AND cargoNo like CONCAT(CONCAT('%',#{cargoNo,jdbcType=VARCHAR}),'%')
order BY c.id </if>
</select> <if test="startTime!=null">
AND startTime &gt;= #{startTime,jdbcType=BIGINT}
<select id="getByTerm" resultType="com.example.tdl.domain.vo.ResultCircuitVo" parameterType="com.example.tdl.domain.vo.CircuitTermVo"> </if>
SELECT transportationNo,routeNumber,routeName,startLongitude,startLatitude,(select city from city_config where id=r.start_id) startCity, <if test="endTime!=null">
startAddress,startTime,endLongitude,endLatitude,(select city from city_config where id=r.end_id) endCity,endAddress,endTime,transport, AND endTime &lt;= #{endTime,jdbcType=BIGINT}
IFNULL((SELECT alarmType FROM alarm WHERE id=c.alarm_id),"正常") alarmType,boxNo,containerNo,deliveryAddress,transportationType, </if>
circuitState,c.remark,c.createTime,c.evaluate,c.evaluateRemark </select>
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}),'%') <insert id="addCircuit" parameterType="java.util.Map" statementType="CALLABLE">
</if> <![CDATA[
<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>
<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>
<if test="startTimeMin!=null">
AND startTime BETWEEN #{startTimeMin,jdbcType=BIGINT} AND #{startTimeMax,jdbcType=BIGINT}
</if>
<if test="endTimeMin!=null">
AND endTime BETWEEN #{endTimeMin,jdbcType=BIGINT} AND #{endTimeMax,jdbcType=BIGINT}
</if>
</select>
<insert id="addCircuit" parameterType="java.util.Map" statementType="CALLABLE">
<![CDATA[
{ {
call pro_addCircuit( 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}, #{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}, #{startTime,mode=IN,jdbcType=BIGINT},
#{endLongitude,mode=IN,jdbcType=VARCHAR}, #{expTime,mode=IN,jdbcType=BIGINT},
#{endLatitude,mode=IN,jdbcType=VARCHAR}, #{compTime,mode=IN,jdbcType=BIGINT},
#{endAddress,mode=IN,jdbcType=VARCHAR}, #{alarmType,mode=IN,jdbcType=VARCHAR},
#{endTime,mode=IN,jdbcType=BIGINT}, #{cargoNo,mode=IN,jdbcType=VARCHAR},
#{boxNo,mode=IN,jdbcType=VARCHAR}, #{cargoName,mode=IN,jdbcType=VARCHAR},
#{containerNo,mode=IN,jdbcType=VARCHAR}, #{plateNo,mode=IN,jdbcType=VARCHAR},
#{deliveryAddress,mode=IN,jdbcType=VARCHAR}, #{deliveryAddress,mode=IN,jdbcType=VARCHAR},
#{transportation,mode=IN,jdbcType=VARCHAR},
#{transportationType,mode=IN,jdbcType=VARCHAR}, #{transportationType,mode=IN,jdbcType=VARCHAR},
#{createTime,mode=IN,jdbcType=BIGINT},
#{remark,mode=IN,jdbcType=VARCHAR}, #{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} #{msg,mode=OUT,jdbcType=VARCHAR}
) )
} }
]]> ]]>
</insert> </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"> <update id="updateCircuit" parameterType="java.util.Map" statementType="CALLABLE">
<![CDATA[ <![CDATA[
{ {
call pro_updateCircuit( 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}, #{transportationNo,mode=IN,jdbcType=VARCHAR},
#{startLongitude,mode=IN,jdbcType=VARCHAR}, #{startTime,mode=IN,jdbcType=BIGINT},
#{startLatitude,mode=IN,jdbcType=VARCHAR}, #{expTime,mode=IN,jdbcType=VARCHAR},
#{startAddress,mode=IN,jdbcType=VARCHAR}, #{compTime,mode=IN,jdbcType=VARCHAR},
#{startTime,mode=IN,jdbcType=VARCHAR}, #{alarmType,mode=IN,jdbcType=VARCHAR},
#{endLongitude,mode=IN,jdbcType=VARCHAR}, #{cargoNo,mode=IN,jdbcType=VARCHAR},
#{endLatitude,mode=IN,jdbcType=VARCHAR}, #{cargoName,mode=IN,jdbcType=VARCHAR},
#{endAddress,mode=IN,jdbcType=VARCHAR}, #{plateNo,mode=IN,jdbcType=VARCHAR},
#{endTime,mode=IN,jdbcType=VARCHAR},
#{boxNo,mode=IN,jdbcType=VARCHAR},
#{containerNo,mode=IN,jdbcType=VARCHAR},
#{deliveryAddress,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}, #{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} #{msg,mode=OUT,jdbcType=VARCHAR}
) )
} }
]]> ]]>
</update> </update>
<delete id="delCircuit" parameterType="String">
UPDATE circuit set state=0 <!-- 修改结束时间-->
WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR} <update id="updateEndTime" parameterType="com.example.tdl.domain.vo.UpdateCircuitVo">
</delete> UPDATE circuit set
endTime=#{endTime,jdbcType=BIGINT},circuitState=2
<select id="getByTransportationNo" resultType="com.example.tdl.domain.vo.ResultCircuitVo" parameterType="String"> WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR}
SELECT transportationNo,routeNumber,routeName,startLongitude,startLatitude,(select city from city_config where id=r.start_id) startCity, </update>
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} <delete id="delCircuit" parameterType="String">
</select> UPDATE circuit set state=0
WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR}
</delete>
<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 <!-- 运输中数量-->
from gateway WHERE id=(SELECT gateway_id from tdldevice where circuit_id =( <select id="getOnRoute" resultType="java.lang.Integer">
SELECT id from circuit WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR}) LIMIT 1) select count( startTime) from circuit where circuitState=1
</select> </select>
<select id="getOnRoute" resultType="java.lang.Integer"> <!--延误数量-->
select count( startTime) from circuit where circuitState=1 <select id="getDelayCount" resultType="java.lang.Integer" parameterType="java.lang.Integer">
</select> select count(id) from circuit where state =1 and endtime &lt;=compTime or compTime >= #{compTime,jdbcType=BIGINT}
</select>
<select id="getComplted" resultType="java.lang.Integer">
select count(id) from circuit where circuitState=2
<!--总数量-->
<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,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
from gateway WHERE id=(SELECT gateway_id from tdldevice where circuit_id =(
SELECT id from circuit WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR}) LIMIT 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>
<select id="getCount" resultType="java.lang.Integer">
select count(id) from circuit
</select>
<select id="getByTime" resultType="com.example.tdl.domain.vo.CircuitVo"> <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, SELECT transportationNo,routeName,startLongitude,startLatitude,(select city from city_config where id=r.start_id) startCity,startTime,endLongitude,endLatitude,
...@@ -179,28 +207,5 @@ ...@@ -179,28 +207,5 @@
GROUP BY routes GROUP BY routes
order BY c.id order BY c.id
</select> </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> </mapper>
\ No newline at end of file
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
from gateway from gateway
</select> </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"> <insert id="addGateway" parameterType="java.util.Map" statementType="CALLABLE">
<![CDATA[ <![CDATA[
{ {
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <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 select gatewaySN SN,gatewayType type from tdl_gateway_log
where transportationNo = #{transportationNo,jdbcType=VARCHAR} where transportationNo = #{transportationNo,jdbcType=VARCHAR}
GROUP BY gatewaySN GROUP BY gatewaySN
</select>--> </select>
</mapper> </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