| | |
| | | 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.service.ITransactionDetailsService; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.DistancematrixVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.ReverseGeocodeVo; |
| | | import com.stylefeng.guns.modular.system.warpper.OrderListWarpper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | |
| | | |
| | | |
| | |
| | | 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", "乘客创建"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | |
| | | } |
| | | 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", "调度创建"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("orderType"))) == 1 && Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | |
| | | // } |
| | | // } |
| | | break; |
| | | case 4://同城小件物流 |
| | | case 4://市内小件物流 |
| | | map = orderLogisticsService.queryPushOrder(orderId); |
| | | DistancematrixVo distancematrix1 = GoogleMapUtil.getDistancematrix(Double.valueOf(map.get("startLat").toString()), Double.valueOf(map.get("startLon").toString()), Double.valueOf(lat), Double.valueOf(lon)); |
| | | map.put("startDistance", null != distancematrix1 ? distancematrix1.getDistance() / 1000 : 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", "乘客创建"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | |
| | | } |
| | | if(orderSource3 == 5){ |
| | | if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 1){ |
| | | map.put("type", "调度下单"); |
| | | map.put("type", "调度创建"); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("isReassign"))) == 2){ |
| | | map.put("type", "改派"); |
| | |
| | | */ |
| | | @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"); |
| | | ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(lat, lon); |
| | | if(null == reverseGeocode){ |
| | | return ResultUtil.error("无效的经纬度"); |
| | | } |
| | | String address = reverseGeocode.getAddress(); |
| | | switch (orderType){ |
| | | case 1://专车 |
| | | return orderPrivateCarService.process(orderId, state, lon, lat, address,phone); |
| | |
| | | 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); |
| | |
| | | } |
| | | } |
| | | } |
| | | orderPrivateCarService.updateBatchById(orderList); |
| | | if(orderList.size() > 0){ |
| | | orderPrivateCarService.updateBatchById(orderList); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil payOrder(Integer uid, Integer orderId, Integer orderType, Integer payType, Integer language) throws Exception { |
| | | Double money = 0D; |
| | | if(orderType == 1){//专车 |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | money = orderPrivateCar.getPayMoney(); |
| | | if(orderPrivateCar.getPayType() != 4){ |
| | | return ResultUtil.error(language == 1 ? "无法进行支付" : language == 2 ? "Unable to pay" : "Impossibilité de procéder au paiement"); |
| | | } |
| | | if(orderPrivateCar.getDriverPay() == 2){ |
| | | return ResultUtil.error(language == 1 ? "不能重复支付" : language == 2 ? "Non-repeatable payment" : "Aucun paiement en double"); |
| | | } |
| | | if(payType == 2){//余额支付 |
| | | Driver driver = driverService.selectById(uid); |
| | | if(driver.getBalance().compareTo(money) < 0){ |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde insuffisant du compte"); |
| | | } |
| | | } |
| | | orderPrivateCar.setDriverPay(2); |
| | | orderPrivateCarService.updateById(orderPrivateCar); |
| | | } |
| | | if(orderType == 4){//小件 |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | money = orderLogistics.getPayMoney(); |
| | | if(orderLogistics.getPayType() != 4){ |
| | | return ResultUtil.error(language == 1 ? "无法进行支付" : language == 2 ? "Unable to pay" : "Impossibilité de procéder au paiement"); |
| | | } |
| | | if(orderLogistics.getDriverPay() == 2){ |
| | | return ResultUtil.error(language == 1 ? "不能重复支付" : language == 2 ? "Non-repeatable payment" : "Aucun paiement en double"); |
| | | } |
| | | if(payType == 2){//余额支付 |
| | | Driver driver = driverService.selectById(uid); |
| | | if(driver.getBalance().compareTo(money) < 0){ |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde insuffisant du compte"); |
| | | } |
| | | } |
| | | orderLogistics.setDriverPay(2); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | } |
| | | |
| | | if(0 < money){ |
| | | if(payType == 1){//线上支付 |
| | | |
| | | } |
| | | if(payType == 2){//余额支付 |
| | | Driver driver = driverService.selectById(uid); |
| | | driver.setBalance(driver.getBalance() - money); |
| | | if(driver.getLaveBusinessMoney().compareTo(money) < 0){ |
| | | double b = money - driver.getLaveBusinessMoney(); |
| | | driver.setLaveBusinessMoney(0D); |
| | | driver.setLaveActivityMoney(driver.getLaveActivityMoney() - b); |
| | | driverService.updateById(driver); |
| | | }else{ |
| | | driver.setLaveBusinessMoney(driver.getLaveBusinessMoney() - money); |
| | | driverService.updateById(driver); |
| | | } |
| | | } |
| | | |
| | | transactionDetailsService.saveData(uid, "现金收款代付", money, 2, 1, 2, orderType, orderId); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | } |
| | | |