| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.internal.util.file.IOUtils; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.config.properties.GunsProperties; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | |
| | | @ApiOperation(value = "通过区code获取服务商", tags = {"司机端-注册"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "区code", name = "areaCode", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "name", name = "name", required = false, dataType = "String"), |
| | | |
| | | }) |
| | | public ResultUtil<List<CompanyVo>> getCompany(String areaCode){ |
| | | public ResultUtil<List<CompanyVo>> getCompany(String areaCode,String name){ |
| | | try { |
| | | |
| | | ArrayList<CompanyVo> companyVos = new ArrayList<>(); |
| | |
| | | if(companyCities.isEmpty()){ |
| | | return ResultUtil.success(companyVos); |
| | | } |
| | | List<Company> companies = companyService.selectList(new EntityWrapper<Company>().ne("type", 1).ne("flag", 3).in("id", companyCities.stream().map(CompanyCity::getCompanyId).collect(Collectors.toList()))); |
| | | Wrapper<Company> in = new EntityWrapper<Company>().ne("type", 1).ne("flag", 3).in("id", companyCities.stream().map(CompanyCity::getCompanyId).collect(Collectors.toList())); |
| | | |
| | | if(ToolUtil.isNotEmpty( name)){ |
| | | in.like("name", name); |
| | | } |
| | | List<Company> companies = companyService.selectList(in); |
| | | for (Company company : companies) { |
| | | CompanyVo companyVo = new CompanyVo(company.getId(), company.getName()); |
| | | companyVos.add(companyVo); |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.crossCity.warpper.OrderCrossCityInfoWrapper; |
| | | import com.stylefeng.guns.modular.crossCity.warpper.OrderWarpper; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.system.dao.DriverWorkMapper; |
| | | import com.stylefeng.guns.modular.system.model.DriverWork; |
| | | import com.stylefeng.guns.modular.system.model.Reassign; |
| | | import com.stylefeng.guns.modular.system.model.SysTimeoutMoney; |
| | | import com.stylefeng.guns.modular.system.model.TimeOutAppeal; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.ChinaMobileUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushUtil; |
| | |
| | | |
| | | @Resource |
| | | private DriverWorkMapper driverWorkMapper; |
| | | |
| | | @Autowired |
| | | private ICarService carService; |
| | | |
| | | |
| | | |
| | |
| | | if(null == driverWork1){ |
| | | return ResultUtil.error("您已下班,无法接单"); |
| | | } |
| | | |
| | | Driver driver = driverService.selectById(uid); |
| | | |
| | | //判断车辆是否正在使用中 |
| | | Car car = carService.selectById(driver.getCarId()); |
| | | if(car.getUseDriverId() != null && !car.getUseDriverId().equals(uid)){ |
| | | return ResultUtil.error("当前绑定车辆正在使用中,请更换车辆"); |
| | | }else if(car.getUseDriverId()==null){ |
| | | car.setUseDriverId(uid); |
| | | carService.updateById(car); |
| | | } |
| | | |
| | | return orderService.grabOrder(orderId, orderType, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | |
| | | List<Map<String, Object>> queryIdleDataFromId(@Param("id") Integer id); |
| | | |
| | | void updateUseState(@Param("uid") Integer uid); |
| | | |
| | | |
| | | } |
| | |
| | | <result column="addType" property="addType"/> |
| | | <result column="addObjectId" property="addObjectId"/> |
| | | </resultMap> |
| | | |
| | | <update id="updateUseState"> |
| | | update t_car set useDriverId = null where useDriverId = #{uid} |
| | | </update> |
| | | |
| | | |
| | | <select id="queryIdleData" resultType="map"> |
| | |
| | | <select id="queryIdleDataFromId" resultType="java.util.Map"> |
| | | select |
| | | a.id as id, |
| | | CONCAT(a.carLicensePlate, '-',c.`name`, b.`name`, ' ', a.carColor) as name |
| | | CONCAT(a.carLicensePlate, '-',c.`name`, b.`name`, ' ', a.carColor) as name, |
| | | a.useDriverId as useDriverId |
| | | from t_car a |
| | | left join t_car_model b on (a.carModelId = b.id) |
| | | left join t_car_brand c on (b.brandId = c.id) |
| | |
| | | @TableField("addObjectId") |
| | | private Integer addObjectId; |
| | | |
| | | |
| | | /** |
| | | * 使用司机id |
| | | */ |
| | | @TableField("useDriverId") |
| | | private Integer useDriverId; |
| | | |
| | | public Integer getUseDriverId() { |
| | | return useDriverId; |
| | | } |
| | | |
| | | public void setUseDriverId(Integer useDriverId) { |
| | | this.useDriverId = useDriverId; |
| | | } |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.Car; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Date; |
| | |
| | | */ |
| | | ResultUtil addCar(Integer modelId, String color, String licensePlate, Date time, String drivingLicensePhoto, |
| | | String carPhoto, String insurancePhoto, Integer uid) throws Exception; |
| | | |
| | | boolean useState(@Param("carId") Integer carId, @Param("uid") Integer uid); |
| | | |
| | | void updateUseState(Integer carId, Integer uid); |
| | | void updateUseState(Integer uid); |
| | | |
| | | } |
| | |
| | | // driver.getCompanyId() != null && driver.getCompanyId() != 0 ? driver.getCompanyId() : 1)); |
| | | for (Map<String, Object> stringObjectMap : list) { |
| | | // 1使用中 2空闲中 |
| | | if(stringObjectMap.get("id").toString().equals(carId.toString())){ |
| | | if(stringObjectMap.get("useDriverId").toString().equals(uid.toString())){ |
| | | map.put("useState", 1); |
| | | }else { |
| | | map.put("useState", 0); |
| | |
| | | this.insert(car); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean useState(Integer carId, Integer uid) { |
| | | Car car = carMapper.selectById(carId); |
| | | if(car.getUseDriverId()!=null || !car.getUseDriverId().equals(uid)){ |
| | | return false; |
| | | } |
| | | return true; |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void updateUseState(Integer carId, Integer uid) { |
| | | carMapper.updateUseState(uid); |
| | | Car car = carMapper.selectById(carId); |
| | | car.setUseDriverId(uid); |
| | | this.baseMapper.updateById(car); |
| | | } |
| | | @Override |
| | | public void updateUseState(Integer uid) { |
| | | carMapper.updateUseState(uid); |
| | | } |
| | | } |
| | |
| | | driver.setCityCode(registeredWarpper.getCityCode()); |
| | | driver.setProvince(registeredWarpper.getProvince()); |
| | | driver.setProvinceCode(registeredWarpper.getProvinceCode()); |
| | | driver.setCompanyId(registeredWarpper.getCompanyId()); |
| | | |
| | | String code = registeredWarpper.getAreaCode(); |
| | | Company query = companyCityService.query(code); |
| | |
| | | driverWorkMapper.updateById(driverWork); |
| | | driver.setState(1); |
| | | |
| | | // 更新车辆使用状态 |
| | | carService.updateUseState(uid); |
| | | |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | |
| | | return ResultUtil.error("车辆正在使用中"); |
| | | } |
| | | } |
| | | |
| | | //判断车辆是否正在使用中 |
| | | Car car = carService.selectById(driver.getCarId()); |
| | | if(car.getUseDriverId() != null && !car.getUseDriverId().equals(uid)){ |
| | | return ResultUtil.error("当前绑定车辆正在使用中,请更换车辆"); |
| | | }else if(car.getUseDriverId()==null){ |
| | | car.setUseDriverId(uid); |
| | | carService.updateById(car); |
| | | } |
| | | |
| | | |
| | | |
| | | driverWork = new DriverWork(); |
| | | driverWork.setState(1); |
| | | driverWork.setDriverId(uid); |
| | |
| | | driverWorkMapper.updateById(driverWork); |
| | | driver.setState(1); |
| | | |
| | | // 更新车辆使用状态 |
| | | carService.updateUseState(uid); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | |
| | | } |
| | | }).start(); |
| | | }else{ |
| | | |
| | | //判断车辆是否正在使用中 |
| | | Car car = carService.selectById(driver.getCarId()); |
| | | if(car.getUseDriverId() != null && !car.getUseDriverId().equals(uid)){ |
| | | return ResultUtil.error("当前绑定车辆正在使用中,请更换车辆"); |
| | | }else if(car.getUseDriverId()==null){ |
| | | car.setUseDriverId(uid); |
| | | carService.updateById(car); |
| | | } |
| | | |
| | | |
| | | |
| | | driverWork = new DriverWork(); |
| | | driverWork.setState(1); |
| | | driverWork.setDriverId(uid); |
| | |
| | | if(driver.getState() == 3){ |
| | | return ResultUtil.error("还在服务中,不能更换"); |
| | | } |
| | | boolean idle = carService.idle(carId); |
| | | // boolean idle = carService.idle(carId); |
| | | // 修改是否别司机在使用 |
| | | boolean idle = carService.useState(carId,uid); |
| | | if(!idle){ |
| | | return ResultUtil.error("当前车辆已经有其他司机在使用,请更换车辆"); |
| | | } |
| | | // 将所有绑定他的车 =null |
| | | carService.updateUseState(carId,uid); |
| | | Car car = carService.selectById(carId); |
| | | car.setUseDriverId(uid); |
| | | carService.updateById( car); |
| | | driver.setCarId(carId); |
| | | this.updateById(driver); |
| | | return ResultUtil.success(); |
| | |
| | | @ApiModelProperty("区代码") |
| | | private String areaCode; |
| | | |
| | | @ApiModelProperty("公司id") |
| | | private Integer companyId; |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public String getProvince() { |
| | | return province; |
| | | } |
| | |
| | | mchId: 111 #微信支付分配的商户号 |
| | | key: 111 #key为商户平台设置的密钥key: |
| | | url: https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1} |
| | | |
| | | rongyun: |
| | | app_key: bmdehs6pbnozs |
| | | app_secret: RovVwtABN1 |
| | | --- |
| | | |
| | | alipay: |