| | |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.dao.RegionMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.model.vo.CompanyVo; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.ALiSendSms; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.WeChatUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.SMSUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.InputStream; |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static org.bouncycastle.cms.RecipientId.password; |
| | | |
| | | /** |
| | | * 司机控制器 |
| | |
| | | @RequestMapping("") |
| | | public class DriverController { |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | |
| | | private ICarService carService; |
| | | |
| | | @Autowired |
| | | private ALiSendSms aLiSendSms; |
| | | private RegionMapper regionMapper; |
| | | |
| | | @Autowired |
| | | private IOrderTaxiService orderTaxiService; |
| | |
| | | |
| | | @Autowired |
| | | private GunsProperties gunsProperties; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private ICompanyService companyService; |
| | | |
| | | @Autowired |
| | | private ICompanyCityService companyCityService; |
| | | |
| | | /** |
| | | * 获取短信验证码 |
| | |
| | | break; |
| | | } |
| | | // String s = aLiSendSms.sendSms(driver.getPhone(), templateCode, "{}"); |
| | | SMSUtil.sendVerifyCode(driver.getPhone()); |
| | | // SMSUtil.sendVerifyCode(driver.getPhone()); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryMyCar") |
| | | @ApiOperation(value = "获取当前车辆及空闲车辆", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "获取当前车辆及空闲车辆 新增useState 1使用中 2空闲", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | |
| | | |
| | | |
| | | /** |
| | | * 获取省市区3级联动 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/base/driver/getRegion") |
| | | @ApiOperation(value = "获取省市区3级联动", tags = {"司机端-注册"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil<List<Region>> getRegion(){ |
| | | try { |
| | | List<Region> regions = regionMapper.selectList(null); |
| | | List<Region> regionList = regions.stream().filter(e -> e.getParentId() == 0).collect(Collectors.toList()); |
| | | for (Region region : regionList) { |
| | | region.setTire(1); |
| | | List<Region> regionList1 = regions.stream().filter(e -> e.getParentId().equals(region.getId())).collect(Collectors.toList()); |
| | | for (Region region1 : regionList1) { |
| | | region1.setTire(2); |
| | | List<Region> regionList2 = regions.stream().filter(e -> e.getParentId().equals(region1.getId())).collect(Collectors.toList()); |
| | | region1.setChildren(regionList2); |
| | | } |
| | | region.setChildren(regionList1); |
| | | } |
| | | return ResultUtil.success(regionList); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/base/driver/getCompany") |
| | | @ApiOperation(value = "通过区code获取服务商", tags = {"司机端-注册"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "区code", name = "areaCode", required = true, dataType = "String"), |
| | | |
| | | }) |
| | | public ResultUtil<List<CompanyVo>> getCompany(String areaCode){ |
| | | try { |
| | | |
| | | ArrayList<CompanyVo> companyVos = new ArrayList<>(); |
| | | List<CompanyCity> companyCities = companyCityService.selectList(new EntityWrapper<CompanyCity>().eq("areaCode", areaCode).eq("state", 1)); |
| | | if(companyCities.isEmpty()){ |
| | | return ResultUtil.success(companyVos); |
| | | } |
| | | List<Company> companies = companyService.selectList(new EntityWrapper<Company>().eq("type", 2).ne("flag", 3).in("id", companyCities.stream().map(CompanyCity::getCompanyId).collect(Collectors.toList()))); |
| | | for (Company company : companies) { |
| | | CompanyVo companyVo = new CompanyVo(company.getId(), company.getName()); |
| | | companyVos.add(companyVo); |
| | | } |
| | | return ResultUtil.success(companyVos); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置提现密码 |
| | | * @param withdrawPassword |
| | | * @param request |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | // @ResponseBody |
| | | // @RequestMapping(value = "/base/driver/uploadImg", method = RequestMethod.POST) |
| | | // @ApiOperation(value = "上传图片", tags = {"司机端-注册"}, notes = "") |
| | | // public ResultUtil uploadImg(MultipartFile file) { |
| | | // try { |
| | | // String bucketName = "grjy_test"; |
| | | // Bucket grjyTest = NCOSSUtil.getBucketInfo(bucketName); |
| | | // if (null == grjyTest) { |
| | | // //创建桶 |
| | | // Boolean bucket = NCOSSUtil.createBucket(bucketName); |
| | | // if (!bucket) { |
| | | // return ResultUtil.error("创建存储桶失败"); |
| | | // } |
| | | // //设置桶策略 |
| | | // String policyText = "{\"Version\":\"2025-06-23\",\"Statement\":[{\"Sid\":\"Stmt20250623\",\"Action\":[\"GetObject\"]" + |
| | | // ",\"Effect\":\"Allow\",\"Resource\":[\"" + bucketName + "\"/*],\"Principal\":{*}}]}"; |
| | | // Boolean bucketPolicy = NCOSSUtil.setBucketPolicy(bucketName, policyText); |
| | | // if (!bucketPolicy) { |
| | | // return ResultUtil.error("设置桶策略失败"); |
| | | // } |
| | | // } |
| | | // //上传对象 |
| | | // String key = "image/driver/" + UUID.randomUUID().toString() + ".png"; |
| | | // String object = NCOSSUtil.putObject(bucketName, key, file.getInputStream()); |
| | | // if (null == object) { |
| | | // return ResultUtil.error("上传图片失败"); |
| | | // } |
| | | // |
| | | // return ResultUtil.success("http://" + QianYunTongProperties.endPoint + "/" + key); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // return ResultUtil.runErr(); |
| | | // } |
| | | // } |
| | | } |