|
@@ -10,14 +10,8 @@ import com.github.pagehelper.Page;
|
|
|
import com.jpsoft.bus.config.OSSConfig;
|
|
|
import com.jpsoft.bus.modules.base.dto.MergeOrderDTO;
|
|
|
import com.jpsoft.bus.modules.base.dto.PassengerOrderDTO;
|
|
|
-import com.jpsoft.bus.modules.base.entity.HelpCenter;
|
|
|
-import com.jpsoft.bus.modules.base.entity.MergeOrderInfo;
|
|
|
-import com.jpsoft.bus.modules.base.entity.OrderInfo;
|
|
|
-import com.jpsoft.bus.modules.base.entity.ProblemFeedback;
|
|
|
-import com.jpsoft.bus.modules.base.service.HelpCenterService;
|
|
|
-import com.jpsoft.bus.modules.base.service.MergeOrderInfoService;
|
|
|
-import com.jpsoft.bus.modules.base.service.OrderInfoService;
|
|
|
-import com.jpsoft.bus.modules.base.service.ProblemFeedbackService;
|
|
|
+import com.jpsoft.bus.modules.base.entity.*;
|
|
|
+import com.jpsoft.bus.modules.base.service.*;
|
|
|
import com.jpsoft.bus.modules.bus.dto.*;
|
|
|
import com.jpsoft.bus.modules.bus.entity.*;
|
|
|
import com.jpsoft.bus.modules.bus.service.*;
|
|
@@ -65,6 +59,9 @@ public class PassengerApiController {
|
|
|
@Autowired
|
|
|
private PassengerMessageService passengerMessageService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RegionInfoService regionInfoService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private BaiduService baiduService;
|
|
|
|
|
@@ -147,7 +144,7 @@ public class PassengerApiController {
|
|
|
JSONObject verifyCodeJSON = new JSONObject();
|
|
|
verifyCodeJSON.put("code", verifyCode);
|
|
|
|
|
|
- messageResult = SMSUtil.send(phone,"车信达" ,"SMS_49390047", verifyCodeJSON.toString());
|
|
|
+ messageResult = SMSUtil.send(phone, "车信达", "SMS_49390047", verifyCodeJSON.toString());
|
|
|
|
|
|
//设置当前用户的验证码,5分钟内有效
|
|
|
redisTemplate.opsForValue().set(key, verifyCode, 5, TimeUnit.MINUTES);
|
|
@@ -284,8 +281,8 @@ public class PassengerApiController {
|
|
|
map.put("endTime", routeInfo.getEndTime());
|
|
|
map.put("routeName", routeInfo.getName());
|
|
|
map.put("mapPath", routeInfo.getMapPath());
|
|
|
- map.put("driver",driverInfo);
|
|
|
- map.put("licensePlateNumber",vehicleInfo.getLicensePlateNumber());
|
|
|
+ map.put("driver", driverInfo);
|
|
|
+ map.put("licensePlateNumber", vehicleInfo.getLicensePlateNumber());
|
|
|
// map.put("stationList",vehicleStationDTOList);
|
|
|
messageResult.setData(map);
|
|
|
messageResult.setResult(true);
|
|
@@ -1137,7 +1134,7 @@ public class PassengerApiController {
|
|
|
@ApiImplicitParam(name = "startStationId", value = "开始站点id", required = true, paramType = "form"),
|
|
|
@ApiImplicitParam(name = "currentStationId", value = "当前站点id", required = true, paramType = "form")
|
|
|
})
|
|
|
- public MessageResult<String> vehicleStationDis(String routeId, String startStationId,String currentStationId) {
|
|
|
+ public MessageResult<String> vehicleStationDis(String routeId, String startStationId, String currentStationId) {
|
|
|
MessageResult<String> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
@@ -1145,69 +1142,73 @@ public class PassengerApiController {
|
|
|
if (StringUtils.isBlank(routeId) || StringUtils.isBlank(startStationId)) {
|
|
|
throw new Exception("参数错误");
|
|
|
}
|
|
|
-
|
|
|
+ String des = null;
|
|
|
List<StationInfo> stationInfoList = stationInfoService.findByRouteId(routeId);
|
|
|
- //是否顺路
|
|
|
- Boolean tmp = true;
|
|
|
- if (!startStationId.equals(stationInfoList.get(0).getId())){
|
|
|
- tmp = false;
|
|
|
- }
|
|
|
|
|
|
- List<ShiftInfo> shiftInfoList = shiftInfoService.findByRouteIdAndStatusAndStartStationId(routeId,"1",startStationId);
|
|
|
- //查询的当前站
|
|
|
- StationInfo currentStation = stationInfoService.get(currentStationId);
|
|
|
+ if (stationInfoList.size() > 0) {
|
|
|
+ //是否顺路
|
|
|
+ Boolean tmp = true;
|
|
|
+ if (!startStationId.equals(stationInfoList.get(0).getId())) {
|
|
|
+ tmp = false;
|
|
|
+ }
|
|
|
|
|
|
- String des = null;
|
|
|
- if (shiftInfoList.size()>0){
|
|
|
- String vehicleId = "";
|
|
|
- int n = 1000;
|
|
|
- for (ShiftInfo shiftInfo : shiftInfoList){
|
|
|
- //班次当前站
|
|
|
- StationInfo stationInfo = stationInfoService.get(shiftInfo.getCurrentStationId());
|
|
|
- int stationInfoIndex = stationInfoList.indexOf(stationInfo);
|
|
|
-
|
|
|
- int currentStationIndex = stationInfoList.indexOf(currentStation);
|
|
|
- if (tmp){
|
|
|
- if (stationInfoIndex<=currentStationIndex){
|
|
|
- int m = currentStationIndex - stationInfoIndex;
|
|
|
- if (m<n){
|
|
|
- n = m;
|
|
|
- vehicleId = shiftInfo.getVehicleId();
|
|
|
+ List<ShiftInfo> shiftInfoList = shiftInfoService.findByRouteIdAndStatusAndStartStationId(routeId, "1", startStationId);
|
|
|
+ //查询的当前站
|
|
|
+ StationInfo currentStation = stationInfoService.get(currentStationId);
|
|
|
+
|
|
|
+
|
|
|
+ if (shiftInfoList.size() > 0) {
|
|
|
+ String vehicleId = "";
|
|
|
+ int n = 1000;
|
|
|
+ for (ShiftInfo shiftInfo : shiftInfoList) {
|
|
|
+ //班次当前站
|
|
|
+ StationInfo stationInfo = stationInfoService.get(shiftInfo.getCurrentStationId());
|
|
|
+ int stationInfoIndex = stationInfoList.indexOf(stationInfo);
|
|
|
+
|
|
|
+ int currentStationIndex = stationInfoList.indexOf(currentStation);
|
|
|
+ if (tmp) {
|
|
|
+ if (stationInfoIndex <= currentStationIndex) {
|
|
|
+ int m = currentStationIndex - stationInfoIndex;
|
|
|
+ if (m < n) {
|
|
|
+ n = m;
|
|
|
+ vehicleId = shiftInfo.getVehicleId();
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
- if (!tmp){
|
|
|
- if (stationInfoIndex >= currentStationIndex){
|
|
|
- int m = stationInfoIndex - currentStationIndex;
|
|
|
- if (m<n){
|
|
|
- n = m;
|
|
|
- vehicleId = shiftInfo.getVehicleId();
|
|
|
+ }
|
|
|
+ if (!tmp) {
|
|
|
+ if (stationInfoIndex >= currentStationIndex) {
|
|
|
+ int m = stationInfoIndex - currentStationIndex;
|
|
|
+ if (m < n) {
|
|
|
+ n = m;
|
|
|
+ vehicleId = shiftInfo.getVehicleId();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- if (StringUtils.isNotBlank(vehicleId)){
|
|
|
- //车辆
|
|
|
- VehicleInfo vehicleInfo = vehicleInfoService.get(vehicleId);
|
|
|
- //距离
|
|
|
- GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(vehicleInfo.getLatitude()), Double.valueOf(vehicleInfo.getLongitude()));
|
|
|
- GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(currentStation.getLatitude()), Double.valueOf(currentStation.getLongitude()));
|
|
|
+ if (StringUtils.isNotBlank(vehicleId)) {
|
|
|
+ //车辆
|
|
|
+ VehicleInfo vehicleInfo = vehicleInfoService.get(vehicleId);
|
|
|
+ //距离
|
|
|
+ GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(vehicleInfo.getLatitude()), Double.valueOf(vehicleInfo.getLongitude()));
|
|
|
+ GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(currentStation.getLatitude()), Double.valueOf(currentStation.getLongitude()));
|
|
|
|
|
|
- double meter1 = CommonUtil.getDistanceMeter(source, target, Ellipsoid.Sphere);
|
|
|
+ double meter1 = CommonUtil.getDistanceMeter(source, target, Ellipsoid.Sphere);
|
|
|
|
|
|
- int intMeter = (new Double(meter1)).intValue();
|
|
|
- //距离详情
|
|
|
- String distanceStr = null;
|
|
|
- if (intMeter >= 1000) {
|
|
|
- distanceStr = intMeter / 1000 + "公里";
|
|
|
- } else {
|
|
|
- distanceStr = intMeter + "米";
|
|
|
+ int intMeter = (new Double(meter1)).intValue();
|
|
|
+ //距离详情
|
|
|
+ String distanceStr = null;
|
|
|
+ if (intMeter >= 1000) {
|
|
|
+ distanceStr = intMeter / 1000 + "公里";
|
|
|
+ } else {
|
|
|
+ distanceStr = intMeter + "米";
|
|
|
+ }
|
|
|
+ des = n + "站 " + distanceStr;
|
|
|
}
|
|
|
- des = n + "站 "+ distanceStr;
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
messageResult.setData(des);
|
|
@@ -1226,14 +1227,13 @@ public class PassengerApiController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
@PostMapping("routeList")
|
|
|
@ApiOperation(value = "乘客查询线路列表")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "name", value = "线路名称", required = true, paramType = "form")
|
|
|
+ @ApiImplicitParam(name = "name", value = "线路名称", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "regionId", value = "区域id", required = false, paramType = "form")
|
|
|
})
|
|
|
- public MessageResult<Map> routeList(String name, @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
|
|
|
+ public MessageResult<Map> routeList(String name, String regionId, @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
|
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
@@ -1242,6 +1242,7 @@ public class PassengerApiController {
|
|
|
Map<String, Object> pageMap = new HashMap<>();
|
|
|
Map<String, Object> searchParams = new HashMap<>();
|
|
|
searchParams.put("name", "%" + name + "%");
|
|
|
+ searchParams.put("regionId", regionId);
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
sortList.add(new Sort("create_time", "desc"));
|
|
|
Page<RouteInfo> page = routeInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
|
|
@@ -1253,7 +1254,7 @@ public class PassengerApiController {
|
|
|
pageMap.put("pageNumber", page.getPageNum());
|
|
|
pageMap.put("pageSize", page.getPageSize());
|
|
|
|
|
|
- for (RouteInfo routeInfo : routeInfoList){
|
|
|
+ for (RouteInfo routeInfo : routeInfoList) {
|
|
|
RouteStationDTO routeStationDTO = new RouteStationDTO();
|
|
|
routeStationDTO.setId(routeInfo.getId());
|
|
|
routeStationDTO.setName(routeInfo.getName());
|
|
@@ -1281,9 +1282,6 @@ public class PassengerApiController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
pageMap.put("data", list);
|
|
|
|
|
|
|
|
@@ -1897,12 +1895,12 @@ public class PassengerApiController {
|
|
|
|
|
|
|
|
|
List<StationRemind> stationRemindList = stationRemindService.findByOpenId(openId);
|
|
|
- if (stationRemindList.size()>0){
|
|
|
- for (StationRemind stationRemind : stationRemindList){
|
|
|
+ if (stationRemindList.size() > 0) {
|
|
|
+ for (StationRemind stationRemind : stationRemindList) {
|
|
|
|
|
|
- if (StringUtils.isNotBlank(stationRemind.getVehicleShiftId())){
|
|
|
+ if (StringUtils.isNotBlank(stationRemind.getVehicleShiftId())) {
|
|
|
ShiftInfo shiftInfo = shiftInfoService.get(stationRemind.getVehicleShiftId());
|
|
|
- if ("1".equals(shiftInfo.getStatus())){
|
|
|
+ if ("1".equals(shiftInfo.getStatus())) {
|
|
|
RouteInfo routeInfo = routeInfoService.get(shiftInfo.getRouteId());
|
|
|
//终点站
|
|
|
StationInfo endStation = stationInfoService.get(shiftInfo.getEndStationId());
|
|
@@ -1914,7 +1912,7 @@ public class PassengerApiController {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- if (StringUtils.isNotBlank(stationRemind.getRouteId())){
|
|
|
+ if (StringUtils.isNotBlank(stationRemind.getRouteId())) {
|
|
|
RouteInfo routeInfo = routeInfoService.get(stationRemind.getRouteId());
|
|
|
//终点站
|
|
|
StationInfo endStation = stationInfoService.get(stationRemind.getEndStationId());
|
|
@@ -1929,8 +1927,6 @@ public class PassengerApiController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
messageResult.setData(stationRemindList);
|
|
|
messageResult.setResult(true);
|
|
|
messageResult.setCode(200);
|
|
@@ -1965,4 +1961,73 @@ public class PassengerApiController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @PostMapping("getRegionList")
|
|
|
+ @ApiOperation(value = "获取区域列表")
|
|
|
+ public MessageResult<List<RegionInfo>> getRegionList() {
|
|
|
+ MessageResult<List<RegionInfo>> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ List<RegionInfo> regionInfoList = regionInfoService.findCityRegion();
|
|
|
+
|
|
|
+
|
|
|
+ messageResult.setData(regionInfoList);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("getOwnerRegion")
|
|
|
+ @ApiOperation(value = "获取自己所在区域")
|
|
|
+ public MessageResult<RegionInfo> getOwnerRegion(String longitude, String latitude) {
|
|
|
+ MessageResult<RegionInfo> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ List<RegionInfo> regionInfoList = regionInfoService.findCityRegion();
|
|
|
+ RegionInfo regionInfo0 = regionInfoList.get(0);
|
|
|
+ if (regionInfoList.size() > 0) {
|
|
|
+
|
|
|
+ double distance = 0D;
|
|
|
+ for (RegionInfo regionInfo : regionInfoList) {
|
|
|
+ if (regionInfo.getLatitude() != null && regionInfo.getLongitude() != null) {
|
|
|
+
|
|
|
+ GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(latitude), Double.valueOf(longitude));
|
|
|
+
|
|
|
+ GlobalCoordinates target = new GlobalCoordinates(regionInfo.getLatitude(), regionInfo.getLongitude());
|
|
|
+
|
|
|
+ double meter1 = CommonUtil.getDistanceMeter(source, target, Ellipsoid.Sphere);
|
|
|
+ if (distance == 0D) {
|
|
|
+ regionInfo0 = regionInfo;
|
|
|
+ distance = meter1;
|
|
|
+ } else {
|
|
|
+ if (distance > meter1) {
|
|
|
+ regionInfo0 = regionInfo;
|
|
|
+ distance = meter1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ messageResult.setData(regionInfo0);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|