| | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.account.service.ITEnterpriseWithdrawalService; |
| | | import com.stylefeng.guns.modular.account.service.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.account.unionpay.GetOpenBodySig; |
| | | import com.stylefeng.guns.modular.account.unionpay.QrCodeConfiguration; |
| | | import com.stylefeng.guns.modular.account.unionpay.Util; |
| | | import com.stylefeng.guns.modular.crossCity.dao.LineMapper; |
| | | import com.stylefeng.guns.modular.crossCity.dao.LineShiftDriverMapper; |
| | | import com.stylefeng.guns.modular.crossCity.dao.LineShiftMapper; |
| | | import com.stylefeng.guns.modular.crossCity.dao.LineSiteMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineShift; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineSite; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineShiftDriver; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | | @Autowired |
| | | private LineShiftDriverMapper lineShiftDriverMapper; |
| | | |
| | | |
| | | /** |
| | |
| | | for (String id : split) { |
| | | Reassign query = reassignMapper.query(uid, null, Integer.valueOf(id), 3, 1); |
| | | query.setState(2); |
| | | if (reassign.getNowDriverId() != null) { |
| | | query.setState(3); |
| | | } |
| | | query.setPayTime(new Date()); |
| | | reassignMapper.updateById(query); |
| | | //添加交易明细 |
| | |
| | | if(reassign.getNowDriverId()==null){ |
| | | orderCrossCity.setState(11); |
| | | }else { |
| | | orderCrossCity.setDriverId(reassign.getNowDriverId()); |
| | | // orderCrossCity.setDriverId(reassign.getNowDriverId()); |
| | | //reassign.getNowDriverId() 是lineShiftDriverId |
| | | driverReassignSelf(reassign, orderCrossCity); |
| | | } |
| | | |
| | | |
| | | orderCrossCity.setReassignNotice(2); |
| | | orderCrossCity.setIsReassign(2); |
| | | orderCrossCityService.updateById(orderCrossCity); |
| | |
| | | |
| | | |
| | | if(reassign.getNowDriverId()!=null){ |
| | | // 推送用户消息 |
| | | pushUtil.pushOrderReassign(orderCrossCity.getUserId(), 1, orderCrossCity.getId(), 3); |
| | | // 推送司机消息 |
| | | pushUtil.pushOrderReassign(orderCrossCity.getDriverId(), 2, orderCrossCity.getId(), 3); |
| | | try { |
| | | // 推送用户消息 |
| | | pushUtil.pushOrderReassign(orderCrossCity.getUserId(), 1, orderCrossCity.getId(), 3); |
| | | // 推送司机消息 |
| | | pushUtil.pushOrderReassign(orderCrossCity.getDriverId(), 2, orderCrossCity.getId(), 3); |
| | | } catch (Exception ignore) { |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | systemNoticeService.addSystemNotice(2, "您已使用余额成功支付改派申请费用!", uid, 1); |
| | | |
| | | |
| | | |
| | | //开始推送调度单 |
| | | // Map<String, String> map = new HashMap<>(); |
| | | // map.put("orderId", reassign.getOrderId().toString()); |
| | |
| | | // } |
| | | } |
| | | query.setState(2); |
| | | if (reassigns.get(0).getNowDriverId() != null) { |
| | | query.setState(3); |
| | | } |
| | | query.setCode(order_id); |
| | | paymentRecordService.updateById(query); |
| | | System.out.println("==============paymentRecord完毕===================" + query); |
| | |
| | | orderCrossCity1.setOldState(orderCrossCity1.getState()); |
| | | if(reassign.getNowDriverId()==null){ |
| | | orderCrossCity1.setState(11); |
| | | }else { |
| | | orderCrossCity1.setDriverId(reassign.getNowDriverId()); |
| | | } else { |
| | | // orderCrossCity1.setDriverId(reassign.getNowDriverId()); |
| | | //reassign.getNowDriverId() 是lineShiftDriverId |
| | | driverReassignSelf(reassign, orderCrossCity1); |
| | | } |
| | | orderCrossCity1.setReassignNotice(2); |
| | | orderCrossCity1.setIsReassign(2); |
| | |
| | | |
| | | } |
| | | |
| | | private void driverReassignSelf(Reassign reassign, OrderCrossCity orderCrossCity1) { |
| | | // 交换人数 交换座位 |
| | | Integer oldLineShiftDriverId = orderCrossCity1.getLineShiftDriverId(); |
| | | LineShiftDriver oldLineShiftDriver = lineShiftDriverMapper.selectById(oldLineShiftDriverId); |
| | | LineShiftDriver lineShiftDriver = lineShiftDriverMapper.selectById(reassign.getNowDriverId()); |
| | | orderCrossCity1.setDriverId(lineShiftDriver.getDriverId()); |
| | | orderCrossCity1.setLineShiftDriverId(reassign.getNowDriverId()); |
| | | Driver driver1 = driverService.selectById(lineShiftDriver.getDriverId()); |
| | | orderCrossCity1.setCarId(driver1.getCarId()); |
| | | Integer peopleNumber = orderCrossCity1.getPeopleNumber(); |
| | | oldLineShiftDriver.setLaveSeat(oldLineShiftDriver.getLaveSeat() + peopleNumber); |
| | | lineShiftDriver.setLaveSeat(lineShiftDriver.getLaveSeat() - peopleNumber); |
| | | String laveSeatNumber = Arrays.stream(lineShiftDriver.getLaveSeatNumber().split(",")).skip(peopleNumber).collect(Collectors.joining(",")); |
| | | Set<String> oldLaveSeatSet = Arrays.stream(oldLineShiftDriver.getLaveSeatNumber().split(",")).collect(Collectors.toSet()); |
| | | for (int i = 1; i <= 6; i++) { |
| | | oldLaveSeatSet.add(String.valueOf(i)); |
| | | if (oldLaveSeatSet.size() == oldLineShiftDriver.getLaveSeat()) { |
| | | break; |
| | | } |
| | | } |
| | | String oldLaveSeatNumber = oldLaveSeatSet.stream().sorted().collect(Collectors.joining(",")); |
| | | oldLineShiftDriver.setLaveSeatNumber(oldLaveSeatNumber); |
| | | lineShiftDriver.setLaveSeatNumber(laveSeatNumber); |
| | | lineShiftDriverMapper.updateById(oldLineShiftDriver); |
| | | lineShiftDriverMapper.updateById(lineShiftDriver); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> queryDriver(String orderId) throws Exception { |
| | | OrderCrossCity orderCrossCity = orderCrossCityService.selectById(orderId); |