|
@@ -1,6 +1,7 @@
|
|
package info.aspirecn.iov.sjjh.service.impl;
|
|
package info.aspirecn.iov.sjjh.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import info.aspirecn.iov.sjjh.commons.lang.ChannelTypeHandleResponseObject;
|
|
import info.aspirecn.iov.sjjh.commons.lang.ChannelTypeHandleResponseObject;
|
|
import info.aspirecn.iov.sjjh.commons.lang.Constant;
|
|
import info.aspirecn.iov.sjjh.commons.lang.Constant;
|
|
@@ -115,8 +116,10 @@ public class VehicleServiceImpl implements VehicleService {
|
|
if (positionResponse.getData() != null && positionResponse.getData().size() > 0) {
|
|
if (positionResponse.getData() != null && positionResponse.getData().size() > 0) {
|
|
boolean result = vehicleHistoryPositionQueryByBaidu(positionResponse.getData(), requestParam);
|
|
boolean result = vehicleHistoryPositionQueryByBaidu(positionResponse.getData(), requestParam);
|
|
if (result) {
|
|
if (result) {
|
|
|
|
+ JSONObject vehicleLocationInfo = new JSONObject();
|
|
|
|
+ vehicleLocationInfo.put("vehicleLocationInfo", positionResponse.getData());
|
|
ret.setResultCode(Constant.MATCH_CODE);
|
|
ret.setResultCode(Constant.MATCH_CODE);
|
|
- ret.setResultBody(positionResponse.getData());
|
|
|
|
|
|
+ ret.setResultBody(vehicleLocationInfo);
|
|
ret.setResultDesc(Constant.QUERY_SUCCESS);
|
|
ret.setResultDesc(Constant.QUERY_SUCCESS);
|
|
} else {
|
|
} else {
|
|
ret.setResultCode(Constant.UN_MATCH_CODE);
|
|
ret.setResultCode(Constant.UN_MATCH_CODE);
|
|
@@ -128,6 +131,7 @@ public class VehicleServiceImpl implements VehicleService {
|
|
ret.setResultBody(Constants.NO_RESULT);
|
|
ret.setResultBody(Constants.NO_RESULT);
|
|
ret.setResultDesc(Constants.NO_RESULT);
|
|
ret.setResultDesc(Constants.NO_RESULT);
|
|
}
|
|
}
|
|
|
|
+ ret.setIsCharge(Constant.IS_CHARGE);
|
|
} else if (positionResponse.getResultCode().equals(Constants.RESULT_CODE_110000)) {
|
|
} else if (positionResponse.getResultCode().equals(Constants.RESULT_CODE_110000)) {
|
|
ret.setResultCode(Constant.UN_FIND_NUM_CODE);
|
|
ret.setResultCode(Constant.UN_FIND_NUM_CODE);
|
|
ret.setResultBody(Constants.NO_RESULT);
|
|
ret.setResultBody(Constants.NO_RESULT);
|
|
@@ -168,116 +172,71 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
|
|
|
// 4小时*2=8小时(A-A+间隔),8小时*2=16个点(每半个小时取1个点)
|
|
// 4小时*2=8小时(A-A+间隔),8小时*2=16个点(每半个小时取1个点)
|
|
int pointNumber = supplierConfig.getAddHours()*2*2;
|
|
int pointNumber = supplierConfig.getAddHours()*2*2;
|
|
|
|
+
|
|
|
|
+ List<String> checkTimeListA = new ArrayList<>();
|
|
String tempStartTime = startTimeA;
|
|
String tempStartTime = startTimeA;
|
|
|
|
+ for (int i = 0; i < pointNumber+1; i++) {
|
|
|
|
+ checkTimeListA.add(tempStartTime);
|
|
|
|
+ tempStartTime = DateUtil.addMinutes(tempStartTime, 30);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<String> checkTimeListB = new ArrayList<>();
|
|
|
|
+ tempStartTime = startTimeB;
|
|
|
|
+ for (int i = 0; i < pointNumber+1; i++) {
|
|
|
|
+ checkTimeListB.add(tempStartTime);
|
|
|
|
+ tempStartTime = DateUtil.addMinutes(tempStartTime, 30);
|
|
|
|
+ }
|
|
|
|
+
|
|
boolean checkResultA = false;
|
|
boolean checkResultA = false;
|
|
// todo 这个集合为了查看位置是否正确
|
|
// todo 这个集合为了查看位置是否正确
|
|
-// List<VehicleHistoryPositionResponse.Data> verificationPositionListA = new ArrayList<>();
|
|
|
|
-// for (VehicleHistoryPositionResponse.Data position : positionList) {
|
|
|
|
-// String startTime = tempStartTime;
|
|
|
|
-// String endTime = DateUtil.addMinutes(startTime, 30);
|
|
|
|
-// if (Long.parseLong(position.getPositionTime()) > Long.parseLong(startTime)
|
|
|
|
-// && Long.parseLong(position.getPositionTime()) <= Long.parseLong(endTime)) {
|
|
|
|
-// verificationPositionListA.add(position);
|
|
|
|
-// tempStartTime = endTime;
|
|
|
|
-// if (getGeocodingCheck(3000,
|
|
|
|
-// (position.getLatitudeDegree() + "," + position.getLongitudeDegree()),
|
|
|
|
-// requestParam.getLoadingCountrySubdivisionCode())) {
|
|
|
|
-// checkResultA = true;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-// // todo 这个集合为了查看位置是否正确
|
|
|
|
-// List<VehicleHistoryPositionResponse.Data> verificationPositionListB = new ArrayList<>();
|
|
|
|
-// tempStartTime = startTimeB;
|
|
|
|
-// boolean checkResultB = false;
|
|
|
|
-// for (VehicleHistoryPositionResponse.Data position : positionList) {
|
|
|
|
-// String startTime = tempStartTime;
|
|
|
|
-// String endTime = DateUtil.addMinutes(startTime, 30);
|
|
|
|
-// if (Long.parseLong(position.getPositionTime()) > Long.parseLong(startTime)
|
|
|
|
-// && Long.parseLong(position.getPositionTime()) <= Long.parseLong(endTime)) {
|
|
|
|
-// verificationPositionListB.add(position);
|
|
|
|
-// tempStartTime = endTime;
|
|
|
|
-// if (getGeocodingCheck(3000,
|
|
|
|
-// (position.getLatitudeDegree() + "," + position.getLongitudeDegree()),
|
|
|
|
-// requestParam.getLoadingCountrySubdivisionCode())) {
|
|
|
|
-// checkResultB = true;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
|
|
+ List<VehicleHistoryPositionResponse.Data> verificationPositionListA = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < checkTimeListA.size()-1; i++) {
|
|
|
|
+ for (VehicleHistoryPositionResponse.Data position : positionList) {
|
|
|
|
+ if (Long.parseLong(position.getPositionTime()) > Long.parseLong(checkTimeListA.get(i))
|
|
|
|
+ && Long.parseLong(position.getPositionTime()) <= Long.parseLong(checkTimeListA.get(i+1))) {
|
|
|
|
+ verificationPositionListA.add(position);
|
|
|
|
+ if (getGeocodingCheck(3000,
|
|
|
|
+ (position.getLatitudeDegree() + "," + position.getLongitudeDegree()),
|
|
|
|
+ requestParam.getLoadingCountrySubdivisionCode())) {
|
|
|
|
+ checkResultA = true;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (checkResultA) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!checkResultA) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ boolean checkResultB = false;
|
|
|
|
+ // todo 这个集合为了查看位置是否正确
|
|
|
|
+ List<VehicleHistoryPositionResponse.Data> verificationPositionListB = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < checkTimeListB.size()-1; i++) {
|
|
|
|
+ for (VehicleHistoryPositionResponse.Data position : positionList) {
|
|
|
|
+ if (Long.parseLong(position.getPositionTime()) > Long.parseLong(checkTimeListB.get(i))
|
|
|
|
+ && Long.parseLong(position.getPositionTime()) <= Long.parseLong(checkTimeListB.get(i+1))) {
|
|
|
|
+ verificationPositionListB.add(position);
|
|
|
|
+ if (getGeocodingCheck(3000,
|
|
|
|
+ (position.getLatitudeDegree() + "," + position.getLongitudeDegree()),
|
|
|
|
+ requestParam.getReceiptCountrySubdivisionCode())) {
|
|
|
|
+ checkResultB = true;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (checkResultB) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
-// List<String> pointListA = new ArrayList<>();
|
|
|
|
-// String tempStartTime = startTimeA;
|
|
|
|
-// pointListA.add(tempStartTime);
|
|
|
|
-// for (int i = 0; i < pointNumber; i++) {
|
|
|
|
-// tempStartTime = DateUtil.addMinutes(tempStartTime, 30);
|
|
|
|
-// pointListA.add(tempStartTime);
|
|
|
|
-// }
|
|
|
|
-// List<VehicleHistoryPositionResponse.Data> verificationPositionListA = new ArrayList<>();
|
|
|
|
-// for (VehicleHistoryPositionResponse.Data position : positionList) {
|
|
|
|
-// for (int i = 0; i < pointNumber; i++) {
|
|
|
|
-// Long startTime = Long.parseLong(pointListA.get(i));
|
|
|
|
-// Long endTime = Long.parseLong(pointListA.get(i+1));
|
|
|
|
-// Long positionTime = Long.parseLong(position.getPositionTime());
|
|
|
|
-// if (positionTime >= startTime && positionTime < endTime) {
|
|
|
|
-// verificationPositionListA.add(position);
|
|
|
|
-// pointListA.remove(i);
|
|
|
|
-// break;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// if (verificationPositionListA.size() == pointNumber) {
|
|
|
|
-// break;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// boolean positionA = false;
|
|
|
|
-// for (int i = 0; i < verificationPositionListA.size(); i++) {
|
|
|
|
-// if (getGeocodingCheck(3000,
|
|
|
|
-// (verificationPositionListA.get(i).getLatitudeDegree() + "," + verificationPositionListA.get(i).getLongitudeDegree()),
|
|
|
|
-// requestParam.getLoadingCountrySubdivisionCode())) {
|
|
|
|
-// positionA = true;
|
|
|
|
-// break;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// List<String> pointListB = new ArrayList<>();
|
|
|
|
-// tempStartTime = startTimeB;
|
|
|
|
-// pointListB.add(tempStartTime);
|
|
|
|
-// for (int i = 0; i < pointNumber; i++) {
|
|
|
|
-// tempStartTime = DateUtil.addMinutes(tempStartTime, 30);
|
|
|
|
-// pointListB.add(tempStartTime);
|
|
|
|
-// }
|
|
|
|
-// List<VehicleHistoryPositionResponse.Data> verificationPositionListB = new ArrayList<>();
|
|
|
|
-// for (int i = 0; i < pointNumber; i++) {
|
|
|
|
-// for (VehicleHistoryPositionResponse.Data position : positionList) {
|
|
|
|
-// Long startTime = Long.parseLong(pointListB.get(i));
|
|
|
|
-// Long endTime = Long.parseLong(pointListB.get(i+1));
|
|
|
|
-// Long positionTime = Long.parseLong(position.getPositionTime());
|
|
|
|
-// if (positionTime >= startTime && positionTime < endTime) {
|
|
|
|
-// verificationPositionListB.add(position);
|
|
|
|
-// break;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// if (verificationPositionListB.size() == pointNumber) {
|
|
|
|
-// break;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// boolean positionB = false;
|
|
|
|
-// for (int i = 0; i < verificationPositionListB.size(); i++) {
|
|
|
|
-// if (getGeocodingCheck(3000,
|
|
|
|
-// (verificationPositionListB.get(i).getLatitudeDegree() + "," + verificationPositionListB.get(i).getLongitudeDegree()),
|
|
|
|
-// requestParam.getLoadingCountrySubdivisionCode())) {
|
|
|
|
-// positionB = true;
|
|
|
|
-// break;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// if (positionA && positionB) {
|
|
|
|
-// return true;
|
|
|
|
-// } else {
|
|
|
|
-// return false;
|
|
|
|
-// }
|
|
|
|
- return false;
|
|
|
|
|
|
+ if (checkResultA && checkResultB) {
|
|
|
|
+ return true;
|
|
|
|
+ } else {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|