|
@@ -1,6 +1,7 @@
|
|
|
package info.aspirecn.iov.sjjh.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import info.aspirecn.iov.sjjh.commons.lang.ChannelTypeHandleResponseObject;
|
|
|
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) {
|
|
|
boolean result = vehicleHistoryPositionQueryByBaidu(positionResponse.getData(), requestParam);
|
|
|
if (result) {
|
|
|
+ JSONObject vehicleLocationInfo = new JSONObject();
|
|
|
+ vehicleLocationInfo.put("vehicleLocationInfo", positionResponse.getData());
|
|
|
ret.setResultCode(Constant.MATCH_CODE);
|
|
|
- ret.setResultBody(positionResponse.getData());
|
|
|
+ ret.setResultBody(vehicleLocationInfo);
|
|
|
ret.setResultDesc(Constant.QUERY_SUCCESS);
|
|
|
} else {
|
|
|
ret.setResultCode(Constant.UN_MATCH_CODE);
|
|
@@ -128,6 +131,7 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
ret.setResultBody(Constants.NO_RESULT);
|
|
|
ret.setResultDesc(Constants.NO_RESULT);
|
|
|
}
|
|
|
+ ret.setIsCharge(Constant.IS_CHARGE);
|
|
|
} else if (positionResponse.getResultCode().equals(Constants.RESULT_CODE_110000)) {
|
|
|
ret.setResultCode(Constant.UN_FIND_NUM_CODE);
|
|
|
ret.setResultBody(Constants.NO_RESULT);
|
|
@@ -168,116 +172,71 @@ public class VehicleServiceImpl implements VehicleService {
|
|
|
|
|
|
|
|
|
int pointNumber = supplierConfig.getAddHours()*2*2;
|
|
|
+
|
|
|
+ List<String> checkTimeListA = new ArrayList<>();
|
|
|
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;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ 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;
|
|
|
+
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- return false;
|
|
|
+ if (checkResultA && checkResultB) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|