Forráskód Böngészése

车辆更新当前站点位置

fllmoyu 4 éve
szülő
commit
348b2872b2

+ 27 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/callback/GpsDataCallbackImpl.java

@@ -1,6 +1,10 @@
 package com.jpsoft.bus.modules.bus.callback;
 
 import cn.hutool.core.lang.UUID;
+import com.jpsoft.bus.modules.bus.entity.ShiftInfo;
+import com.jpsoft.bus.modules.bus.service.GpsService;
+import com.jpsoft.bus.modules.bus.service.ShiftInfoService;
+import com.jpsoft.bus.modules.common.utils.CommonUtil;
 import com.jpsoft.gps.callback.GpsDataCallback;
 import com.jpsoft.gps.utils.GPSUtil;
 import com.jpsoft.bus.config.GpsParamConfig;
@@ -17,6 +21,7 @@ import org.springframework.data.redis.core.ValueOperations;
 import org.springframework.stereotype.Component;
 
 import java.util.Date;
+import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 @Slf4j
@@ -28,6 +33,12 @@ public class GpsDataCallbackImpl implements GpsDataCallback {
     @Autowired
     private GpsDataInfoService gpsDataInfoService;
 
+    @Autowired
+    private GpsService gpsService;
+
+    @Autowired
+    private ShiftInfoService shiftInfoService;
+
     @Autowired
     private VehicleInfoService vehicleInfoService;
 
@@ -98,6 +109,22 @@ public class GpsDataCallbackImpl implements GpsDataCallback {
                 v.setLatitude(latitude);//纬度
 
                 vehicleInfoService.updateGps(v);
+
+
+                //更新车辆的当前站点
+                try{
+                    List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleIdAndStatus(v.getId(),"1");
+                    if (shiftInfoList.size()>0){
+                        ShiftInfo shiftInfo = shiftInfoList.get(0);
+                        String stationId = gpsService.getLatelyStation(v.getId());
+                        if (!shiftInfo.getCurrentStationId().equals(stationId)){
+                            shiftInfo.setCurrentStationId(stationId);
+                            shiftInfoService.update(shiftInfo);
+                        }
+                    }
+                }catch (Exception ex){
+
+                }
             }
         }
     }

+ 10 - 6
web/src/main/java/com/jpsoft/bus/modules/pay/alipay/AlipayController.java

@@ -20,6 +20,8 @@ import com.jpsoft.bus.modules.base.entity.MergeOrderInfo;
 import com.jpsoft.bus.modules.base.entity.OrderInfo;
 import com.jpsoft.bus.modules.base.service.MergeOrderInfoService;
 import com.jpsoft.bus.modules.base.service.OrderInfoService;
+import com.jpsoft.bus.modules.bus.entity.PassengerInfo;
+import com.jpsoft.bus.modules.bus.service.PassengerInfoService;
 import com.jpsoft.bus.modules.common.dto.MessageResult;
 import com.jpsoft.bus.modules.pay.service.AlipayService;
 import com.jpsoft.bus.modules.wechat.vo.UserInfo;
@@ -54,6 +56,9 @@ public class AlipayController {
     @Autowired
     private MergeOrderInfoService mergeOrderInfoService;
 
+    @Autowired
+    private PassengerInfoService passengerInfoService;
+
     @Autowired
     private AliPayConfig aliPayConfig;
 
@@ -105,16 +110,15 @@ public class AlipayController {
 
                         try {
                             new Thread(() -> {
+                                PassengerInfo passengerInfo = passengerInfoService.get(orderInfo.getPassengerId());
+                                if (passengerInfo != null){
+                                    passengerInfo.setPayStatus("1");
+                                    passengerInfoService.update(passengerInfo);
+                                }
 
                                 try{
                                     //根据订单类型做各自处理
                                 }catch (Exception ex){
-                            /*SysLog sysLog = new SysLog();
-                            sysLog.setRemark(ex.getMessage());
-                            sysLog.setData(orderInfo.toString());
-                            sysLog.setPointcut("支付");
-                            sysLog.setCreateTime(new Date());
-                            sysLogService.insert(sysLog);*/
 
                                 }
 

+ 10 - 1
web/src/main/java/com/jpsoft/bus/modules/pay/wechat/WxPayController.java

@@ -16,6 +16,8 @@ import com.jpsoft.bus.modules.base.entity.PaymentInfo;
 import com.jpsoft.bus.modules.base.service.MergeOrderInfoService;
 import com.jpsoft.bus.modules.base.service.OrderInfoService;
 import com.jpsoft.bus.modules.base.service.PaymentInfoService;
+import com.jpsoft.bus.modules.bus.entity.PassengerInfo;
+import com.jpsoft.bus.modules.bus.service.PassengerInfoService;
 import com.jpsoft.bus.modules.common.dto.MessageResult;
 import com.jpsoft.bus.modules.pay.service.WechatService;
 import io.swagger.annotations.ApiOperation;
@@ -52,6 +54,9 @@ public class WxPayController {
     @Autowired
     private MergeOrderInfoService mergeOrderInfoService;
 
+    @Autowired
+    private PassengerInfoService passengerInfoService;
+
     @Autowired
     private OrderInfoService orderInfoService;
 
@@ -186,7 +191,11 @@ public class WxPayController {
 
                             new Thread(() -> {
                                 try {
-                                    //根据订单类型做各自处理
+                                    PassengerInfo passengerInfo = passengerInfoService.get(orderInfo.getPassengerId());
+                                    if (passengerInfo != null){
+                                        passengerInfo.setPayStatus("1");
+                                        passengerInfoService.update(passengerInfo);
+                                    }
 
                                 } catch (Exception ex) {
                                     log.error(ex.getMessage(), ex);