| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.common.constant.state.Order; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | |
| | | import com.stylefeng.guns.modular.system.dao.PhoneMapper; |
| | | import com.stylefeng.guns.modular.system.dao.RegionMapper; |
| | | import com.stylefeng.guns.modular.system.dao.SysReformistMapper; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.OrderPosition; |
| | | import com.stylefeng.guns.modular.system.model.Region; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.service.IOrderService; |
| | | import com.stylefeng.guns.modular.system.service.ISystemNoticeService; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.DistancematrixVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.ReverseGeocodeVo; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.TinggPayUtil; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.CheckoutRequest; |
| | | import com.stylefeng.guns.modular.system.warpper.OrderListWarpper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | @Autowired |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | private IPaymentRecordService paymentRecordService; |
| | | |
| | | @Autowired |
| | | private IBankCardService bankCardService; |
| | | |
| | | @Autowired |
| | | private ICancleOrderService cancleOrderService; |
| | | |
| | | @Autowired |
| | | private ISettlementDetailService settlementDetailService; |
| | | |
| | | @Autowired |
| | | private ISettlementRecordService settlementRecordService; |
| | | |
| | | @Resource |
| | | private IBalanceUsageRecordService balanceUsageRecordService; |
| | | |
| | | @Resource |
| | | private FleetEngineUtil fleetEngineUtil; |
| | | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | @Autowired |
| | | private ICarService carService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryOrderList(Integer state, Integer pageNum, Integer size, Integer uid) throws Exception { |
| | | public List<Map<String, Object>> queryOrderList(Integer state, Integer pageNum, Integer size, Integer uid, Integer language) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> datas = new ArrayList<>(); |
| | | //出租车 |
| | | List<Map<String, Object>> list = orderTaxiService.queryOrderList(state, uid); |
| | | datas.addAll(list); |
| | | // List<Map<String, Object>> list = orderTaxiService.queryOrderList(state, uid); |
| | | // datas.addAll(list); |
| | | //专车 |
| | | List<Map<String, Object>> list1 = orderPrivateCarService.queryOrderList(state, uid); |
| | | List<Map<String, Object>> list1 = orderPrivateCarService.queryOrderList(state, uid, language); |
| | | datas.addAll(list1); |
| | | //跨城 |
| | | List<Map<String, Object>> list2 = orderCrossCityService.queryOrderList(state, uid); |
| | | datas.addAll(list2); |
| | | // List<Map<String, Object>> list2 = orderCrossCityService.queryOrderList(state, uid); |
| | | // datas.addAll(list2); |
| | | //小件物流 |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryOrderList(uid); |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryOrderList(state, uid, language); |
| | | datas.addAll(list3); |
| | | |
| | | //分页 |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryOrderList1(Integer state, Integer type, Integer pageNum, Integer size, Integer uid) throws Exception { |
| | | public List<Map<String, Object>> queryOrderList1(Integer state, Integer type, Integer pageNum, Integer size, Integer uid, Integer language) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> datas = new ArrayList<>(); |
| | | if(type == 1){ |
| | | //出租车 |
| | | List<Map<String, Object>> list = orderTaxiService.queryOrderList(state, uid); |
| | | List<Map<String, Object>> list = orderTaxiService.queryOrderList(language, state, uid); |
| | | datas.addAll(list); |
| | | //专车 |
| | | List<Map<String, Object>> list1 = orderPrivateCarService.queryOrderList(state, uid); |
| | | List<Map<String, Object>> list1 = orderPrivateCarService.queryOrderList(state, uid, language); |
| | | datas.addAll(list1); |
| | | //跨城 |
| | | List<Map<String, Object>> list2 = orderCrossCityService.queryOrderList(state, uid); |
| | | List<Map<String, Object>> list2 = orderCrossCityService.queryOrderList(language, state, uid); |
| | | datas.addAll(list2); |
| | | }else{//小件物流 |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryOrderList(uid); |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryOrderList(state, uid, language); |
| | | datas.addAll(list3); |
| | | } |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<OrderListWarpper> queryMyAllOrder(Integer state, Integer pageNum, Integer size, Integer uid) throws Exception { |
| | | public List<OrderListWarpper> queryMyAllOrder(Integer state, Integer pageNum, Integer size, Integer uid, Integer language) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> datas = new ArrayList<>(); |
| | | //出租车 |
| | | List<Map<String, Object>> list = orderTaxiService.queryMyAllOrder(state, uid); |
| | | datas.addAll(list); |
| | | // List<Map<String, Object>> list = orderTaxiService.queryMyAllOrder(state, uid); |
| | | // datas.addAll(list); |
| | | //专车 |
| | | List<Map<String, Object>> list1 = orderPrivateCarService.queryMyAllOrder(state, uid); |
| | | List<Map<String, Object>> list1 = orderPrivateCarService.queryMyAllOrder(state, uid, language); |
| | | for (Map<String, Object> map : list1) { |
| | | Integer id = Integer.valueOf(map.get("id").toString()); |
| | | map.put("settleAccounts", 0); |
| | | SettlementDetail settlementDetail = settlementDetailService.selectOne(new EntityWrapper<SettlementDetail>().eq("orderId", id).eq("orderType", 1)); |
| | | if(null != settlementDetail){ |
| | | SettlementRecord settlementRecord = settlementRecordService.selectById(settlementDetail.getSettlementRecordId()); |
| | | map.put("settleAccounts", null == settlementRecord || settlementRecord.getPaymentStatus() == 1 ? 0 : 1); |
| | | } |
| | | } |
| | | datas.addAll(list1); |
| | | //跨城 |
| | | List<Map<String, Object>> list2 = orderCrossCityService.queryMyAllOrder(state, uid); |
| | | datas.addAll(list2); |
| | | // List<Map<String, Object>> list2 = orderCrossCityService.queryMyAllOrder(state, uid); |
| | | // datas.addAll(list2); |
| | | //小件物流 |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryMyAllOrder(state, uid); |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryMyAllOrder(state, uid, language); |
| | | for (Map<String, Object> map : list3) { |
| | | Integer id = Integer.valueOf(map.get("id").toString()); |
| | | map.put("settleAccounts", 0); |
| | | SettlementDetail settlementDetail = settlementDetailService.selectOne(new EntityWrapper<SettlementDetail>().eq("orderId", id).eq("orderType", 4)); |
| | | if(null != settlementDetail){ |
| | | SettlementRecord settlementRecord = settlementRecordService.selectById(settlementDetail.getSettlementRecordId()); |
| | | map.put("settleAccounts", null == settlementRecord || settlementRecord.getPaymentStatus() == 1 ? 0 : 1); |
| | | } |
| | | } |
| | | datas.addAll(list3); |
| | | |
| | | List<OrderListWarpper> orderListWarpper = OrderListWarpper.getOrderListWarpper(datas); |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> queryPushOrder(Integer orderId, Integer orderType, String lon, String lat) throws Exception{ |
| | | public Map<String, Object> queryPushOrder(Integer orderId, Integer orderType, String lon, String lat, Integer language) throws Exception{ |
| | | Map<String, Object> map = null; |
| | | switch (orderType){ |
| | | case 1://专车 |
| | | map = orderPrivateCarService.queryPushOrder(orderId); |
| | | String order = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat")); |
| | | String distance = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order, 1).get("distance"); |
| | | map.put("startDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0); |
| | | map = orderPrivateCarService.queryPushOrder(orderId, language); |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | String tripId = redisUtil.getValue("trip" + orderPrivateCar.getUserId()); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(map.get("startLat").toString()), Double.valueOf(map.get("startLon").toString()), Double.valueOf(lat), Double.valueOf(lon), tripId); |
| | | map.put("startDistance", null != distancematrix ? new BigDecimal(distancematrix.getDistance()).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue() : 0); |
| | | |
| | | //总距离 |
| | | String end = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat")); |
| | | distance = gdMapElectricFenceUtil.getDistance(end, order, 1).get("distance"); |
| | | map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0); |
| | | distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(map.get("startLat").toString()), Double.valueOf(map.get("startLon").toString()), Double.valueOf(map.get("endLat").toString()), Double.valueOf(map.get("endLon").toString()), tripId); |
| | | map.put("totalDistance", null != distancematrix ? new BigDecimal(distancematrix.getDistance()).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue() : 0); |
| | | |
| | | Integer orderSource = Integer.valueOf(String.valueOf(map.get("orderSource"))); |
| | | if(orderSource == 1 || orderSource == 2 || orderSource == 3){ |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | map.put("type", "乘客下单"); |
| | | map.put("type", language == 1 ? "乘客创建" : language == 2 ? "Passenger creation" : "Créé par passager"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | | map.put("type", language == 1 ? "改派" : language == 2 ? "reassignment" : "recruté"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | map.put("type", "预约"); |
| | | map.put("type", language == 1 ? "预约" : language == 2 ? "Make an appointment" : "rendez-vous"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | | map.put("type", language == 1 ? "改派" : language == 2 ? "reassignment" : "recruté"); |
| | | } |
| | | } |
| | | if(orderSource == 5){ |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | map.put("type", "调度下单"); |
| | | map.put("type", language == 1 ? "调度创建" : language == 2 ? "Scheduling creation" : "Création de planning"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | | map.put("type", language == 1 ? "改派" : language == 2 ? "reassignment" : "recruté"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | map.put("type", "预约"); |
| | | map.put("type", language == 1 ? "预约" : language == 2 ? "Make an appointment" : "rendez-vous"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | | map.put("type", language == 1 ? "改派" : language == 2 ? "reassignment" : "recruté"); |
| | | } |
| | | } |
| | | break; |
| | | case 2://出租 |
| | | map = orderTaxiService.queryPushOrder(orderId); |
| | | String order1 = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat")); |
| | | String distance1 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order1, 1).get("distance"); |
| | | map.put("startDistance", ToolUtil.isNotEmpty(distance1) ? Double.valueOf(distance1) / 1000 : 0); |
| | | |
| | | //总距离 |
| | | String end1 = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat")); |
| | | distance = gdMapElectricFenceUtil.getDistance(end1, order1, 1).get("distance"); |
| | | map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0); |
| | | |
| | | Integer orderSource1 = Integer.valueOf(String.valueOf(map.get("orderSource"))); |
| | | if(orderSource1 == 1 || orderSource1 == 2 || orderSource1 == 3){ |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | map.put("type", "乘客下单"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | map.put("type", "预约"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | | } |
| | | } |
| | | if(orderSource1 == 5){ |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | map.put("type", "调度下单"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | map.put("type", "预约"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | | } |
| | | } |
| | | // map = orderTaxiService.queryPushOrder(orderId); |
| | | // String order1 = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat")); |
| | | // String distance1 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order1, 1).get("distance"); |
| | | // map.put("startDistance", ToolUtil.isNotEmpty(distance1) ? Double.valueOf(distance1) / 1000 : 0); |
| | | // |
| | | // //总距离 |
| | | // String end1 = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat")); |
| | | // distance = gdMapElectricFenceUtil.getDistance(end1, order1, 1).get("distance"); |
| | | // map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0); |
| | | // |
| | | // Integer orderSource1 = Integer.valueOf(String.valueOf(map.get("orderSource"))); |
| | | // if(orderSource1 == 1 || orderSource1 == 2 || orderSource1 == 3){ |
| | | // if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | // map.put("type", "乘客下单"); |
| | | // } |
| | | // if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | // map.put("type", "改派"); |
| | | // } |
| | | // if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | // map.put("type", "预约"); |
| | | // } |
| | | // if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | // map.put("type", "改派"); |
| | | // } |
| | | // } |
| | | // if(orderSource1 == 5){ |
| | | // if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | // map.put("type", "调度下单"); |
| | | // } |
| | | // if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | // map.put("type", "改派"); |
| | | // } |
| | | // if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | // map.put("type", "预约"); |
| | | // } |
| | | // if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 2 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | // map.put("type", "改派"); |
| | | // } |
| | | // } |
| | | break; |
| | | case 3://城际 |
| | | map = orderCrossCityService.queryPushOrder(orderId); |
| | | String order2 = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat")); |
| | | String distance2 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order2, 1).get("distance"); |
| | | map.put("startDistance", ToolUtil.isNotEmpty(distance2) ? Double.valueOf(distance2) / 1000 : 0); |
| | | |
| | | //总距离 |
| | | String end2 = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat")); |
| | | distance = gdMapElectricFenceUtil.getDistance(end2, order2, 1).get("distance"); |
| | | map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0); |
| | | |
| | | Integer orderSource2 = Integer.valueOf(String.valueOf(map.get("orderSource"))); |
| | | if(orderSource2 == 1 || orderSource2 == 2 || orderSource2 == 3){ |
| | | if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | map.put("type", "乘客下单"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | | } |
| | | } |
| | | if(orderSource2 == 5){ |
| | | if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | map.put("type", "调度下单"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | | } |
| | | } |
| | | // map = orderCrossCityService.queryPushOrder(orderId); |
| | | // String order2 = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat")); |
| | | // String distance2 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order2, 1).get("distance"); |
| | | // map.put("startDistance", ToolUtil.isNotEmpty(distance2) ? Double.valueOf(distance2) / 1000 : 0); |
| | | // |
| | | // //总距离 |
| | | // String end2 = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat")); |
| | | // distance = gdMapElectricFenceUtil.getDistance(end2, order2, 1).get("distance"); |
| | | // map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0); |
| | | // |
| | | // Integer orderSource2 = Integer.valueOf(String.valueOf(map.get("orderSource"))); |
| | | // if(orderSource2 == 1 || orderSource2 == 2 || orderSource2 == 3){ |
| | | // if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | // map.put("type", "乘客下单"); |
| | | // } |
| | | // if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | // map.put("type", "改派"); |
| | | // } |
| | | // } |
| | | // if(orderSource2 == 5){ |
| | | // if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | // map.put("type", "调度下单"); |
| | | // } |
| | | // if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | // map.put("type", "改派"); |
| | | // } |
| | | // } |
| | | break; |
| | | case 4://同城小件物流 |
| | | map = orderLogisticsService.queryPushOrder(orderId); |
| | | String order3 = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat")); |
| | | String distance3 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order3, 1).get("distance"); |
| | | map.put("startDistance", ToolUtil.isNotEmpty(distance3) ? Double.valueOf(distance3) / 1000 : 0); |
| | | case 4://市内小件物流 |
| | | map = orderLogisticsService.queryPushOrder(orderId, language); |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | String tripId1 = redisUtil.getValue("trip" + orderLogistics.getUserId()); |
| | | DistancematrixVo distancematrix1 = GoogleMapUtil.getDistancematrix(Double.valueOf(map.get("startLat").toString()), Double.valueOf(map.get("startLon").toString()), Double.valueOf(lat), Double.valueOf(lon), tripId1); |
| | | map.put("startDistance", null != distancematrix1 ? new BigDecimal(distancematrix1.getDistance()).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue() : 0); |
| | | |
| | | //总距离 |
| | | String end3 = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat")); |
| | | distance = gdMapElectricFenceUtil.getDistance(end3, order3, 1).get("distance"); |
| | | map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0); |
| | | distancematrix1 = GoogleMapUtil.getDistancematrix(Double.valueOf(map.get("startLat").toString()), Double.valueOf(map.get("startLon").toString()), Double.valueOf(map.get("endLat").toString()), Double.valueOf(map.get("endLon").toString()), tripId1); |
| | | map.put("totalDistance", null != distancematrix1 ? new BigDecimal(distancematrix1.getDistance()).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue() : 0); |
| | | |
| | | Integer orderSource3 = Integer.valueOf(String.valueOf(map.get("orderSource"))); |
| | | if(orderSource3 == 1 || orderSource3 == 2 || orderSource3 == 3){ |
| | | if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | map.put("type", "乘客下单"); |
| | | map.put("type", language == 1 ? "乘客创建" : language == 2 ? "Passenger creation" : "Créé par passager"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | | map.put("type", language == 1 ? "改派" : language == 2 ? "reassignment" : "recruté"); |
| | | } |
| | | } |
| | | if(orderSource3 == 5){ |
| | | if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | map.put("type", "调度下单"); |
| | | map.put("type", language == 1 ? "调度创建" : language == 2 ? "Scheduling creation" : "Création de planning"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | | map.put("type", language == 1 ? "改派" : language == 2 ? "reassignment" : "recruté"); |
| | | } |
| | | } |
| | | break; |
| | | case 5://跨城小件物流 |
| | | map = orderLogisticsService.queryPushOrder(orderId); |
| | | String order4 = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat")); |
| | | String distance4 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order4, 1).get("distance"); |
| | | map.put("startDistance", ToolUtil.isNotEmpty(distance4) ? Double.valueOf(distance4) / 1000 : 0); |
| | | |
| | | //总距离 |
| | | String end4 = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat")); |
| | | distance = gdMapElectricFenceUtil.getDistance(end4, order4, 1).get("distance"); |
| | | map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0); |
| | | |
| | | Integer orderSource4 = Integer.valueOf(String.valueOf(map.get("orderSource"))); |
| | | if(orderSource4 == 1 || orderSource4 == 2 || orderSource4 == 3){ |
| | | if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | map.put("type", "乘客下单"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | | } |
| | | } |
| | | if(orderSource4 == 5){ |
| | | if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | map.put("type", "调度下单"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | | } |
| | | } |
| | | // map = orderLogisticsService.queryPushOrder(orderId); |
| | | // String order4 = String.valueOf(map.get("startLon")) + "," + String.valueOf(map.get("startLat")); |
| | | // String distance4 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, order4, 1).get("distance"); |
| | | // map.put("startDistance", ToolUtil.isNotEmpty(distance4) ? Double.valueOf(distance4) / 1000 : 0); |
| | | // |
| | | // //总距离 |
| | | // String end4 = String.valueOf(map.get("endLon")) + "," + String.valueOf(map.get("endLat")); |
| | | // distance = gdMapElectricFenceUtil.getDistance(end4, order4, 1).get("distance"); |
| | | // map.put("totalDistance", ToolUtil.isNotEmpty(distance) ? Double.valueOf(distance) / 1000 : 0); |
| | | // |
| | | // Integer orderSource4 = Integer.valueOf(String.valueOf(map.get("orderSource"))); |
| | | // if(orderSource4 == 1 || orderSource4 == 2 || orderSource4 == 3){ |
| | | // if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | // map.put("type", "乘客下单"); |
| | | // } |
| | | // if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | // map.put("type", "改派"); |
| | | // } |
| | | // } |
| | | // if(orderSource4 == 5){ |
| | | // if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | // map.put("type", "调度下单"); |
| | | // } |
| | | // if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | // map.put("type", "改派"); |
| | | // } |
| | | // } |
| | | break; |
| | | case 6: |
| | | break; |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public synchronized ResultUtil grabOrder(Integer orderId, Integer orderType, Integer uid) throws Exception { |
| | | public synchronized ResultUtil grabOrder(Integer orderId, Integer orderType, Integer uid, Integer language) throws Exception { |
| | | switch (orderType){ |
| | | case 1://专车 |
| | | return orderPrivateCarService.grabOrder(orderId, uid); |
| | | return orderPrivateCarService.grabOrder(orderId, uid, language); |
| | | case 2://出租 |
| | | return orderTaxiService.grabOrder(orderId, uid); |
| | | // return orderTaxiService.grabOrder(orderId, uid); |
| | | case 3://城际 |
| | | return ResultUtil.success();//不作任何操作,跨城默认选择的司机 |
| | | case 4://同城小件 |
| | | return orderLogisticsService.grabOrder(orderId, uid); |
| | | return orderLogisticsService.grabOrder(orderId, uid, language); |
| | | case 5://跨城小件 |
| | | return orderLogisticsService.grabOrder(orderId, uid); |
| | | // return orderLogisticsService.grabOrder(orderId, uid); |
| | | case 6: |
| | | break; |
| | | } |
| | |
| | | case 3://城际 |
| | | break; |
| | | case 4://同城小件 |
| | | return orderLogisticsService.grabOrder_(orderId, uid); |
| | | // return orderLogisticsService.grabOrder_(orderId, uid); |
| | | case 5://跨城小件 |
| | | return orderLogisticsService.grabOrder_(orderId, uid); |
| | | // return orderLogisticsService.grabOrder_(orderId, uid); |
| | | case 6: |
| | | break; |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public Map<String, Object> queryOrderInfo(Integer orderId, Integer orderType) throws Exception { |
| | | public Map<String, Object> queryOrderInfo(Integer language, Integer orderId, Integer orderType) throws Exception { |
| | | Map<String, Object> map = null; |
| | | switch (orderType){ |
| | | case 1://专车 |
| | | map = orderPrivateCarService.queryOrderInfo(orderId); |
| | | map = orderPrivateCarService.queryOrderInfo(language, orderId); |
| | | break; |
| | | case 2://出租 |
| | | map = orderTaxiService.queryOrderInfo(orderId); |
| | | // map = orderTaxiService.queryOrderInfo(orderId); |
| | | break; |
| | | case 3://城际 |
| | | map = orderCrossCityService.queryOrderCrossCityInfo(orderId); |
| | | // map = orderCrossCityService.queryOrderCrossCityInfo(orderId); |
| | | break; |
| | | case 4://同城小件 |
| | | map = orderLogisticsService.queryOrderInfo(orderId); |
| | | map = orderLogisticsService.queryOrderInfo(language, orderId); |
| | | break; |
| | | case 5://跨城小件 |
| | | map = orderLogisticsService.queryOrderInfo(orderId); |
| | | // map = orderLogisticsService.queryOrderInfo(orderId); |
| | | break; |
| | | case 6: |
| | | break; |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil process(Integer orderId, Integer orderType, Integer state, Integer uid, Double lon, Double lat,String phone) throws Exception { |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(String.valueOf(lon), String.valueOf(lat)); |
| | | String address = geocode.get("address"); |
| | | public ResultUtil process(Integer orderId, Integer orderType, Integer state, Integer uid, Double lon, Double lat,String phone, String pickUpCode, Integer language) throws Exception { |
| | | switch (orderType){ |
| | | case 1://专车 |
| | | return orderPrivateCarService.process(orderId, state, lon, lat, address,phone); |
| | | return orderPrivateCarService.process(orderId, state, lon, lat, phone, language, uid); |
| | | case 2://出租 |
| | | return orderTaxiService.process(orderId, state, lon, lat, address); |
| | | // return orderTaxiService.process(orderId, state, lon, lat, address); |
| | | case 3://城际 |
| | | return orderCrossCityService.process(orderId, state, lon, lat, address); |
| | | // return orderCrossCityService.process(orderId, state, lon, lat, address); |
| | | case 4://同城小件 |
| | | return orderLogisticsService.process(orderId, state, lon, lat, address); |
| | | return orderLogisticsService.process(orderId, state, lon, lat, pickUpCode, language, uid); |
| | | case 5://跨城小件 |
| | | return orderLogisticsService.process(orderId, state, lon, lat, address); |
| | | // return orderLogisticsService.process(orderId, state, lon, lat, address); |
| | | case 6: |
| | | break; |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil confirmFees(Integer orderId, Integer orderType, Integer type, Double travelFee, Double parkingFee, Double crossingFee) throws Exception { |
| | | public ResultUtil confirmFees(Integer language, Integer orderId, Integer orderType, Integer type, Double travelFee, |
| | | Double parkingFee, Double crossingFee, Integer uid) throws Exception { |
| | | switch (orderType){ |
| | | case 1://专车 |
| | | return orderPrivateCarService.confirmFees(orderId, type, parkingFee, crossingFee); |
| | | return orderPrivateCarService.confirmFees(language, orderId, type, parkingFee, crossingFee, uid); |
| | | case 2://出租 |
| | | return orderTaxiService.confirmFees(orderId, type, travelFee, parkingFee, crossingFee); |
| | | case 3://城际(没有此流程) |
| | | break; |
| | | case 4:// |
| | | break; |
| | | return orderLogisticsService.confirmFees(language, orderId, type, parkingFee, crossingFee, uid); |
| | | case 5: |
| | | break; |
| | | case 6: |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> queryToBePaidPage(Integer orderId, Integer orderType) throws Exception{ |
| | | public Map<String, Object> queryToBePaidPage(Integer language, Integer orderId, Integer orderType) throws Exception{ |
| | | switch (orderType){ |
| | | case 1://专车 |
| | | return orderPrivateCarService.queryOrderInfo(orderId); |
| | | return orderPrivateCarService.queryOrderInfo(language, orderId); |
| | | case 2://出租 |
| | | return orderTaxiService.queryOrderInfo(orderId); |
| | | return orderTaxiService.queryOrderInfo(language, orderId); |
| | | case 3://城际(没有此流程) |
| | | return null; |
| | | case 4:// |
| | | break; |
| | | return orderLogisticsService.queryOrderInfo(language, orderId); |
| | | case 5: |
| | | break; |
| | | case 6: |
| | |
| | | case 3://城际 |
| | | return orderCrossCityService.calculateMileage(orderPosition); |
| | | case 4:// |
| | | break; |
| | | return orderLogisticsService.calculateMileage(orderPosition.getOrderId(), orderPosition.getLon(), orderPosition.getLat()); |
| | | case 5: |
| | | break; |
| | | case 6: |
| | |
| | | */ |
| | | @Override |
| | | public Integer queryOrderNum(Integer driverId, Date start, Date end) throws Exception { |
| | | //出租车 |
| | | Integer[] state = new Integer[]{6, 7, 8, 9}; |
| | | int i = orderPrivateCarService.selectCount(new EntityWrapper<OrderPrivateCar>().eq("driverId", driverId).between("insertTime", start, end).in("", state)); |
| | | return i; |
| | | int i = orderPrivateCarService.selectCount(new EntityWrapper<OrderPrivateCar>().eq("driverId", driverId) |
| | | .between("insertTime", start, end).in("state", Arrays.asList(6, 7, 8, 9))); |
| | | int i1 = orderLogisticsService.selectCount(new EntityWrapper<OrderLogistics>().eq("driverId", driverId) |
| | | .between("insertTime", start, end).in("state", Arrays.asList(6, 7, 8, 9))); |
| | | return i + i1; |
| | | } |
| | | |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil completeOrder(Integer orderId, Integer orderType) throws Exception { |
| | | public ResultUtil completeOrder(Integer orderId, Integer orderType, Integer language) throws Exception { |
| | | Integer userId = 0; |
| | | Integer driverId = 0; |
| | | Integer state = 0; |
| | |
| | | case 1: |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | if(orderPrivateCar.getState() == 8 || orderPrivateCar.getState() == 9){ |
| | | return ResultUtil.error("订单已完成支付,不允许重复支付"); |
| | | return ResultUtil.error(language == 1 ? "订单已完成支付,不允许重复支付" : language == 2 ? "The order has been paid, recurring payments is not allowed." : "La commande a été payée, les paiements récurrents ne sont pas autorisés."); |
| | | } |
| | | if(orderPrivateCar.getState() != 7){ |
| | | return ResultUtil.error("订单不在待支付,无法完成订单"); |
| | | return ResultUtil.error(language == 1 ? "订单不在待支付,无法完成订单" : language == 2 ? "The order is no longer with Pending Payment, unable to complete the order." : "La commande n’est plus en attente de paiement, il est impossible de terminer la commande."); |
| | | } |
| | | orderPrivateCar.setPayManner(2);//其他方式支付 |
| | | orderPrivateCar.setRedPacketMoney(0D); |
| | |
| | | driverId = orderPrivateCar.getDriverId(); |
| | | state = orderPrivateCar.getState(); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.operatePay(orderId); |
| | | } |
| | | } |
| | | }).start(); |
| | | break; |
| | | case 2: |
| | | OrderTaxi orderTaxi = orderTaxiService.selectById(orderId); |
| | | if(orderTaxi.getState() == 8 || orderTaxi.getState() == 9){ |
| | | return ResultUtil.error("订单已完成支付,不允许重复支付"); |
| | | return ResultUtil.error(language == 1 ? "订单已完成支付,不允许重复支付" : language == 2 ? "The order has been paid, recurring payments is not allowed." : "La commande a été payée, les paiements récurrents ne sont pas autorisés."); |
| | | } |
| | | if(orderTaxi.getState() != 7){ |
| | | return ResultUtil.error("订单不在待支付,无法完成订单"); |
| | | return ResultUtil.error(language == 1 ? "订单不在待支付,无法完成订单" : language == 2 ? "The order is no longer with Pending Payment, unable to complete the order." : "La commande n’est plus en attente de paiement, il est impossible de terminer la commande."); |
| | | } |
| | | orderTaxi.setPayManner(2);//其他方式支付 |
| | | orderTaxi.setRedPacketMoney(0D); |
| | |
| | | redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString()); |
| | | } |
| | | break; |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | if(orderLogistics.getState() == 8 || orderLogistics.getState() == 9){ |
| | | return ResultUtil.error(language == 1 ? "订单已完成支付,不允许重复支付" : language == 2 ? "The order has been paid, recurring payments is not allowed." : "La commande a été payée, les paiements récurrents ne sont pas autorisés."); |
| | | } |
| | | if(orderLogistics.getState() != 7){ |
| | | return ResultUtil.error(language == 1 ? "订单不在待支付,无法完成订单" : language == 2 ? "The order is no longer with Pending Payment, unable to complete the order." : "La commande n’est plus en attente de paiement, il est impossible de terminer la commande."); |
| | | } |
| | | orderLogistics.setPayManner(2);//其他方式支付 |
| | | orderLogistics.setRedPacketMoney(0D); |
| | | orderLogistics.setCouponMoney(0D); |
| | | orderLogistics.setDiscount(0D); |
| | | orderLogistics.setDiscountMoney(0D); |
| | | orderLogistics.setPayMoney(orderLogistics.getOrderMoney()); |
| | | orderLogistics.setState(8); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | userId = orderLogistics.getUserId(); |
| | | driverId = orderLogistics.getDriverId(); |
| | | state = orderLogistics.getState(); |
| | | break; |
| | | } |
| | | |
| | | |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, finalUserId, orderId, orderType, finalState); |
| | | pushUtil.pushOrderState(2, finalDriverId, orderId, orderType, finalState); |
| | | pushUtil.pushOrderState(1, finalUserId, orderId, orderType, finalState, 0, "", "driver"); |
| | | pushUtil.pushOrderState(2, finalDriverId, orderId, orderType, finalState, 0, "", "driver"); |
| | | } |
| | | }).start(); |
| | | return ResultUtil.success(); |
| | |
| | | return orderPrivateCarService.queryMoneyInfo(orderId); |
| | | case 2: |
| | | break; |
| | | case 4: |
| | | return orderLogisticsService.queryMoneyInfo(orderId); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public void taskSmsSend() throws Exception { |
| | | Integer language = 2; |
| | | //获取未支付订单 |
| | | Date day = new Date(); |
| | | List<OrderPrivateCar> orderList = orderPrivateCarService.getSmsOrderList(); |
| | | |
| | | for(OrderPrivateCar order : orderList){ |
| | | if(order.getSmsTime()==null ){ |
| | | if(order.getGetoffTime().getTime()+24*60*60*1000L<day.getTime()){ |
| | | if(null != order.getGetoffTime() && order.getGetoffTime().getTime()+24*60*60*1000L<day.getTime()){ |
| | | order.setSmsNumber(order.getSmsNumber()+1); |
| | | order.setSmsTime(day); |
| | | //发送短信 |
| | |
| | | String sData = aLiSendSms.sendSms1(order.getPassengersPhone(), "SMS_215342869", "{\"time\":\"" + DateUtil.format(order.getGetoffTime(),"yyyy-MM-dd HH:mm:ss") + "\",\"money\":\"" + order.getOrderMoney() + "\"}"); |
| | | } |
| | | //添加消息记录 |
| | | systemNoticeService.addSystemNotice(1, "有一笔订单未付款,请前往支付!", order.getUserId()); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "有一笔订单未付款,请前往支付!" : language == 2 ? "There is an order pending payment, please pay." : "Il y a une commande en attente de paiement, veuillez payer.", order.getUserId()); |
| | | } |
| | | }else{ |
| | | if(order.getSmsTime().getTime()+24*60*60*1000L<day.getTime()){ |
| | |
| | | } |
| | | |
| | | //添加消息记录 |
| | | systemNoticeService.addSystemNotice(1, "有一笔订单未付款,请前往支付!", order.getUserId()); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "有一笔订单未付款,请前往支付!" : language == 2 ? "There is an order pending payment, please pay." : "Il y a une commande en attente de paiement, veuillez payer.", order.getUserId()); |
| | | } |
| | | } |
| | | } |
| | | orderPrivateCarService.updateBatchById(orderList); |
| | | if(orderList.size() > 0){ |
| | | orderPrivateCarService.updateBatchById(orderList); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil payOrder(Integer uid, Integer orderId, Integer orderType, Integer payType, Integer bankCardId, Integer language) throws Exception { |
| | | Double money = 0D; |
| | | Driver driver = driverService.selectById(uid); |
| | | if(orderType == 1){//专车 |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | money = orderPrivateCar.getPayMoney(); |
| | | if(orderPrivateCar.getPayType() != 4){ |
| | | return ResultUtil.error(language == 1 ? "无法进行支付" : language == 2 ? "Unable to make payments" : "Impossible d’effectuer des paiements"); |
| | | } |
| | | if(orderPrivateCar.getDriverPay() == 2){ |
| | | return ResultUtil.error(language == 1 ? "不能重复支付" : language == 2 ? "Unable to recur payments" : "Impossible de récurrence des paiements"); |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(driver.getBalance().compareTo(money) < 0){ |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient balance" : "Solde insuffisant"); |
| | | } |
| | | } |
| | | } |
| | | if(orderType == 4){//小件 |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | money = orderLogistics.getPayMoney(); |
| | | if(orderLogistics.getPayType() != 4){ |
| | | return ResultUtil.error(language == 1 ? "无法进行支付" : language == 2 ? "Unable to make payments" : "Impossible d’effectuer des paiements"); |
| | | } |
| | | if(orderLogistics.getDriverPay() == 2){ |
| | | return ResultUtil.error(language == 1 ? "不能重复支付" : language == 2 ? "Unable to recur payments" : "Impossible de récurrence des paiements"); |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(driver.getBalance().compareTo(money) < 0){ |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient balance" : "Solde insuffisant"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(0 < money){ |
| | | if(payType == 1) {//手机支付 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + "4" + language + orderId; |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(Long.valueOf(driver.getPhone())); |
| | | checkoutRequest.setCustomerEmail(driver.getEmail()); |
| | | checkoutRequest.setAccountNumber(driver.getPhone()); |
| | | checkoutRequest.setCustomerFirstName(driver.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(driver.getLastName()); |
| | | checkoutRequest.setRequestAmount(money); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | ResultUtil resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, uid, 2, orderId, orderType, 1, money, null, 1);//添加预支付数据 |
| | | }else{ |
| | | resultUtil = ResultUtil.error(language == 1 ? "支付失败" : language == 2 ? "Payment failure" : "Échec de paiement", ""); |
| | | } |
| | | return resultUtil; |
| | | } |
| | | |
| | | if(payType == 2) {//银行卡支付 |
| | | BankCard bankCard = bankCardService.selectById(bankCardId); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + "4" + language + orderId; |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(Long.valueOf(bankCard.getCode())); |
| | | checkoutRequest.setCustomerEmail(driver.getEmail()); |
| | | checkoutRequest.setAccountNumber(bankCard.getCode()); |
| | | checkoutRequest.setCustomerFirstName(bankCard.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(bankCard.getLastName()); |
| | | checkoutRequest.setRequestAmount(money); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | ResultUtil resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, uid, 2, orderId, orderType, 2, money, null, 1);//添加预支付数据 |
| | | }else{ |
| | | resultUtil = ResultUtil.error(language == 1 ? "支付失败" : language == 2 ? "Payment failure" : "Échec de paiement", ""); |
| | | } |
| | | return resultUtil; |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | driver.setBalance(driver.getBalance() - money); |
| | | Double laveBusinessMoney = driver.getLaveBusinessMoney(); |
| | | if(laveBusinessMoney.compareTo(money) < 0){ |
| | | double b = money - laveBusinessMoney; |
| | | driver.setLaveBusinessMoney(0D); |
| | | driver.setLaveActivityMoney(driver.getLaveActivityMoney() - b); |
| | | driverService.updateById(driver); |
| | | balanceUsageRecordService.saveBalanceUsageRecord(driver.getId(), 1, b, orderType == 1 ? 1 : 2); |
| | | balanceUsageRecordService.saveBalanceUsageRecord(driver.getId(), 2, laveBusinessMoney, orderType == 1 ? 1 : 2); |
| | | }else{ |
| | | driver.setLaveBusinessMoney(driver.getLaveBusinessMoney() - money); |
| | | driverService.updateById(driver); |
| | | balanceUsageRecordService.saveBalanceUsageRecord(driver.getId(), 2, money, orderType == 1 ? 1 : 2); |
| | | } |
| | | |
| | | if(orderType == 1){//专车 |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | orderPrivateCar.setDriverPay(2); |
| | | orderPrivateCarService.updateById(orderPrivateCar); |
| | | } |
| | | if(orderType == 4){//小件 |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | orderLogistics.setDriverPay(2); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | } |
| | | transactionDetailsService.saveData(uid, "现金收款代付", money, 2, 1, 2, orderType, orderId); |
| | | } |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void getDriverNowPosition() { |
| | | for (OrderPrivateCar orderPrivateCar : orderPrivateCarService.selectList(new EntityWrapper<OrderPrivateCar>().eq("state", 5))) { |
| | | String trackId = orderPrivateCar.getTrackId(); |
| | | if(ToolUtil.isNotEmpty(trackId)){ |
| | | String trip = fleetEngineUtil.getTrip(trackId); |
| | | JSONObject lastLocation = JSON.parseObject(trip).getJSONObject("lastLocation"); |
| | | JSONObject location = lastLocation.getJSONObject("location"); |
| | | Double latitude = location.getDouble("latitude"); |
| | | Double longitude = location.getDouble("longitude"); |
| | | OrderPosition orderPosition = new OrderPosition(); |
| | | orderPosition.setOrderId(orderPrivateCar.getId()); |
| | | orderPosition.setOrderType(1); |
| | | orderPosition.setDriverId(orderPrivateCar.getDriverId()); |
| | | orderPosition.setLat(latitude.toString()); |
| | | orderPosition.setLon(longitude.toString()); |
| | | orderPosition.setInsertTime(new Date()); |
| | | try { |
| | | orderPositionService.saveData(orderPosition); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<OrderLogistics> orderLogisticsList = orderLogisticsService.selectList(new EntityWrapper<OrderLogistics>().eq("state", 5)); |
| | | for (OrderLogistics orderLogistics : orderLogisticsList) { |
| | | String trackId = orderLogistics.getTrackId(); |
| | | if(ToolUtil.isNotEmpty(trackId)){ |
| | | String trip = fleetEngineUtil.getTrip(trackId); |
| | | JSONObject lastLocation = JSON.parseObject(trip).getJSONObject("lastLocation"); |
| | | JSONObject location = lastLocation.getJSONObject("location"); |
| | | Double latitude = location.getDouble("latitude"); |
| | | Double longitude = location.getDouble("longitude"); |
| | | OrderPosition orderPosition = new OrderPosition(); |
| | | orderPosition.setOrderId(orderLogistics.getId()); |
| | | orderPosition.setOrderType(1); |
| | | orderPosition.setDriverId(orderLogistics.getDriverId()); |
| | | orderPosition.setLat(latitude.toString()); |
| | | orderPosition.setLon(longitude.toString()); |
| | | orderPosition.setInsertTime(new Date()); |
| | | try { |
| | | orderPositionService.saveData(orderPosition); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 结束google订单状态 |
| | | */ |
| | | @Override |
| | | public void overGoogleOrder() { |
| | | List<OrderPrivateCar> privateCars = orderPrivateCarService.selectList(new EntityWrapper<OrderPrivateCar>().isNotNull("tripId") |
| | | .eq("isover", 0).in("state", Arrays.asList(6, 7, 8, 9, 10, 12)).eq("isDelete", 1)); |
| | | for (OrderPrivateCar privateCar : privateCars) { |
| | | Integer state = privateCar.getState(); |
| | | String tripId = privateCar.getTripId(); |
| | | String trip = fleetEngineUtil.getTrip(tripId); |
| | | if(null != trip && "" == trip){ |
| | | privateCar.setIsover(1); |
| | | orderPrivateCarService.updateById(privateCar); |
| | | continue; |
| | | } |
| | | if(ToolUtil.isNotEmpty(trip)){ |
| | | JSONObject jsonObject = JSON.parseObject(trip); |
| | | String tripStatus = jsonObject.getString("tripStatus"); |
| | | Car car = carService.selectById(privateCar.getCarId()); |
| | | if(Arrays.asList(10, 12).contains(state) && !"CANCELED".equals(tripStatus)){ |
| | | //修改行程信息 |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, privateCar.getId(), 1); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, privateCar.getId(), 1); |
| | | if(updateTrip){ |
| | | privateCar.setIsover(1); |
| | | orderPrivateCarService.updateById(privateCar); |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }else{ |
| | | privateCar.setIsover(1); |
| | | orderPrivateCarService.updateById(privateCar); |
| | | } |
| | | } |
| | | if(Arrays.asList(6, 7, 8, 9).contains(state) && !"COMPLETE".equals(tripStatus)){ |
| | | //修改行程信息 |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, privateCar.getId(), 1); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, privateCar.getId(), 1); |
| | | if(updateTrip){ |
| | | privateCar.setIsover(1); |
| | | orderPrivateCarService.updateById(privateCar); |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }else{ |
| | | privateCar.setIsover(1); |
| | | orderPrivateCarService.updateById(privateCar); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | List<OrderLogistics> orderLogisticsList = orderLogisticsService.selectList(new EntityWrapper<OrderLogistics>().isNotNull("tripId") |
| | | .eq("isover", 0).in("state", Arrays.asList(6, 7, 8, 9, 10, 12)).eq("isDelete", 1)); |
| | | for (OrderLogistics orderLogistics : orderLogisticsList) { |
| | | Integer state = orderLogistics.getState(); |
| | | String tripId = orderLogistics.getTripId(); |
| | | String trip = fleetEngineUtil.getTrip(tripId); |
| | | if(null != trip && "" == trip){ |
| | | orderLogistics.setIsover(1); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | continue; |
| | | } |
| | | if(ToolUtil.isNotEmpty(trip)){ |
| | | JSONObject jsonObject = JSON.parseObject(trip); |
| | | String tripStatus = jsonObject.getString("tripStatus"); |
| | | Car car = carService.selectById(orderLogistics.getCarId()); |
| | | if(Arrays.asList(10, 12).contains(state) && !"CANCELED".equals(tripStatus)){ |
| | | //修改行程信息 |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, orderLogistics.getId(), 4); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, orderLogistics.getId(), 4); |
| | | if(updateTrip){ |
| | | orderLogistics.setIsover(1); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }else{ |
| | | orderLogistics.setIsover(1); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | } |
| | | } |
| | | if(Arrays.asList(6, 7, 8, 9).contains(state) && !"COMPLETE".equals(tripStatus)){ |
| | | //修改行程信息 |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, orderLogistics.getId(), 4); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, orderLogistics.getId(), 4); |
| | | if(updateTrip){ |
| | | orderLogistics.setIsover(1); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }else{ |
| | | orderLogistics.setIsover(1); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |