| | |
| | | |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.GlobalException; |
| | | import com.ruoyi.common.core.utils.GaoDeMapUtil; |
| | | import com.ruoyi.common.core.utils.ObsUploadUtil; |
| | | import com.ruoyi.worker.entity.Order; |
| | |
| | | @ApiImplicitParam(value = "师傅所在经度", name = "longitude", dataType = "String", required = true), |
| | | @ApiImplicitParam(value = "师傅所在纬度", name = "latitude", dataType = "String", required = true) |
| | | }) |
| | | public R<String> uploadPhoto(@RequestParam("file") MultipartFile file, @RequestParam String orderId, |
| | | public R<Boolean> uploadPhoto(@RequestParam("file") MultipartFile file, @RequestParam String orderId, |
| | | @RequestParam String longitude, @RequestParam String latitude) { |
| | | // 校验经纬度 |
| | | Order order = orderService.lambdaQuery().eq(Order::getIsDelete, orderId).eq(Order::getIsDelete, 0).one(); |
| | | Order order = orderService.lambdaQuery().eq(Order::getId, orderId) |
| | | .eq(Order::getIsDelete, 0).one(); |
| | | // 用户下单位置经纬度 |
| | | String orderPosition = order.getLongitude() + "," + order.getLatitude(); |
| | | // 师傅经纬度 |
| | |
| | | Long distance = GaoDeMapUtil.getDistance(orderPosition, workerPosition).getDatas(); |
| | | // 上传时判断是否在下单位置附件,距离大于某个值则 不允许上传 |
| | | if (distance > Constants.THREE_THOUSAND) { |
| | | throw new GlobalException("您当前手机定位超出当前订单预约地址范围 3km,无法提供回收服务!"); |
| | | // throw new GlobalException("您当前手机定位超出当前订单预约地址范围 3km,无法提供回收服务!"); |
| | | return R.fail(Boolean.FALSE, "您当前手机定位超出当前订单预约地址范围 3km,无法提供回收服务!"); |
| | | } |
| | | try { |
| | | return R.ok(ObsUploadUtil.obsUpload(file)); |