| | |
| | | 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.qianyuntong.OrderUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.ModifyTravelItineraryRequest; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import com.stylefeng.guns.modular.taxi.service.impl.OrderTaxiServiceImpl; |
| | | import org.apache.commons.lang.time.DateFormatUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | reassign.setPayTime(new Date()); |
| | | reassignMapper.updateById(reassign); |
| | | |
| | | Double balance = driver.getBalance(); |
| | | Double laveBusinessMoney = driver.getLaveBusinessMoney(); |
| | | Double laveActivityMoney = driver.getLaveActivityMoney(); |
| | | if(null == balance || balance < aDouble){ |
| | | throw new SystemException("账户余额不足"); |
| | | } |
| | | if(null != laveBusinessMoney && laveBusinessMoney.compareTo(aDouble) >= 0){ |
| | | driver.setLaveBusinessMoney(new BigDecimal(laveBusinessMoney).subtract(new BigDecimal(aDouble)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | }else if(null != laveActivityMoney && laveActivityMoney.compareTo(aDouble) >= 0){ |
| | | driver.setLaveActivityMoney(new BigDecimal(laveActivityMoney).subtract(new BigDecimal(aDouble)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | } |
| | | driver.setBalance(new BigDecimal(balance).subtract(new BigDecimal(aDouble)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | // Double balance = driver.getBalance(); |
| | | // Double laveBusinessMoney = driver.getLaveBusinessMoney(); |
| | | // Double laveActivityMoney = driver.getLaveActivityMoney(); |
| | | // if(null == balance || balance < aDouble){ |
| | | // throw new SystemException("账户余额不足"); |
| | | // } |
| | | // if(null != laveBusinessMoney && laveBusinessMoney.compareTo(aDouble) >= 0){ |
| | | // driver.setLaveBusinessMoney(new BigDecimal(laveBusinessMoney).subtract(new BigDecimal(aDouble)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // }else if(null != laveActivityMoney && laveActivityMoney.compareTo(aDouble) >= 0){ |
| | | // driver.setLaveActivityMoney(new BigDecimal(laveActivityMoney).subtract(new BigDecimal(aDouble)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // } |
| | | // driver.setBalance(new BigDecimal(balance).subtract(new BigDecimal(aDouble)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // driverService.updateById(driver); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "司机改派支付", aDouble, 2, 1, 2, reassign.getOrderType(), reassign.getOrderId()); |
| | | // transactionDetailsService.saveData(uid, "司机改派支付", aDouble, 2, 1, 2, reassign.getOrderType(), reassign.getOrderId()); |
| | | |
| | | |
| | | //修改改派通知状态 |
| | |
| | | orderPrivateCar.setState(11); |
| | | orderPrivateCar.setReassignNotice(2); |
| | | orderPrivateCarService.updateById(orderPrivateCar); |
| | | |
| | | Company company = companyService.selectById(driver.getCompanyId()); |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(orderPrivateCar.getTravelId()); |
| | | request.setStatus(orderPrivateCar.getState()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | if(2 == orderPrivateCar.getPromotion()){ |
| | | Driver driver1 = driverService.selectById(orderPrivateCar.getPromotionDriverId()); |
| | | request.setPromoterId(driver1.getEmpId().toString()); |
| | | } |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | |
| | | |
| | | //添加已收入明细 |
| | | incomeService.saveData(1, orderPrivateCar.getCompanyId(), 4, orderPrivateCar.getId(), 1, reassign.getMoney()); |
| | | // incomeService.saveData(1, orderPrivateCar.getCompanyId(), 4, orderPrivateCar.getId(), 1, reassign.getMoney()); |
| | | // qyt 改派直接推送 |
| | | pushOrderPrivate(orderPrivateCar,uid); |
| | | break; |
| | |
| | | orderTaxi.setState(11); |
| | | orderTaxi.setReassignNotice(2); |
| | | orderTaxiService.updateById(orderTaxi); |
| | | |
| | | |
| | | Company company1 = companyService.selectById(driver.getCompanyId()); |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); |
| | | request1.setOrderId(orderTaxi.getTravelId()); |
| | | request1.setStatus(orderTaxi.getState()); |
| | | request1.setDriverId(driver.getEmpId().toString()); |
| | | if(2 == orderTaxi.getPromotion()){ |
| | | Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request1.setPromoterId(driver1.getEmpId().toString()); |
| | | } |
| | | request1.setSupplierShopId(company1.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request1); |
| | | |
| | | //添加已收入明细 |
| | | incomeService.saveData(1, orderTaxi.getCompanyId(), 4, orderTaxi.getId(), 2, reassign.getMoney()); |
| | | // incomeService.saveData(1, orderTaxi.getCompanyId(), 4, orderTaxi.getId(), 2, reassign.getMoney()); |
| | | |
| | | // qyt 改派直接推送 |
| | | pushOrderTaxi(orderTaxi,uid); |
| | |
| | | |
| | | @Autowired |
| | | private IPushOrderService pushOrderService; |
| | | |
| | | @Autowired |
| | | private IOpenCityService openCityService; |
| | | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | |
| | | if (ToolUtil.isNotEmpty(vehicle)) { |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | | } |
| | | Company query = companyCityService.query(String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat()));//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 2, query.getId());//获取需要推送的次数 |
| | | OpenCity openCity = openCityService.openCity1(orderTaxi.getStartLon().toString(), orderTaxi.getStartLat().toString()); |
| | | List<PushOrder> querys = pushOrderService.querys(null, 2, openCity.getId());//获取需要推送的次数 |
| | | for (int i = 1; i <=6; i++) { |
| | | PushOrder pushOrder = pushOrderService.querys(i, 2, query.getId()).get(0); |
| | | int finalI = i; |
| | | PushOrder pushOrder = querys.stream().filter(s -> s.getType() == (finalI <= 3 ? finalI : 3)).findFirst().orElse(null); |
| | | System.out.println("pushOrder:" + pushOrder); |
| | | //获取空闲司机 |
| | | List<Driver> list = driverService.queryIdleDriver(2, orderTaxi.getStartLon(), orderTaxi.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | |
| | | if (state != 1) { |
| | | break; |
| | | } |
| | | if (i == querys.size() && state == 1) { |
| | | if (i == 6 && state == 1) { |
| | | pushUtil.pushEndPush(1, orderTaxi.getUserId(), orderTaxi.getId(), 2); |
| | | orderTaxi1.setState(10); |
| | | orderTaxiService.updateById(orderTaxi1); |
| | |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | | } |
| | | Company query = companyCityService.query(String.valueOf(orderPrivateCar.getStartLon()), String.valueOf(orderPrivateCar.getStartLat()));//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 1, query.getId());//获取需要推送的次数 |
| | | OpenCity openCity = openCityService.openCity1(orderPrivateCar.getStartLon().toString(), orderPrivateCar.getStartLat().toString()); |
| | | List<PushOrder> querys = pushOrderService.querys(null, 1, openCity.getId());//获取需要推送的次数 |
| | | for(int i = 1; i <= 6; i++){ |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(id); |
| | | if (null == orderPrivateCar || orderPrivateCar.getState() > 1) { |
| | | break; |
| | | } |
| | | PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0); |
| | | int finalI = i; |
| | | PushOrder pushOrder = querys.stream().filter(s -> s.getType() == (finalI <= 3 ? finalI : 3)).findFirst().orElse(null); |
| | | System.out.println("pushOrder:"+pushOrder); |
| | | int i2 = pushOrder.getPushTime() / 10; |
| | | if(i2==0){ |
| | |
| | | orderIds.remove(orderPrivateCar.getId()); |
| | | return; |
| | | } |
| | | if (i == querys.size() && state == 1) { |
| | | if (i == 6 && state == 1) { |
| | | pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1); |
| | | orderPrivateCar.setState(10); |
| | | orderPrivateCarService.updateById(orderPrivateCar); |