| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | |
| | | 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.*; |
| | | 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.util.qianyuntong.QianYunTongConfig; |
| | | 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.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.geo.Point; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.geo.GeoJsonPoint; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.text.MessageFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @CrossOrigin |
| | | @RestController |
| | | @RequestMapping("") |
| | | @Slf4j |
| | | public class DriverController { |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | |
| | | @Autowired |
| | | private ICarService carService; |
| | | |
| | | @Autowired |
| | | private ALiSendSms aLiSendSms; |
| | | @Resource |
| | | private RegionMapper regionMapper; |
| | | |
| | | @Autowired |
| | | private IOrderTaxiService orderTaxiService; |
| | |
| | | |
| | | @Autowired |
| | | private GunsProperties gunsProperties; |
| | | |
| | | @Autowired |
| | | private ICompanyService companyService; |
| | | |
| | | @Autowired |
| | | private ICompanyCityService companyCityService; |
| | | |
| | | @Autowired |
| | | private TDriverPromotionActivityService driverPromotionActivityService; |
| | | |
| | | @Autowired |
| | | private QianYunTongConfig qianYunTongConfig; |
| | | |
| | | @Value("${wx.url}") |
| | | private String ACCESS_TOKEN_URL; |
| | | |
| | | @Value("${wx.appletsAppSecret}") |
| | | private String memberAppSecret; |
| | | |
| | | @Value("${wx.appletsAppid}") |
| | | private String wxAppId; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | /** |
| | | * 获取短信验证码 |
| | |
| | | break; |
| | | } |
| | | // String s = aLiSendSms.sendSms(driver.getPhone(), templateCode, "{}"); |
| | | SMSUtil.sendVerifyCode(driver.getPhone()); |
| | | // SMSUtil.sendVerifyCode(driver.getPhone()); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryHomeDataFromDriver") |
| | | @ApiOperation(value = "获取首页统计数据(黔云通)", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<DriverIndexVo> queryHomeDataFromDriver(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | DriverIndexVo vo = driverService.queryHomeDataFromDriver(uid); |
| | | return ResultUtil.success(vo); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryOrderDataFromDriver") |
| | | @ApiOperation(value = "获取订单统计数据(黔云通)", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "2022-02-02 - 2033-03-03", name = "time", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "pageNumber", name = "pageNumber", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "pageSize", name = "pageSize", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil<DriverOrderDataVo> queryOrderDataFromDriver(String time,Integer pageNumber,Integer pageSize,HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Page<DriverOrderDataNextVo> driverOrderDataVoPage = new Page<>(pageNumber, pageSize); |
| | | DriverOrderDataVo vo = driverService.queryOrderDataFromDriver(time,driverOrderDataVoPage,uid); |
| | | return ResultUtil.success(vo); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryOrderMoneyFromDriver") |
| | | @ApiOperation(value = "获取订单收入统计数据(黔云通)", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "2022-02-02 - 2033-03-03", name = "time", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "pageNumber", name = "pageNumber", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "pageSize", name = "pageSize", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil<DriverOrderMoneyDataVo> queryOrderMoneyFromDriver(String time, Integer pageNumber, Integer pageSize, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Page<DriverOrderDataNextVo> driverOrderDataVoPage = new Page<>(pageNumber, pageSize); |
| | | DriverOrderMoneyDataVo vo = driverService.queryOrderMoneyFromDriver(time,driverOrderDataVoPage,uid); |
| | | return ResultUtil.success(vo); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryOrderPromotionFromDriver") |
| | | @ApiOperation(value = "获取订单推广统计数据(黔云通)", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "2022-02-02 - 2033-03-03", name = "time", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "pageNumber", name = "pageNumber", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "pageSize", name = "pageSize", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil<DriverOrderPromotionDataVo> queryOrderPromotionFromDriver(String time, Integer pageNumber, Integer pageSize, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Page<DriverOrderDataNextVo> driverOrderDataVoPage = new Page<>(pageNumber, pageSize); |
| | | DriverOrderPromotionDataVo vo = driverService.queryOrderPromotionFromDriver(time,driverOrderDataVoPage,uid); |
| | | return ResultUtil.success(vo); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/getPromotionInfo") |
| | | @ApiOperation(value = "获取推广说明(黔云通)", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil<String> getPromotionInfo(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Driver driver = driverService.selectById(uid); |
| | | String areaCode = driver.getAreaCode(); |
| | | TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>() |
| | | .eq("districtCode", areaCode) |
| | | .eq("status", 2) |
| | | .last("LIMIT 1")); |
| | | if(tDriverPromotionActivity!=null){ |
| | | return ResultUtil.success(tDriverPromotionActivity.getActivityDesc()); |
| | | } |
| | | return ResultUtil.success(""); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "个人的小程序码(分享码)/链接", tags = {"司机端-首页"}, notes = "") |
| | | @GetMapping("/api/driver/personCode") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil<HashMap<String, Object>> personCode(HttpServletRequest request) { |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Driver driver = driverService.selectById(uid); |
| | | String accessToken=null; |
| | | Object img = redisTemplate.opsForValue().get("DRIVER_WX_IMG" + uid); |
| | | // 获取调用凭证accessToken |
| | | if(ToolUtil.isEmpty(driver.getShareLink())|| ToolUtil.isEmpty(img)){ |
| | | accessToken = getAccessToken(); |
| | | } |
| | | int index=0; |
| | | |
| | | if(ToolUtil.isEmpty(img)) { |
| | | RestTemplate rest = new RestTemplate(); |
| | | String url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=" + accessToken; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("path", "pages/home/home?driverId=" + uid); |
| | | param.put("width", 430); //二维码尺寸 |
| | | HttpRequest post = HttpUtil.createPost(url); |
| | | post.body(JSON.toJSONString(param)); |
| | | |
| | | byte[] result = post.execute().bodyBytes(); |
| | | // base64 |
| | | img = Base64.getEncoder().encodeToString(result); |
| | | redisTemplate.opsForValue().set("DRIVER_WX_IMG" + uid, img,30, TimeUnit.DAYS); |
| | | } |
| | | |
| | | String urlLink = driver.getShareLink(); |
| | | if(ToolUtil.isEmpty(urlLink)) { |
| | | index=1; |
| | | String url1 = "https://api.weixin.qq.com/wxa/generate_urllink?access_token=" + accessToken; |
| | | Map<String, Object> param1 = new HashMap<>(); |
| | | param1.put("path", "pages/home/home"); |
| | | param1.put("query", "driverId=" + uid); |
| | | |
| | | HttpRequest post = HttpUtil.createPost(url1); |
| | | // map转json |
| | | String jsonString = JSON.toJSONString(param1); |
| | | post.body(jsonString); |
| | | HttpResponse execute = post.execute(); |
| | | String body = execute.body(); |
| | | urlLink = JSONObject.parseObject(body).get("url_link").toString(); |
| | | driver.setShareLink(urlLink); |
| | | } |
| | | |
| | | if(index==1){ |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | HashMap<String, Object> stringStringHashMap = new HashMap<>(); |
| | | stringStringHashMap.put("url_link",urlLink); |
| | | stringStringHashMap.put("img",img); |
| | | return ResultUtil.success(stringStringHashMap); |
| | | |
| | | } catch (Exception e) { |
| | | log.error("调用小程序生成微信永久小程序码URL接口异常", e); |
| | | } |
| | | return ResultUtil.error("获取二维码失败"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public String getAccessToken() { |
| | | String requestUrl = MessageFormat.format(ACCESS_TOKEN_URL,wxAppId,memberAppSecret); |
| | | String respBody = restTemplate.getForEntity(requestUrl, String.class).getBody(); |
| | | JSONObject jsonObject = JSONObject.parseObject(respBody); |
| | | return jsonObject.getString("access_token"); |
| | | } |
| | | |
| | | |
| | |
| | | @PostMapping("/base/savePosition") |
| | | public String savePosition(OrderPosition orderPosition){ |
| | | try { |
| | | //将最新定位存储mongodb中 |
| | | GeoJsonPoint point = new GeoJsonPoint(new Point(Double.parseDouble(orderPosition.getLon()), |
| | | Double.parseDouble(orderPosition.getLat()))); |
| | | DriverPosition position = mongoTemplate.findOne(Query.query(Criteria.where("driverId") |
| | | .is(orderPosition.getDriverId())), DriverPosition.class); |
| | | if(null == position){ |
| | | position = new DriverPosition(); |
| | | } |
| | | position.setPoint(point); |
| | | mongoTemplate.save(position); |
| | | //处理业务上的功能 |
| | | orderPositionService.saveData(orderPosition); |
| | | return JSON.toJSONString(ResultUtil.success()); |
| | | }catch (Exception e){ |
| | |
| | | */ |
| | | @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.....") |
| | | }) |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryPhone") |
| | | @ApiOperation(value = "获取客服电话", tags = {"司机端-个人中心"}, notes = "车队=franchisee,分公司=branch,平台=platform") |
| | | @ApiOperation(value = "获取客服电话(黔云通)", tags = {"司机端-个人中心"}, notes = "车队=franchisee,分公司=branch,平台=platform") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "当前行政区划代码", name = "code", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryPhone(HttpServletRequest request){ |
| | | public ResultUtil queryPhone(String code, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Map<String, Object> map = driverService.queryPhone(uid); |
| | | Map<String, Object> map = driverService.queryPhone(uid, code); |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | |
| | | |
| | | /** |
| | | * 获取省市区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"), |
| | | @ApiImplicitParam(value = "name", name = "name", required = false, dataType = "String"), |
| | | |
| | | }) |
| | | public ResultUtil<List<CompanyVo>> getCompany(String areaCode,String name){ |
| | | 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); |
| | | } |
| | | Wrapper<Company> in = new EntityWrapper<Company>().eq("type", 2).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); |
| | | } |
| | | return ResultUtil.success(companyVos); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置提现密码 |
| | | * @param withdrawPassword |
| | | * @param request |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/base/driver/getDriverInfo") |
| | | public void getDriverInfo(String lsu, String ssologinid, String ticket, HttpSession session) { |
| | | try { |
| | | String onconParam = edu.yale.its.tp.cas.client.Util.getOnconParam(session); |
| | | onconParam = new String(Base64.getDecoder().decode(onconParam), "UTF-8"); |
| | | System.err.println("lsu: " + lsu + ",ticket: " + ticket + ",ssologinid: " + ssologinid); |
| | | } catch (Exception e) { |
| | | 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(); |
| | | // } |
| | | // } |
| | | } |