| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.config.properties.GunsProperties; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | 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 io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | public class DriverController { |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | @Autowired |
| | | private GunsProperties gunsProperties; |
| | | |
| | | |
| | | /** |
| | | * 获取短信验证码 |
| | | * |
| | | * @param phone |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 验证短信验证码 |
| | | * |
| | | * @param phone |
| | | * @param code |
| | | * @return |
| | |
| | | |
| | | /** |
| | | * 司机注册审核后的短信 |
| | | * |
| | | * @param uid |
| | | * @param type |
| | | * @return |
| | |
| | | templateCode = "SMS_229613326";//司机注册失败 |
| | | break; |
| | | } |
| | | String s = aLiSendSms.sendSms(driver.getPhone(), templateCode, "{}"); |
| | | // String s = aLiSendSms.sendSms(driver.getPhone(), templateCode, "{}"); |
| | | SMSUtil.sendVerifyCode(driver.getPhone()); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | |
| | | @Autowired |
| | | private WeChatUtil weChatUtil; |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/getDriverCode") |
| | | @ApiOperation(value = "获取司机端的二维码", tags = {"司机端-个人中心"}, notes = "") |
| | |
| | | //HttpURLConnection httpURLConnection = weChatUtil.getwxacodeunlimit(appletPath, "d=" + driverId + "&k=" + 0, "release",driverId); |
| | | InputStream inputStream = weChatUtil.getwxacodeunlimit(appletPath, "driverId=" + driverId , "release"); |
| | | if(inputStream!=null){ |
| | | fileName = OssUploadUtil.ossUploadByStream(driverId,inputStream); |
| | | System.out.println(fileName); |
| | | driver.setQrCode(fileName); |
| | | // 上传文件目录 |
| | | fileName = UUID.randomUUID().toString() + ".png"; |
| | | String fileSavePath = gunsProperties.getFileUploadPath() + "img\\"; |
| | | FileUtil.writeFromStream(inputStream, fileName); |
| | | String pictureName = gunsProperties.getPictureServerAddress() + "img/" + fileName; |
| | | // fileName = OssUploadUtil.ossUploadByStream(driverId, inputStream); |
| | | System.out.println(pictureName); |
| | | driver.setQrCode(pictureName); |
| | | driverService.updateById(driver); |
| | | } |
| | | } |
| | |
| | | driver.setAuthState(3); |
| | | driverService.updateById(driver); |
| | | //开始验证当前账号是否在别处登录 |
| | | String value = redisUtil.getValue("DRIVER_" + driverId); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER_" + driverId); |
| | | if (ToolUtil.isNotEmpty(value)) {//将另外设备上的强迫下线 |
| | | //开始清除redis中无效的数据 |
| | | String key = redisUtil.getValue("DRIVER_" + driver.getPhone()); |
| | | redisUtil.remove(key);//删除个人信息数据 |
| | | redisUtil.remove("DRIVER_" + driver.getPhone());//删除后台冻结相关缓存 |
| | | redisUtil.remove("DRIVER_" + driverId);//清除存储的token |
| | | String key = (String) redisTemplate.opsForValue().get("DRIVER_" + driver.getPhone()); |
| | | redisTemplate.delete(key);//删除个人信息数据 |
| | | redisTemplate.delete("DRIVER_" + driver.getPhone());//删除后台冻结相关缓存 |
| | | redisTemplate.delete("DRIVER_" + driverId);//清除存储的token |
| | | } |
| | | return ResultUtil.success(); |
| | | } catch (Exception e) { |