| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private IAppOperationLogService appOperationLogService; |
| | | |
| | | |
| | | /** |
| | |
| | | orderPrivateCar.setState(11); |
| | | orderPrivateCar.setReassignNotice(2); |
| | | orderPrivateCarService.updateById(orderPrivateCar); |
| | | appOperationLogService.addAppOperationLog(uid, "{\"type\":\"司机申请改派\",\"orderId\":\"" + orderPrivateCar.getId() + "\",\"driver\":\"" + JSON.toJSONString(orderPrivateCar) + "\"}"); |
| | | |
| | | //添加已收入明细 |
| | | incomeService.saveData(1, orderPrivateCar.getCompanyId(), 4, orderPrivateCar.getId(), 1, reassign.getMoney()); |
| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | |
| | | |
| | | @Autowired |
| | | private ITOrderLogisticsService orderLogisticsService; |
| | | |
| | | @Autowired |
| | | private IAppOperationLogService appOperationLogService; |
| | | |
| | | |
| | | |
| | |
| | | TOrderPrivateCar tOrderPrivateCar = itOrderPrivateCarService.selectById(tReassign.getOrderId()); |
| | | tOrderPrivateCar.setState(tOrderPrivateCar.getOldState()); |
| | | itOrderPrivateCarService.updateById(tOrderPrivateCar); |
| | | appOperationLogService.addAppOperationLog(ShiroKit.getUser().getId(), "{\"type\":\"调度拒绝改派\",\"orderId\":\"" + tOrderPrivateCar.getId() + "\",\"driver\":\"" + JSON.toJSONString(tOrderPrivateCar) + "\"}"); |
| | | }else if (2 == optType){ |
| | | tReassign.setState(4); |
| | | tReassignService.updateById(tReassign); |
| | |
| | | TOrderPrivateCar tOrderPrivateCar = itOrderPrivateCarService.selectById(tReassign.getOrderId()); |
| | | tOrderPrivateCar.setState(10); |
| | | itOrderPrivateCarService.updateById(tOrderPrivateCar); |
| | | appOperationLogService.addAppOperationLog(ShiroKit.getUser().getId(), "{\"type\":\"调度取消订单\",\"orderId\":\"" + tOrderPrivateCar.getId() + "\",\"driver\":\"" + JSON.toJSONString(tOrderPrivateCar) + "\"}"); |
| | | |
| | | //修改司机状态"空闲" |
| | | TDriver driver = itDriverService.selectById(tReassign.getOriginalDriverId()); |
| | |
| | | @RequestMapping(value = "/selectDriver") |
| | | @ResponseBody |
| | | public Object selectDriver(@RequestParam Integer orderId,@RequestParam Integer driverId) { |
| | | int count = itOrderPrivateCarService.selectCount(new EntityWrapper<TOrderPrivateCar>().eq("driverId", driverId) |
| | | .in("state", Arrays.asList(2, 3, 4, 5, 6, 11)).eq("isDelete", 1)); |
| | | if(count > 0){ |
| | | throw new RuntimeException("司机正在服务中,请选择其他司机"); |
| | | } |
| | | //修改订单 |
| | | TReassign tReassign = tReassignService.selectById(orderId); |
| | | TOrderPrivateCar tOrderPrivateCar = itOrderPrivateCarService.selectById(tReassign.getOrderId()); |
| | |
| | | tOrderPrivateCar.setDriverId(driverId); |
| | | tOrderPrivateCar.setCarId(nowDriver.getCarId()); |
| | | itOrderPrivateCarService.updateById(tOrderPrivateCar); |
| | | appOperationLogService.addAppOperationLog(ShiroKit.getUser().getId(), "{\"type\":\"调度完成订单改派\",\"orderId\":\"" + tOrderPrivateCar.getId() + "\",\"driver\":\"" + JSON.toJSONString(tOrderPrivateCar) + "\"}"); |
| | | |
| | | //修改专车改派订单 |
| | | tReassign.setNowDriverId(driverId); |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.modular.system.model.TOrderPrivateCar; |
| | | import com.stylefeng.guns.modular.system.model.TReassign; |
| | | import com.stylefeng.guns.modular.system.dao.TReassignMapper; |
| | | import com.stylefeng.guns.modular.system.service.ITOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.service.ITReassignService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TReassignServiceImpl extends ServiceImpl<TReassignMapper, TReassign> implements ITReassignService { |
| | | |
| | | @Autowired |
| | | private ITOrderPrivateCarService itOrderPrivateCarService; |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getPrivateCarReassignOrderList(Page<Map<String, Object>> page, Integer roleType, Integer nowUserId, String beginTime, String endTime, String originalDriverName, String originalDriverPhone, String orderNum, String nowDriverName, String nowDriverPhone, Integer orderState, Integer state) { |
| | | return this.baseMapper.getPrivateCarReassignOrderList(page, roleType, nowUserId, beginTime, endTime, originalDriverName, originalDriverPhone, orderNum, nowDriverName, nowDriverPhone, orderState, state); |
| | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getCanSelectPrivateCarDriverList(Page<Map<String, Object>> page, Integer companyId, String name, String phone) { |
| | | return this.baseMapper.getCanSelectPrivateCarDriverList(page, companyId, name, phone); |
| | | List<Map<String, Object>> driverList = this.baseMapper.getCanSelectPrivateCarDriverList(page, companyId, name, phone); |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (Map<String, Object> map : driverList) { |
| | | String driverId = map.get("id").toString(); |
| | | int count = itOrderPrivateCarService.selectCount(new EntityWrapper<TOrderPrivateCar>().eq("driverId", driverId) |
| | | .in("state", Arrays.asList(2, 3, 4, 5, 6, 11)).eq("isDelete", 1)); |
| | | if(0 == count){ |
| | | list.add(map); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | |
| | | // 判断司机是否有订单进行中 |
| | | long count = orderPrivateCarMapper.selectCount(new EntityWrapper<OrderPrivateCar>().eq("driverId", driver1.getId()) |
| | | .in("state", Arrays.asList(2, 3, 4, 5, 6, 11)).eq("isDelete", 1)); |
| | | if(0 != count){ |
| | | if(count > 0){ |
| | | continue; |
| | | } |
| | | // 判断该司机是否有30分钟内预约单 |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(!ds.isEmpty()){ |
| | | ds.sort(new Comparator<Driver>() { |
| | | @Override |