| | |
| | | import java.net.InetAddress; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 司机 |
| | |
| | | driver.setCityCode(branchOffice.getCityCode()); |
| | | driver.setAreaCode(branchOffice.getDistrictCode()); |
| | | driver.setAreaName(branchOffice.getDistrictName()); |
| | | driver.setInviterType(driverRegisterWarpper.getInviterType()); |
| | | driver.setInviterId(driverRegisterWarpper.getInviterId()); |
| | | if(null != driverRegisterWarpper.getInviterId()){ |
| | | driver.setInviterType(driverRegisterWarpper.getInviterType()); |
| | | driver.setInviterId(driverRegisterWarpper.getInviterId()); |
| | | } |
| | | driver.setApprovalStatus(1); |
| | | driver.setApprovalNotes(""); |
| | | driver.setApprovalTime(null); |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil<TokenWarpper> driverLogin(String receiver, String phone, String code) throws Exception { |
| | | if(ToolUtil.isEmpty(receiver)){ |
| | | receiver = "+86"; |
| | | } |
| | | String value = redisUtil.getValue(receiver + phone); |
| | | if(!"12345".equals(code) && ToolUtil.isEmpty(value)){ |
| | | return ResultUtil.error("短信验证码无效"); |
| | |
| | | // 构造query对象 |
| | | Query query = Query.query(Criteria.where("location").withinSphere(circle)); |
| | | List<Location> locations = mongoTemplate.find(query, Location.class); |
| | | locations.forEach(s -> { |
| | | String value1 = redisUtil.getValue("DRIVER" + s.getDriverId()); |
| | | if(s.getDriverId().compareTo(uid) != 0 && ToolUtil.isNotEmpty(value1)){ |
| | | list.add(s.getLocation().getX() + "," + s.getLocation().getY()); |
| | | List<Integer> collect = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); |
| | | List<Driver> drivers = this.selectBatchIds(collect); |
| | | for (Driver driver : drivers) { |
| | | String value1 = redisUtil.getValue("DRIVER" + driver.getId()); |
| | | if(ToolUtil.isEmpty(value1)){ |
| | | continue; |
| | | } |
| | | }); |
| | | if(driver.getId().compareTo(uid) == 0){ |
| | | continue; |
| | | } |
| | | list.add(value1 + "," + driver.getServerStatus()); |
| | | } |
| | | } |
| | | return ResultUtil.success(list); |
| | | } |